private String createFormatDefinition(JavaSourceStyleTable styleTable) { StringBuffer sb = new StringBuffer(); sb.append("%Java2TeX style definitions\n"); sb.append("%You can modify them to fit your needs\n"); JavaSourceType[] allTypes = JavaSourceType.getAll(); for (int i = 0; i < allTypes.length; ++i) { sb.append("\\newcommand{\\jttstyle"); sb.append((char) ('a' + i)); sb.append("}{\\color[rgb]{"); RGB color = styleTable.get(allTypes[i]).getColor(); float[] cs = new float[] { color.getRed() / 255.0f, color.getGreen() / 255.0f, color.getBlue() / 255.0f, }; sb.append(floatToCharArray(cs[0])); sb.append(','); sb.append(floatToCharArray(cs[1])); sb.append(','); sb.append(floatToCharArray(cs[2])); sb.append("}} %"); sb.append(allTypes[i].getName()); sb.append('\n'); } sb.append('\n'); return sb.toString(); }
static { JavaSourceType[] allTypes = JavaSourceType.getAll(); texFormats = new String[allTypes.length]; for (int i = 0; i < allTypes.length; ++i) { texFormats[i] = "\\jttstyle" + (char) ('a' + i) + " "; } }