Math mode confusion when reading latex #2743
mdjurfeldt
commented
Small sample case:
pandoc -f latex
$$ \vr{z} = \vri{x} + \vrii{x}\hbox{$i$} = \vriii{x} \cdot e^{i x_4}$$
^D
If you change $i$
to i
it works, so that might be a clue.
Looks like the parsers for display math and inline math don't expect $
characters inside.
See mathChars
in src/Text/Pandoc/Readers/LaTeX.hs
.
It should be possible to fix this by having mathChars
swallow anything in balanced braces.
Fixing this, it still fails in sem.tex, now in a more complex fashion.
Den 28 feb 2016 19:57 skrev "John MacFarlane" <notifications@github.com>:
…
It would be helpful if you could isolate this a bit more, and give a short test case where pandoc fails.
mdjurfeldt
commented
[Wrote last message from my cell phone.]
Please find test case enclosed. The pattern used in parts of r7rs.tex is to define an environment derived from tabbing but with math mode switched on. This is correct latex, so pandoc should handle it.
Pandoc currently resolves newcommand macro definitions, but
not newenvironment. So, when it sees your custom
environment it doesn't know it should be parsing in math
mode, hence the error.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
When trying to convert
http://trac.sacrideo.us/wg/raw-attachment/wiki/WikiStart/r7rs-small-spec.zip
to epub format through
pandoc r7rs.tex -f latex -t epub -o r7rs.epub
pandoc gets confused at multiple locations in the code regarding whether we are in math mode or not and fails, complaining about an unexpected "^".
This was tested also with the latest release 1.16.0.2.