mirror of
https://github.com/hneemann/Digital.git
synced 2025-09-19 09:54:49 -04:00
More consistent LaTeX export of indexes.
This commit is contained in:
parent
89f287ce0b
commit
893283a0cd
@ -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;
|
||||
}
|
||||
|
@ -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()));
|
||||
}
|
||||
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user