TransWikia.com

Pandoc won't process text italics in an mbox in math mode

TeX - LaTeX Asked by Mars on November 19, 2020

I’m using pandoc to convert LaTeX to Word. I represent certain concepts as multi-letter, italicized words. I need to embed the same representations in some math. xelatex has no problem with the following MWE. pandoc -o mwe.docx mwe.tex converts the mboxed text in the first instance, but refuses to process any of the italics commands inside mbox. (Adding additional braces doesn’t help.)

documentclass{article}
begin{document}
Let's apply $f$ to a {em thing/}, {it things/}, or textit{more things}:
[
    f(mbox{thing})
]
Oh, wait, forgot the italics:
[
    f(mbox{em thing/})
]
[
    f(mbox{it thing/})
]
[
    f(mbox{textit{more things}})
]
end{document}

In each case, pandoc’s error message points at the first backslash within the mbox, and says something like:

[WARNING] Could not convert TeX math 'f(mbox{textit{more things}})', rendering as TeX:
  f(mbox{textit{more things}})
          ^
  unexpected ""
  expecting "}", text, "{", "$", "$$", "(" or "["

I know that pandoc only converts a large subset of LaTeX. Being able to handle a standard text font within an mbox seems like a basic capability, but the error messages clearly suggest that including LaTeX commands within an mbox goes beyond what pandoc will do. I’m using a version that I downloaded and installed last week:

pandoc 2.10.1
Compiled with pandoc-types 1.21, texmath 0.12.0.2, skylighting 0.8.5

I’m wondering if there is a pandoc trick or a LaTeX workaround that I could use. Since the italicized words don’t fundamentally represent mathematical concepts, I don’t think it’s appropriate to put them in math italics, would would look odd, anyway. I’m open to any suggestion, however.

(The argument to a function doesn’t have to be mathematical. Let the function be height-of, with people as arguments. Don’t ask me how to put a person between the parentheses, though.)

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP