Rmarkdown – Adapting LaTeX Class and Template File to an Rmarkdown Template

bookdownrmarkdown

I'm trying to adapt an unofficial University of South Florida Latex document class and template file which are available from http://shell.cas.usf.edu/~saito/grad/ into an Rmarkdown template similar to the thesisdown and huskydown packages. After playing with that for a while I was able to get a package that has a custom template (https://github.com/ailich/bulldown) and can be installed with remotes::install_github("ailich/bulldown"). The document will knit, but if I add any headers to the child documents (e.g. # Chapter 1) I get the error "! Undefined control sequence. l.49 \hypertarget". I've included a text file which lists the steps I took to create this R package/template and the edits I had to make to various files. Does anyone know how to fix this issue or why it would occur? I'm not very familiar with Latex so I've had trouble debugging this.

Best Answer

This can be accomplished with "-r", "markdown-auto_identifiers"

It can be specified in the YAML with

output: 
  bulldown::thesis_pdf:
    pandoc_args: [
      "-r", "markdown-auto_identifiers"
      ]

or in a function like bookdown::pdf_book using the pandoc_args argument

pandoc_args = c(pandoc_args, "--top-level-division=chapter", "-r","markdown-auto_identifiers")

Related Question