Asciidoc和数学方程不会在.docx上呈现

时间:2022-07-22 21:23:45

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

我正在尝试将.adoc文件转换为.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:

我在.adoc里面的数学方程或符号等于:

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

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

它在转换为docx后返回.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 个解决方案

#1


You need to explicitly enable the tex_math_dollars extension with html input:

您需要使用html输入显式启用tex_math_dollars扩展:

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

And sed can deal with the remaining escaped parenthesis (\() :

并且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

#1


You need to explicitly enable the tex_math_dollars extension with html input:

您需要使用html输入显式启用tex_math_dollars扩展:

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

And sed can deal with the remaining escaped parenthesis (\() :

并且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