【问题标题】:R bookdown: How to change the title of the table of content for rendering a PDF bookR bookdown:如何更改用于呈现 PDF 书籍的目录标题
【发布时间】:2020-01-23 14:18:29
【问题描述】:

我正在使用 bookdown 使用来自 koma 脚本的文档类“scrreprt”来呈现 PDF 书籍。到目前为止,这有效,但是这本书是德文的 并且目录的标题是“Contents”而不是德语“Inhaltsverzeichnis”。

我的 index.rmd 的“标题”:

---
title: "Mein Buchtitel"
author: "Jens Laufer"
date: "`r Sys.Date()`"
documentclass: scrreprt
---

目录的输出如下所示:

我还尝试在 index.Rmd 中添加 preamble.tex:

---
title: "Mein Buchtitel"
author: "Jens Laufer"
date: "`r Sys.Date()`"
documentclass: scrreprt
output:
  bookdown::pdf_book:
    includes:
      in_header: preamble.tex
---

preamble.tex

\renewcommand{\contentsname}{Inhaltsverzeichnis}

然而这并没有帮助。

有什么想法吗?谢谢!

【问题讨论】:

    标签: r r-markdown pandoc bookdown


    【解决方案1】:

    您可以在 YAML 元数据中设置变量toc-title,例如,

    toc-title: "Table of Contents"
    

    有关更多信息,请参阅 Pandoc 手册:https://pandoc.org/MANUAL.html

    【讨论】:

    • 非常感谢@Yihui Xie。推荐的方法是什么?是用 preamble.tex 还是 toc-title 做的?
    • toc-title 更便携,因为它适用于多种输出格式,但您可能只想要 LaTeX/PDF 输出,在这种情况下 preamble.tex 也可以。
    【解决方案2】:

    我可以通过将 preamble.tex 更改为此来解决问题:

    \usepackage[ngerman]{babel}
    \selectlanguage{ngerman}
    

    【讨论】:

      猜你喜欢
      • 2023-01-05
      • 2015-05-18
      • 1970-01-01
      • 2017-03-06
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多