latexpandoc

Why is Pandoc including Latex function parameters in the text body?


Pandoc is including function parameters in the output.

pdf output:

enter image description here

pandoc output (.docx):

enter image description here

Why is pandoc including the "center=" which is a parameter in the adjustbox function?

MWE:

\documentclass{article}

\usepackage{booktabs}
\usepackage{adjustbox}

\begin{document}

Test table:

\begin{table}
    \begin{adjustbox}{center=\textwidth}
        \begin{tabular}
            {@{}lll@{}}
            \toprule
            Col 1 & Col 2 & Col 3 \\
            \midrule
            North & South & West   \\
            12 & 15 & 176  \\
            \bottomrule
        \end{tabular}
    \end{adjustbox}
\end{table}

\end{document}


Solution

  • Pandoc doesn't know the adjustbox environment, so it reads the everything inside it as contents – even the options.

    Luckily, there is an easy fix: give pandoc a simplified definition of that environment:

    \newenvironment{adjustbox}{1}{}{}
    

    This tells pandoc that the environment takes an argument. Save that snippet to a file, say pandoc-helpers.tex and pass the file as the first input file:

    pandoc --from=latex pandoc-helpers.tex MY-INPUT-FILE.tex …
    

    With that the center= string will be gone from the output.