Asciidoc and math equation does not render on .docx

时间:2015-05-04 19:37:58

标签: docx doc pandoc asciidoc asciidoctor

I'm trying to convert .adoc files to .docx

Actually I'm using:

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

My math equations or symbols inside .adoc are equal to:

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

It returns after conversion to docx the strange lines inside .docx:

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

Any hint?

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

1 个答案:

答案 0 :(得分:2)

您需要使用html输入明确启用tex_math_dollars扩展名:

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

sed可以处理剩余的转义括号(\():

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