From c243e5b67b0a3be6a713c6120da24e5e65cb0357 Mon Sep 17 00:00:00 2001 From: John MacFarlane Date: Sun, 25 Apr 2010 12:33:50 -0700 Subject: Use texmath's parser in TexMath module. * This replaces a lot of custom parser code, and expands the tex -> unicode conversion. * The behavior has also changed: if the whole formula can't be converted, the whole formula is left in raw TeX. Previously, pandoc converted parts of the formula to unicode and left other parts in raw TeX. * Added (but not yet exported) readTeXMath', which returns a Maybe. * Updated tests --- tests/s5.basic.html | 26 +------------------------- tests/s5.fragment.html | 26 +------------------------- tests/s5.inserts.html | 26 +------------------------- tests/writer.docbook | 10 +++++----- tests/writer.html | 34 +++++----------------------------- tests/writer.opendocument | 37 ++++++++++++------------------------- tests/writer.rtf | 10 +++++----- 7 files changed, 30 insertions(+), 139 deletions(-) (limited to 'tests') diff --git a/tests/s5.basic.html b/tests/s5.basic.html index 253bcab2f..659fc065a 100644 --- a/tests/s5.basic.html +++ b/tests/s5.basic.html @@ -309,31 +309,7 @@ > diff --git a/tests/s5.fragment.html b/tests/s5.fragment.html index 6ab704d41..32346a331 100644 --- a/tests/s5.fragment.html +++ b/tests/s5.fragment.html @@ -14,31 +14,7 @@ > - 2+2=4 + 2 + 2 = 4 - x ∈ y + x ∈ y - α ∧ ω + α ∧ ω @@ -1103,13 +1103,13 @@ Blah Here's some display math: - \frac{d}{dx}f(x)=\limh → 0\frac{f(x+h)-f(x)}{h} + $\frac{d}{dx}f(x)=\lim_{h\to 0}\frac{f(x+h)-f(x)}{h}$ Here's one that has a line break in it: - α+ω × x2. + α + ω × x2. diff --git a/tests/writer.html b/tests/writer.html index f41a8e60a..b8296a536 100644 --- a/tests/writer.html +++ b/tests/writer.html @@ -830,19 +830,19 @@ Blah >
  • 2+2=42 + 2 = 4
  • x ∈  ∈ y
  • α ∧ ωα ∧ ω
  • -Tree
  • Here’s some display math: \frac{d}{dx}f(x)=\limh → 0\frac{f(x+h)-f(x)}{h}$\frac{d}{dx}f(x)=\lim_{h\to 0}\frac{f(x+h)-f(x)}{h}$
  • Here’s one that has a line break in it: α+ω × α + ω × x2 - + - - - + + + - - - - - - - - - - - - - @@ -1317,13 +1304,13 @@ \cite[22-23]{smith.1899} - 2+2=4 + 2 + 2 = 4 - x ∈ y + x ∈ y - α ∧ ω + α ∧ ω 223 @@ -1332,10 +1319,10 @@ p-Tree - Here’s some display math: \frac{d}{dx}f(x)=\limh → 0\frac{f(x+h)-f(x)}{h} + Here’s some display math: $\frac{d}{dx}f(x)=\lim_{h\to 0}\frac{f(x+h)-f(x)}{h}$ - Here’s one that has a line break in it: α+ω × x2. + Here’s one that has a line break in it: α + ω × x2. These shouldn’t be math: @@ -1344,13 +1331,13 @@ To get the famous equation, write $e = mc^2$. - $22,000 is a lot of money. So is $34,000. (It worked if “lot” is emphasized.) + $22,000 is a lot of money. So is $34,000. (It worked if “lot” is emphasized.) Shoes ($20) and socks ($5). - Escaped $: $73 this should be emphasized 23$. + Escaped $: $73 this should be emphasized 23$. Here’s a LaTeX table: @@ -1454,7 +1441,7 @@ Cat & 1 \\ \hline Here is a movie icon. Footnotes -Here is a footnote reference,1Here is the footnote. It can go anywhere after the footnote reference. It need not be placed at the end of the document. and another.2Here’s the long note. This one contains multiple blocks.Subsequent blocks are indented to show that they belong to the footnote (as with list items).{ <code> }If you want, you can indent every line, but you can also be lazy and just indent the first line of each block. This should not be a footnote reference, because it contains a space.[^my note] Here is an inline note.3This is easier to type. Inline notes may contain links and ] verbatim characters, as well as [bracketed text]. +Here is a footnote reference,1Here is the footnote. It can go anywhere after the footnote reference. It need not be placed at the end of the document. and another.2Here’s the long note. This one contains multiple blocks.Subsequent blocks are indented to show that they belong to the footnote (as with list items).{ <code> }If you want, you can indent every line, but you can also be lazy and just indent the first line of each block. This should not be a footnote reference, because it contains a space.[^my note] Here is an inline note.3This is easier to type. Inline notes may contain links and ] verbatim characters, as well as [bracketed text]. Notes can go in quotes.4In quote. diff --git a/tests/writer.rtf b/tests/writer.rtf index ae3776261..9bb6547cb 100644 --- a/tests/writer.rtf +++ b/tests/writer.rtf @@ -264,13 +264,13 @@ quoted link {\pard \qc \f0 \sa180 \li0 \fi0 \emdash\emdash\emdash\emdash\emdash\par} {\pard \ql \f0 \sa180 \li0 \fi0 \b \fs36 LaTeX\par} {\pard \ql \f0 \sa0 \li360 \fi-360 \bullet \tx360\tab \par} -{\pard \ql \f0 \sa0 \li360 \fi-360 \bullet \tx360\tab 2+2=4\par} -{\pard \ql \f0 \sa0 \li360 \fi-360 \bullet \tx360\tab {\i x}\u8201?\u8712?\u8201?{\i y}\par} -{\pard \ql \f0 \sa0 \li360 \fi-360 \bullet \tx360\tab \u945?\u8201?\u8743?\u8201?\u969?\par} +{\pard \ql \f0 \sa0 \li360 \fi-360 \bullet \tx360\tab 2\u8197?+\u8197?2\u8196?=\u8196?4\par} +{\pard \ql \f0 \sa0 \li360 \fi-360 \bullet \tx360\tab {\i x}\u8196?\u8712?\u8196?{\i y}\par} +{\pard \ql \f0 \sa0 \li360 \fi-360 \bullet \tx360\tab \u945?\u8197?\u8743?\u8197?\u969?\par} {\pard \ql \f0 \sa0 \li360 \fi-360 \bullet \tx360\tab 223\par} {\pard \ql \f0 \sa0 \li360 \fi-360 \bullet \tx360\tab {\i p}-Tree\par} -{\pard \ql \f0 \sa0 \li360 \fi-360 \bullet \tx360\tab Here\u8217's some display math: \\frac\{{\i d}\}\{{\i dx}\}{\i f}({\i x})=\\lim{\sub {\i h}\u8201?\u8594?\u8201?0}\\frac\{{\i f}({\i x}+{\i h})-{\i f}({\i x})\}\{{\i h}\}\par} -{\pard \ql \f0 \sa0 \li360 \fi-360 \bullet \tx360\tab Here\u8217's one that has a line break in it: \u945?+\u969?\u8201?\u215?\u8201?{\i x}{\super 2}.\sa180\par} +{\pard \ql \f0 \sa0 \li360 \fi-360 \bullet \tx360\tab Here\u8217's some display math: $\\frac\{d\}\{dx\}f(x)=\\lim_\{h\\to 0\}\\frac\{f(x+h)-f(x)\}\{h\}$\par} +{\pard \ql \f0 \sa0 \li360 \fi-360 \bullet \tx360\tab Here\u8217's one that has a line break in it: \u945?\u8197?+\u8197?\u969?\u8197?\u215?\u8197?{\i x}{\super 2}.\sa180\par} {\pard \ql \f0 \sa180 \li0 \fi0 These shouldn\u8217't be math:\par} {\pard \ql \f0 \sa0 \li360 \fi-360 \bullet \tx360\tab To get the famous equation, write {\f1 $e = mc^2$}.\par} {\pard \ql \f0 \sa0 \li360 \fi-360 \bullet \tx360\tab $22,000 is a {\i lot} of money. So is $34,000. (It worked if \u8220"lot\u8221" is emphasized.)\par} -- cgit v1.2.3