jgm/pandoc

Early macro substitution in `\ifstrequal` clauses

sgolovan opened this issue · 0 comments

The following LaTeX document fails to convert using pandoc 3.1.13:

\documentclass{article}
\usepackage{etoolbox}
\begin{document}
\def\foo{BAR}
\foo
\ifstrequal{BAR}{BAR}{\def\foo{BAZ}}{}
\foo
\end{document}

The error message is the following:

% ~/.cabal/bin/pandoc test.tex -o test.html
Error at "test.tex" (line 9, column 27):
unexpected BAR
\ifstrequal{BAR}{BAR}{\def\foo{BAZ}}{}
                          ^

It looks like pandoc substitutes the \foo macro too early, so it tries to interpret something like \def BAR{BAR}. LaTeX compiler issues PDF the expected BAR BAZ.