I am creating a book in PDF with bookdown
, and I would like to change the number of the toc_depth
field when converting the book to PDF. This is my _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>
toc_depth: 5
download: ["pdf", "epub"]
bookdown::pdf_book:
includes:
in_header: preamble.tex
latex_engine: xelatex
citation_package: natbib
keep_tex: yes
bookdown::epub_book: default
I added toc_depth: 5
with no results. How can I do it?
In your example you have toc_depth
within the bookdown::gitbook
block, which is responsible for HTML output. If you want this for PDF output, as your title suggests, you need to add it there, i.e.
...
bookdown::pdf_book:
includes:
in_header: preamble.tex
latex_engine: xelatex
citation_package: natbib
keep_tex: yes
toc_depth: 5
...
Se also: https://bookdown.org/yihui/rmarkdown/pdf-document.html