【问题标题】:r markdown vitae package "Undefined control sequence" error when knitting to vitae predefined cv templatesr markdown vitae 包“未定义的控制序列”编织到 vitae 预定义的 cv 模板时出错
【发布时间】:2020-02-01 15:14:58
【问题描述】:

在 R markdown 中,我在编织“vitae”包中包含的任何开箱即用的 cv 模板(awesomecv、moderncv 等)时收到“未定义的控制序列”错误。我正在使用tinytex。这是我执行的开箱即用代码(太长,无法在 SO 帖子中包含整个内容,因此删除了“出版物”部分):

---
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
...

这是我得到的错误:

! 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

我在 Windows >= 8 x64 和 RStudio 上使用 R 版本 3.6.1 (2019-07-05)。

【问题讨论】:

  • 你能分享中间的filename.tex文件吗?

标签: r latex r-markdown knitr tinytex


【解决方案1】:

您首先在 YAML 标头的 output 部分中列出 pdf_document。这意味着它是默认的输出格式。 vitae 包生成的代码似乎需要 pdf_document 中未自动包含的 LaTeX 包。

但是,当我将订单切换到

output:
  vitae::awesomecv: default
  pdf_document: default

默认是vitae::awesomecv 格式,在这种格式下,一切正常。如果您使用的是 RStudio,您还可以使用 Knit 上的下拉菜单通过单击 Knit to awesomecv 自动进行此交换。

编辑添加:事实上,正如 cmets 中所指出的,完全删除 pdf_document 行可能是有意义的,在这种情况下可以简化为

output: vitae::awesomecv

【讨论】:

  • 完全摆脱pdf_document: default 可能是有意义的。
猜你喜欢
  • 1970-01-01
  • 2021-11-26
  • 1970-01-01
  • 2021-07-25
  • 2020-03-28
  • 1970-01-01
  • 2019-09-10
  • 2021-12-21
  • 1970-01-01
相关资源
最近更新 更多