From c45de225c45b65c25046fb943acb03850afd73e8 Mon Sep 17 00:00:00 2001 From: hneemann Date: Mon, 21 Sep 2020 09:26:57 +0200 Subject: [PATCH] Improves the spacing in LaTeX math mode output. --- .../draw/graphics/text/formatter/LaTeXFormatter.java | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/main/java/de/neemann/digital/draw/graphics/text/formatter/LaTeXFormatter.java b/src/main/java/de/neemann/digital/draw/graphics/text/formatter/LaTeXFormatter.java index 4a3960e5b..d77575625 100644 --- a/src/main/java/de/neemann/digital/draw/graphics/text/formatter/LaTeXFormatter.java +++ b/src/main/java/de/neemann/digital/draw/graphics/text/formatter/LaTeXFormatter.java @@ -27,6 +27,7 @@ public final class LaTeXFormatter { public static String format(Expression exp) { return format(new ExpressionToText().createText(exp, FormatToExpression.FORMATTER_LATEX), true); } + /** * Formats the given text * @@ -41,7 +42,10 @@ public final class LaTeXFormatter { if (text instanceof Simple) { return ((Simple) text).getText(); } else if (text instanceof Blank) { - return " "; + if (mathMode) + return "\\ "; + else + return " "; } else if (text instanceof Character) { return character(((Character) text).getChar(), mathMode); } else if (text instanceof Decorate) {