More consistent LaTeX export of indexes.

This commit is contained in:
hneemann 2017-12-20 19:19:10 +01:00
parent 89f287ce0b
commit 893283a0cd
2 changed files with 5 additions and 5 deletions

View File

@ -139,7 +139,7 @@ public class GraphicSVGLaTeX extends GraphicSVG {
private String formatIndex(String text) {
int p = text.lastIndexOf("_");
if (p > 0) {
text = "$" + text.substring(0, p) + "_{" + text.substring(p + 1) + "}$";
text =text.substring(0, p) + "$_{" + text.substring(p + 1) + "}$";
}
return text;
}

View File

@ -10,7 +10,7 @@ public class GraphicSVGLaTeXTest extends TestCase {
GraphicSVGLaTeX gs = new GraphicSVGLaTeX(System.out, null, 30);
gs.setBoundingBox(new Vector(0, 0), new Vector(30, 30));
assertEquals("$Z_{0}$", gs.formatText("Z_0", Style.NORMAL.getFontSize()));
assertEquals("Z$_{0}$", gs.formatText("Z_0", Style.NORMAL.getFontSize()));
assertEquals("\\&", gs.formatText("&", Style.NORMAL.getFontSize()));
assertEquals("$\\geq\\!\\!{}$1", gs.formatText("\u22651", Style.NORMAL.getFontSize()));
assertEquals("$\\geq\\!\\!{}1$", gs.formatText("$\u22651$", Style.NORMAL.getFontSize()));
@ -21,9 +21,9 @@ public class GraphicSVGLaTeXTest extends TestCase {
assertEquals("{\\footnotesize Grün}", gs.formatText("Grün", Style.SHAPE_PIN.getFontSize()));
assertEquals("{\\footnotesize $Z_{0}$}", gs.formatText("Z_0", Style.SHAPE_PIN.getFontSize()));
assertEquals("{\\scriptsize $Z_{0}$}", gs.formatText("Z_0", 14));
assertEquals("{\\tiny $Z_{0}$}", gs.formatText("Z_0", Style.WIRE_BITS.getFontSize()));
assertEquals("{\\footnotesize Z$_{0}$}", gs.formatText("Z_0", Style.SHAPE_PIN.getFontSize()));
assertEquals("{\\scriptsize Z$_{0}$}", gs.formatText("Z_0", 14));
assertEquals("{\\tiny Z$_{0}$}", gs.formatText("Z_0", Style.WIRE_BITS.getFontSize()));
}
}