Asciidoc and math equation not showing on .docx

I am trying to convert .adoc files to .docx

I actually use:

asciidoctor file.adoc -o file.html
pandoc -s -S file.html -o output.docx


My math equations or symbols inside .adoc are equal:

latexmath:[$\phi$] and more text as Inline test latexmath:[$\sin(x)$]


It returns strange lines inside .docx after converting to docx:

\($\phi$\) and more text as Inline test \($\sin(x)$\)


Any hints?

$ pandoc --version
Compiled with texmath 0.8.2, highlighting-kate 0.5.15.



source to share

1 answer

You need to explicitly enable the extension tex_math_dollars

with html input:

pandoc -s -S file.html -f html+tex_math_dollars -o output.docx


And sed can deal with the remaining skewed bracket ( \(


asciidoctor file.adoc -o file.html
sed -r 's/\\\(/\(/g' < file.html | sed -r 's/\\\)/\)/g' > file2.html
pandoc -s -S file2.html -f html+tex_math_dollars -o output.docx




All Articles