jgm/pandoc

Fails on LaTeX input with environments within captions

ning-y opened this issue · 4 comments

Reporting a bug?

pandoc 2.2.2.1
Compiled with pandoc-types 1.17.5.1, texmath 0.11.0.1, skylighting 0.7.2

MWE

\documentclass[a4paper]{article}
\usepackage[inline]{enumitem}

\begin{document}
\begin{figure}
  \caption[]{\begin{enumerate*}\item A caption.\end{enumerate*}}
\end{figure}
\end{document}

Command used

pandoc mwe.tex --output mwe.docx

Error message

Error at "source" (line 6, column 14):
unexpected \begin
  \caption[]{\begin{enumerate*}\item A caption.\end{enumerate*}}
jgm commented

Pandoc's document model can't currently represent block-level content (e.g. lists) as figure captions. Best we could do now would be to collapse this somehow to inline text.

Perhaps a note for others coming across this issue: the enumerate* environment of enumitem creates an inline list, so "collapsing this somehow to inline text" is extremely reasonable.

Pandoc's document model can't currently represent block-level content (e.g. lists) as figure captions. Best we could do now would be to collapse this somehow to inline text.

Why not place the text in a text box that has the same width as the figure?

jgm commented

Why not place the text in a text box that has the same width as the figure?

The document model has no concept of text boxes with widths, either.