Markdown で ngerman を使用しているときに tableofcontents でエラーが発生しました

Markdown で ngerman を使用しているときに tableofcontents でエラーが発生しました

私はここに来たばかりで、Markwodn ドキュメントについて助けが必要です。厄介な問題に遭遇しました。PDF を knit しようとすると、次のエラーが発生します。
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)

問題は、TOCを挿入しようとすると発生します

\newpage
\tableofcontents
\newpage

エラーを特定したところ、\tableofcontents コマンドを使用しているときにのみ発生することがわかりました。驚いたことに、\listoffigures または \listoftables を使用しているときは問題なく動作します。このエラーを修正する方法について、何かアドバイスがあればいただければ幸いです。

私のシステムは Win 10、64x です - これが関係するかもしれません。

答え1

問題の解決策を見つけました。インストールとはまったく関係ありませんでした。別の RMarkdown ドキュメントにあるものをすべてコピーしたら、うまくいきました。理由はわかりませんが、今は大丈夫です。

関連情報