Pandoc:[警告]无法转换TeX数学

问题描述 投票:1回答:1

我尝试使用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 pandoc mathjax
1个回答
3
投票

使用LaTeX \textrm而不是普通的tex \rm,pandoc将能够处理它。

© www.soinside.com 2019 - 2024. All rights reserved.