I'm using pandoc in markdown+raw_tex mode to generate PDFs through either Xetex or Luatex. When I generate the intermediate TeX representation, the generation fails because the processor encounters an \textbackslash
before it meets \begin{document}
. Specifically, the tex file it tries to process contains:
\makeatletter
\textbackslash renewcommand\{@mkboth\}{2} \makeatother
... stuff here ...
\title{My Title}
\usepackage{etoolbox}
\makeatletter
\providecommand{\subtitle}[1]{% add subtitle to \maketitle
\apptocmd{\@title}{\par {\large #1 \par}}{}{}
}
\makeatother
\subtitle{foo}
\author{Me}
\date{}
\begin{document}
... more stuff here ...
In other words, instead of calling \renewcommand
it somehow encoded the \
into a \textbackslash
.
My markdown preamble does in fact contain
header-includes: |
...
\makeatletter
\renewcommand{\@mkboth}[2]{}
\makeatother
So I'm wondering why it felt the need to tex-encode something from the preamble and how I can avoid it.
As explained here, the latex code in the preamble must be marked up as such:
header-includes: |
```{=latex}
\makeatletter
\renewcommand{\@mkboth}[2]{}
\makeatother
```