Prradep
Prradep

Reputation: 5716

bookdown: Is there an option to change chapter_name for report?

Is there an option to change the chapter label from Chapter to Topic in the report output documentclass: report? The above change did not result in the expected output.

enter image description here

Here are the index file and yml.

index.Rmd:

--- 
title: "Report"
author: "P"
date: "`r Sys.Date()`"
site: bookdown::bookdown_site
documentclass: report
bibliography: [book.bib, packages.bib]
biblio-style: apalike
link-citations: yes
description: "This is a minimal example of using the bookdown package to write a book. The output format for this example is bookdown::gitbook."
header-includes:
  - \AtBeginDocument{\renewcommand{\chaptername}{Topic}}
---

_output.yml:

bookdown::gitbook:
  css: style.css
  config:
    toc:
      before: |
        <li><a href="./">A Minimal Book Example</a></li>
      after: |
        <li><a href="https://github.com/rstudio/bookdown" target="blank">Published with bookdown</a></li>
    download: ["pdf", "epub"]
bookdown::pdf_book:
  includes:
    in_header: preamble.tex
  latex_engine: xelatex
  citation_package: natbib
  keep_tex: yes
bookdown::epub_book: default

_bookdown.yml:

book_filename: "Report"
delete_merged_file: true
language:
  ui:
    chapter_name: 'Topic'

Upvotes: 2

Views: 667

Answers (1)

Prradep
Prradep

Reputation: 5716

The chapter label from Chapter to Topic has been changed after making the following change in the preamble.tex.

Old file:

\usepackage{booktabs}

New file:

\usepackage{booktabs}
\AtBeginDocument{\renewcommand{\chaptername}{Topic}}

Solution is given by: Ralf Stubner. Thank you Ralf!

Upvotes: 2

Related Questions