bookdown:是否可以更改报告的“章节名称”?

时间:2019-06-03 15:21:10

标签: r r-markdown bookdown

是否可以在报告输出documentclass: report中将章节标签从更改为主题?上述更改未产生预期的输出。

enter image description here

这是索引文件和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'

1 个答案:

答案 0 :(得分:1)

preamble.tex中进行了以下更改后,章节标签从更改为主题

旧文件:

\usepackage{booktabs}

新文件:

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

解决方案由: Ralf Stubner 提供。谢谢拉尔夫!