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!
Use the LaTeX \textrm
instead of the plain tex \rm
, and pandoc will be able to handle it.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With