Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Pandoc: [WARNING] Could not convert TeX math

I tried to convert html to docx by using Pandoc:
here is my html code:

<p> Example: ${v_1} = {\rm{ }}{v_2}$</p>

with MathJax config in head:


    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 command that i used (Pandoc version 2.2.3.2):


    pandoc -s  test.html --mathjax  -f html+tex_math_dollars   --pdf-engine=xelatex  -o  xxx.docx

then i got a warning:


    [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

Someone please tell me how to fix this. Thanks!

like image 340
Pak Nork Avatar asked Sep 13 '18 11:09

Pak Nork


1 Answers

Use the LaTeX \textrm instead of the plain tex \rm, and pandoc will be able to handle it.

like image 113
John MacFarlane Avatar answered Nov 03 '22 02:11

John MacFarlane