improves the LaTeX export; unicode sum and prod symbols are exported to LaTeX

This commit is contained in:
hneemann 2020-05-23 08:43:31 +02:00
parent 1c223e9af4
commit 0d39344f13
2 changed files with 15 additions and 0 deletions

View File

@ -109,6 +109,16 @@ public final class LaTeXFormatter {
return "\\textgreater{}";
case '&':
return "\\&";
case '∑':
if (inMath)
return "\\sum ";
else
return "$\\sum$";
case '∏':
if (inMath)
return "\\prod ";
else
return "$\\prod$";
default:
return "" + aChar;
}

View File

@ -31,4 +31,9 @@ public class LaTeXFormatterTest extends TestCase {
assertEquals("a$\\neg{}$b", LaTeXFormatter.format(new Parser("a¬b").parse()));
assertEquals("$a\\neg{}b$", LaTeXFormatter.format(new Parser("$a¬b$").parse()));
}
public void testSumProd() throws ParseException {
assertEquals("$\\sum ^a_{n=0}$", LaTeXFormatter.format(new Parser("∑_{n=0}^a").parse()));
assertEquals("$\\prod ^a_{n=0}$", LaTeXFormatter.format(new Parser("∏_{n=0}^a").parse()));
}
}