Pandoc: Syntax package causes error "Missing endcsname inserted"

Viewed 608

I'm using Pandoc to write a report, and I want to use the syntax package to typeset a BNF grammar.

What I tried was to \usepackage{syntax} in the header-includes of the Pandoc metadata yaml at the top of my document. Then I write my grammar like so within the document body:

\begin{grammar}

<statement> ::= <ident> `=' <expr> 
\alt `for' <ident> `=' <expr> `to' <expr> `do' <statement> 
\alt `{' <stat-list> `}' 
\alt <empty> 

<stat-list> ::= <statement> `;' <stat-list> | <statement> 

\end{grammar}

(Example from here)

And when I run pandoc in the terminal to compile my document, I get this error message:

Error producing PDF.
! Missing endcsname inserted.
<to be read again>
                   protect
l.371 ...4949db3940f9f3a99133c3bbd69af2cf3fcd.png}

What is even more strange is that I get this error even if I just \usepackage{syntax} without even writing a grammar. A search for the package on my computer using kpsewhich syntax.sty in the terminal shows that it is indeed installed. I've seen someone else talk about a similar issue online, where the problem was that their document was referencing files which had underscores in their names, but I do not have any filenames with underscores in them.

0 Answers
Related