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

标签 docx doc pandoc asciidoc asciidoctor

我正在尝试将 .adoc 文件转换为 .docx

实际上我正在使用:

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

我在 .adoc 中的数学方程或符号等于:
latexmath:[$\phi$] and more text as Inline test latexmath:[$\sin(x)$]

它在转换为 docx 后返回 .docx 中的奇怪行:
\($\phi$\) and more text as Inline test \($\sin(x)$\)

任何提示?
$ pandoc --version
pandoc 1.13.2.1
Compiled with texmath 0.8.2, highlighting-kate 0.5.15.

最佳答案

您需要显式启用 tex_math_dollars带有 html 输入的扩展:

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

关于docx - Asciidoc 和数学方程不会在 .docx 上呈现,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30038548/

相关文章:

xml - Microsoft Word (OOXML/DOCX) 文档格式验证

python - 无法为 python-docx 中的文本设置 "right to left"对齐样式

java - 在不知道其扩展名的情况下确定文档是 Java 应用程序中的 DOC 还是 DOCX

php - 将 DOC 和 PDF 内容与 PHP 中的字符串进行匹配

java - Apache POI : Word get picture dimensions

latex - pandoc LaTex 改变`反引号高亮

用于阅读 doc、docx、pdf 的 C 程序

java - 在 Java 中将 HTML 与图像一起转换为 DOC

r - 仅将 pandoc_args 应用于 rmarkdown 文档的一部分——例如两列

heroku - 如何在heroku中安装pdflatex