2

I have provided a minimal working example below.

\documentclass{article}
\usepackage{amsmath}
\begin{document}
$x^2$
\end{document}

I processed the above LaTeX file using

pandoc --webtex -t html | pandoc -f html -o my.docx

How can I increase the resolution of the resulting embedded equation in Word when using Pandoc to convert a LaTeX file to a Word file?

  • 4
    Why not go from TeX to docx directly? – Werner Dec 7 '18 at 20:45
  • 2
    Indeed as @Werner mentioned pandoc -s yourdocument.tex -o your.docx results in a math image with higher resolution. – Marijn Dec 7 '18 at 20:53
  • 1
    @Werner I don't want a direct conversion because Word does not correctly format many of my equations. @Marjin, as far as I can tell, running pandoc -s yourdocument.tex -o your.docx does not produce a math image but instead converts mathematical formulae to Word's native math formatting system. – Felix Garner Dec 7 '18 at 21:12
2

If you absolutely need your formulas as embedded images¹, you have to use a webservice, that lets you specify the output resolution.

One such service is latex.codecogs.com (it's pandoc's standard), it lets you define the solution with \dpi{<value>} where value can be 50, 80, 100, 110, 120, 150, 200, and 300.

The url to the png generator is: https://latex.codecogs.com/png.latex? The backslash (\) has to be replaced by %5C. So, if you want 300dpi output, you have to give pandoc the following argument:

--webtex='https://latex.codecogs.com/png.latex?%5Cdpi{300}'

––

¹Please. Don't.

  • Using your command changes the relative size of the equations in the final output. Is it possible to keep the relative size of the equations the same is in the LaTeX code, only changing their resolution? – Felix Garner Dec 7 '18 at 21:25
  • @FelixGarner I don't see how. Embedding pictures in word documents is always problematic, do not do it. – DG' Dec 7 '18 at 21:36

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.