From 131082cf6a9a4a0076f5d874302922c233075437 Mon Sep 17 00:00:00 2001 From: Martin Zurowietz Date: Thu, 4 Dec 2014 17:36:48 +0100 Subject: [PATCH] Added LaTeX output to example. --- README.md | 8 +++++++- .../cebitec/mzurowie/pretty_formula/main/GUIWindow.java | 1 + 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 764297d..817b793 100644 --- a/README.md +++ b/README.md @@ -2,12 +2,18 @@ A small Java library to parse mathematical formulas to LaTeX and display them as images +Formula: ``` (a_1 / (b_1 + sqrt(c))^2) + sin(a_2 * b_2) ``` - +Image: ![example](example.png?raw=true) +LaTeX: +```latex +\left(\frac{{a}_{1}}{{\left({b}_{1}+\sqrt{c}\right)}^{2}}\right)+\sin{\left({a}_{2}\cdot {b}_{2}\right)} +``` + ## Installation Grab the latest release and add the `pretty-formula.jar` as well as all the dependencies from the `lib` directory to your project. diff --git a/src/de/uni_bielefeld/cebitec/mzurowie/pretty_formula/main/GUIWindow.java b/src/de/uni_bielefeld/cebitec/mzurowie/pretty_formula/main/GUIWindow.java index 1d779bf..c8f0207 100644 --- a/src/de/uni_bielefeld/cebitec/mzurowie/pretty_formula/main/GUIWindow.java +++ b/src/de/uni_bielefeld/cebitec/mzurowie/pretty_formula/main/GUIWindow.java @@ -119,6 +119,7 @@ private void jTextPane1KeyReleased(java.awt.event.KeyEvent evt) {//GEN-FIRST:eve try { BufferedImage image = FormulaParser.parseToImage(this.jTextPane1.getText()); + System.out.println(FormulaParser.parseToLatex(this.jTextPane1.getText())); this.jLabel2.getGraphics().drawImage(image, 0, 0, null); } catch (DetailedParseCancellationException e) {