在 Markdown 使用 ngerman 時出現目錄錯誤

在 Markdown 使用 ngerman 時出現目錄錯誤

我是新來的,我的 Markwodn 文件需要一些幫助。我遇到了一個棘手的問題:當我嘗試編織 PDF 時,它給了我這個錯誤:
tlmgr.pl: Remote database (revision 69711 of the texlive-scripts package)
seems to be older than the local installation (rev 69718 of
texlive-scripts); please use a different mirror and/or wait a day or two.
! Undefined control sequence.
l.1 \babel@toc
               {nil}{}\relax 

這就是我的 YAML 標頭的樣子:

---
output: 
  pdf_document
   
header-includes:
  - \usepackage{ngerman}
  - \usepackage{setspace}
  - \onehalfspacing
  
csl: chicago-author-date.csl
bibliography: Heuschrecken.bib
---

這是我正在使用的庫:

library(xlsx)
library(devtools)
library(ggplot2)
library(ggpubr)
library(magrittr)
library(dplyr)
library(lsr)
library(ggpmisc)
library(readxl)
library(rbbt)
library(pandoc)
library(knitr)
library(kableExtra)
library(tinytex)

當我嘗試插入目錄時出現問題

\newpage
\tableofcontents
\newpage

我隔離了該錯誤,並且僅在使用 \tableofcontents 命令時才會發生該錯誤。令人驚訝的是,當我使用 \listoffigures 或 \listoftables 時,它運作得很好。我很高興收到有關如何修復此錯誤的任何建議。

我的系統是 Win 10, 64x - 如果這可能相關的話。

答案1

我找到了解決問題的方法。它與任何安裝無關。我將所有內容複製到另一個 RMarkdown 文件中,並且它有效。我不知道為什麼,但現在好了。

相關內容