1

I'm trying to convert a book to word format (or at least get a passable first attempt) using pandoc and the book frequently uses the symbol \Diamond in equations. However, pandoc's output gives garbage whenever that symbol is subscripted.

Here is test code of a file and a screen shot of the resulting output

\documentclass[11pt,leqno]{article}
\usepackage{amsmath,amssymb}

\begin{document}

\( \Diamond \phi \) 


\( \Diamond_{\phi} \psi \iff \Box_{\phi} \phi \) 

\end{document}

And here is what is produced after running: pandoc test.tex -o test.docx (latest word for OS X)

pandoc-result

Note that it works fine without a subscript Is there any way to redefine/replace \Diamond with some other symbol that pandoc will handle? Other solutions?

(\diamond seems to work better but produces much too small a symbol).

1
  • This seems to be a font problem. If I change the font in word to LibertinusMath the diamond is displayed correctly
    – DG'
    Oct 27, 2020 at 9:21

1 Answer 1

2

This is (somehow, obscurely) a problem with Word's default math font.¹ Change the font in Word and the diamond will be displayed correctly:

Fira Math

enter image description here

Libertinus Math

enter image description here

Another solution is converting to .odt with pandoc test.tex -o test.odt and opening the resulting file with Word:

enter image description here


  1. Maybe it is a problem caused by pandoc's docx-writer, that is fixed by changing to another font...
6
  • Thanks!! You don't happen to know how to change the font used in all the equations in a doc ...I see how to do it an equation at a time but I’m not finding a general way. Oct 27, 2020 at 9:56
  • In theory, you can change the defaults of a .docx file and use it as a template with pandoc (option: --reference-doc=FILE). But I don't know, how to change the math font in word globally either.
    – DG'
    Oct 27, 2020 at 10:23
  • well thanks anyway...now that I know it's just a font issue this can probably just be dumped on the stupid publisher who insisted on word for my wife's philosophy book that has a giant pile of theorems in it...I’m sure they use their own fonts anyway. Oct 27, 2020 at 10:28
  • Math works better, if you convert the file to .odt and open the resulting file with word... Also, try tex4ht instead of pandoc, it's better suited for larger projects like books
    – DG'
    Oct 27, 2020 at 10:33
  • 1
    @PeterGerdes TeX4ht doesn't need to produce images for math, it depends on options you use. The best results can be achieved using MathML and MathJax. You can try it using make4ht test "mathml,mathjax".
    – michal.h21
    Nov 2, 2020 at 13:42

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .