title: Why is Pandoc not converting a .tex to .pdf but will convert the .md fine?
body: <p>I have a number of Markdown files which I am converting to PDF using Pandoc - including folding in some header files with LaTeX options.</p>
  
  <p>This works if I create the PDF in a single step (MD → PDF), however, I need to perform some additional steps on the intermediate LaTeX file so I am trying to split the Pandoc process into two steps (MD → TEX → PDF) - which produces an "Undefined Control Sequence" error.</p>
  
  <p>I have compared the <code>.tex</code> file produced by one-step-Pandoc with the two-step version and they are identical - including the relevant <code>\usepackage</code> commands for the LaTeX packages that produce the error.</p>
  
  <p>I am running on Windows, and have updated Pandoc to 2.7.3 and updated all my MiKTeX packages this morning.</p>
  
  <p>Minimal test files that produce this error:</p>
  
  <p><code>test.md</code>:</p>
  
  <pre><code>% Title
  % Author
  % Date
  
  Body text
  </code></pre>
  
  <p>title.tex</p>
  
  <pre><code>\setmainfont{Times New Roman}\fontsize{11pt}{11pt}\selectfont
  \sectionfont{
      \setmainfont{Arial}
      \fontsize{32pt}{32pt}
      \selectfont
  }
  </code></pre>
  
  <p>When I use a single step command, the PDF produces correctly without issue:</p>
  
  <pre><code>&gt; pandoc test.md options.yaml -o test.pdf -f markdown+smart+tex_math_dollars -s -V block-headings -H fontoptions.tex -B title.tex -B title_logo.tex -B header.tex --pdf-engine=lualatex
  lualatex: warning: running with administrator privileges
  lualatex: warning: running with administrator privileges
  lualatex: warning: running with administrator privileges
  </code></pre>
  
  <p>When run in two steps:</p>
  
  <pre><code>&gt; pandoc test.md options.yaml -o test.tex -f markdown+smart+tex_math_dollars -s -V block-headings -H fontoptions.tex -B title.tex -B title_logo.tex -B header.tex
  
  &gt; pandoc test.tex -o test.pdf -f latex --pdf-engine=lualatex
  lualatex: warning: running with administrator privileges
  lualatex: warning: running with administrator privileges
  lualatex: warning: running with administrator privileges
  Error producing PDF.
  ! Undefined control sequence.
  l.81 \sectionfont
  </code></pre>