Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

pandoc escapes latex in docbook source #2422

Closed
everflux opened this issue Sep 27, 2015 · 3 comments
Closed

pandoc escapes latex in docbook source #2422

everflux opened this issue Sep 27, 2015 · 3 comments

Comments

@everflux
Copy link

I have an asciidoc document that contains latex symbols and formulas.
Since pandoc does not support asciidoc input I export the asciidoc to docbook xml and use that as source for pandoc. This works good so far, except that I can not get latex formulas working.
I tried tex_raw, tex_math_dollars, but pandoc always escapes the formula like

lambda: \$1+ \textbackslash{}lambda\$

expected was

lambda: $1+\lambda$

Is this a bug or is there a way to get pandoc accept latex formulas inside docook?

@jgm
Copy link
Owner

jgm commented Sep 27, 2015

pandoc expects math in DocBook to be in MathML (since that's
actually a supported math format in DocBook).

It looks like asciidoc produces DocBook as follows (for input
with $x=f^2$):

<simpara><inlineequation>
<alt><![CDATA[$x=f^2$]]></alt>
<inlinemediaobject><textobject><phrase></phrase></textobject></inlinemediaobject>
</inlineequation></simpara>

So, only the alt element contains anything. I suppose we could
change the DocBook reader so that it expects raw TeX from the alt
element if there is no MathML... Relevant code is equation on
line 981 of src/Text/Pandoc/Readers/DocBook.hs.

+++ Thomas [Sep 27 15 10:59 ]:

I have an asciidoc document that contains latex symbols and formulas.
Since pandoc does not support asciidoc input I export the asciidoc to
docbook xml and use that as source for pandoc. This works good so far,
except that I can not get latex formulas working.
I tried tex_raw, tex_math_dollars, but pandoc always escapes the
formula like
lambda: $1+ \textbackslash{}lambda$

expected was
lambda: $1+\lambda$

Is this a bug or is there a way to get pandoc accept latex formulas
inside docook?


Reply to this email directly or [1]view it on GitHub.

References

  1. pandoc escapes latex in docbook source #2422

@everflux
Copy link
Author

Actually I tried to trick pandoc by not using mathlatex in asciidoc, but plain latex which is retained in docbook:

<simpara>lambda $1+ \lambda$</simpara>

But this gets escaped by pandoc when generating the latex source for the output.
When using mathlatex in asciidoc it seems to be rendered as an image which is then not found by latex called by pandoc.

@jgm
Copy link
Owner

jgm commented Oct 14, 2015

Try

pandoc -f docbook -t markdown-tex_math_dollars

@jgm jgm closed this as completed Oct 14, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants