我尝试使用Pandoc将html转换为docx: 这是我的HTML代码:
<p> Example: ${v_1} = {\rm{ }}{v_2}$</p>
使用MathJax配置:
MathJax.Hub.Config({ extensions: ["tex2jax.js", "TeX/AMSmath.js", "TeX/AMSsymbols.js"], jax: ["input/TeX", "output/HTML-CSS"], tex2jax: { inlineMath: [['$', '$'], ["\(", "\)"]], displayMath: [['$$', '$$'], ["\[", "\]"]], }, "HTML-CSS": {availableFonts: ["TeX"]} });
我使用的Pandoc命令(Pandoc版本2.2.3.2):
pandoc -s test.html --mathjax -f html+tex_math_dollars --pdf-engine=xelatex -o xxx.docx
然后我收到了一个警告:
[WARNING] Could not convert TeX math '{v_1} = {\rm{ }}{v_2}', rendering as TeX: {v_1} = {\rm{ }}{v_2} ^ unexpected "{" expecting "%", "\\label", "\\nonumber" or whitespace
有人请告诉我如何解决这个问题。谢谢!
使用LaTeX \textrm
而不是普通的tex \rm
,pandoc将能够处理它。