Changing *Chapter X* name in bookdown PDF

大兔子大兔子 提交于 2019-12-02 07:15:24

From the bookdown documentation we can learn two things:

  • There is no language.label.chapter_name but language.ui.chapter_name.
  • This setting is meant for HTML output. For PDF output one should configure LaTeX.

Configuring LaTeX is quite simple. You only need to add lang: es to your header. However, this will use "Capítulo" instead of "Módulo". One can adjust this by redefining the LaTeX command \chaptername. BTW, at the moment you are not using bookdown but the standard pdf_docuemnt from rmarkdown. If you wont to use bookdown features, you should use bookdown::pdf_book or bookdown::pdf_document2.

Putting everything together:

--- 
title: "TITLE"
author: "Mario Modesto-Mata"
date: "`r Sys.Date()`"
output: bookdown::pdf_book
description: This is a minimal example of using the bookdown package to write a book.
  The output format for this example is bookdown::gitbook.
documentclass: book
lang: es
link-citations: yes
bibliography: book.bib
site: bookdown::bookdown_site
header-includes:
  - \AtBeginDocument{\renewcommand{\chaptername}{Módulo}}
---

Result:

Note that header-includes is nice for simple stuff in single file documents like this minimal example. In most cases one is better off including a tex into the header via output.<your-format>.includes.in_header, c.f. Include TeX header in R package for RMarkdown documents.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!