I'm trying to use this answer from a previous question to get frame numbers in a table of content in a beamer presentation made in RStudio with R Markdown and knitr (see file below; in in_header.tex the code from the answer I've linked to is inserted, can also be seen here).

        in_header: in_header.tex
      slide_level: 2
      toc: true
      latex_engine: xelatex

# Section 1

## Slide 1
Slide content

## Slide 2
Slide content

# Section 2

I get the following error message when trying to compile:

    ! LaTeX Error: No counter 'sectionpage' defined.

See the LaTeX manual or LaTeX Companion for explanation.
Type  H <return>  for immediate help.

l.135 \section{Section 1}

pandoc: Error producing PDF from TeX source
Error: pandoc document conversion failed with error 43
Execution halted

How do I define a counter for 'sectionpage'?

  • \newcounter{sectionpage} most likely, but I have no idea how to add this to the pandoc specifications
    – user31729
    Jan 19, 2016 at 10:59
  • To me it seems that pandoc produces an erroneous latex sourcecode. This can't really be solved on TeX's side I'm afraid :(
    – yo'
    Feb 16, 2016 at 9:55


Browse other questions tagged .