Improves the spacing in LaTeX math mode output.

This commit is contained in:
hneemann 2020-09-21 09:26:57 +02:00
parent 909b7bf09b
commit c45de225c4

View File

@ -27,6 +27,7 @@ public final class LaTeXFormatter {
public static String format(Expression exp) { public static String format(Expression exp) {
return format(new ExpressionToText().createText(exp, FormatToExpression.FORMATTER_LATEX), true); return format(new ExpressionToText().createText(exp, FormatToExpression.FORMATTER_LATEX), true);
} }
/** /**
* Formats the given text * Formats the given text
* *
@ -41,7 +42,10 @@ public final class LaTeXFormatter {
if (text instanceof Simple) { if (text instanceof Simple) {
return ((Simple) text).getText(); return ((Simple) text).getText();
} else if (text instanceof Blank) { } else if (text instanceof Blank) {
return " "; if (mathMode)
return "\\ ";
else
return " ";
} else if (text instanceof Character) { } else if (text instanceof Character) {
return character(((Character) text).getChar(), mathMode); return character(((Character) text).getChar(), mathMode);
} else if (text instanceof Decorate) { } else if (text instanceof Decorate) {