2

In R markdown, I'm getting an "Undefined control sequence" error when knitting any of the out-of-the-box cv templates (awesomecv, moderncv, etc.) included in the "vitae" package. I am using tinytex. Here is the out-of-the-box code I execute (too long to include whole thing in an SO post, so "Publications" section removed):

---
address: School of Physics & Chemistry, cole Normale Suprieure
date: "`r format(Sys.time(), '%B %Y')`"
email: Marie.Curie@ens.fr
github: mariecurie
linkedin: mariecurie
name: Marie
output:
  pdf_document: default
  vitae::awesomecv: default
phone: +1 22 3333 4444
position: Professor
surname: Curie
twitter: mariecurie
www: mariecurie.com
---

```{r setup, include=FALSE}
knitr::opts_chunk$set(echo = FALSE, warning = FALSE, message = FALSE)
library(vitae)
```

# Some stuff about me

 * I poisoned myself doing research.
 * I was the first woman to win a Nobel prize
 * I was the first person and only woman to win a Nobel prize in two different sciences.

# Education


# Nobel Prizes

```{r}
library(tibble)
library(vitae)
tribble(
  ~Year, ~Type, ~Desc,
  1903, "Physics", "Awarded for her work on radioactivity with Pierre Curie and Henri Becquerel",
  1911, "Chemistry", "Awarded for the discovery of radium and polonium"
) %>% 
  brief_entries(
    glue::glue("Nobel Prize in {Type}"),
    Year, 
    Desc
  )
```

# Publications
...

And here is the error I get:

! Undefined control sequence.
l.104 \briefsection
                   {\briefitem{Nobel Prize in Physics}{1903}{Awarded for her...

Error: Failed to compile filename.tex. See https://yihui.name/tinytex/r/#debugging for debugging tips. See filename.log for more info.
Execution halted

I'm using R version 3.6.1 (2019-07-05) on Windows >= 8 x64, with RStudio.

ben
  • 787
  • 3
  • 16
  • 32

1 Answers1

2

You list pdf_document first in the output section of your YAML header. That means it's the default output format. It appears that the vitae package generates code that requires a LaTeX package that isn't automatically included with pdf_document.

However, when I switch the order to

output:
  vitae::awesomecv: default
  pdf_document: default

the default is the vitae::awesomecv format, and in that format, things work. If you're using RStudio, you can also use the dropdown menu on Knit to make this swap automatically by clicking on Knit to awesomecv.

Edited to add: In fact, as pointed out in the comments, it probably makes sense to delete the pdf_document line entirely, in which case it can be simplified to

output: vitae::awesomecv
user2554330
  • 37,248
  • 4
  • 43
  • 90