我尝试使用 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
有人请告诉我如何解决这个问题。谢谢!