Prevent title page, preface etc from being listed in table of contents. Bookdown pdf output

20 Views Asked by At

I have asked this question in Tex stack, but it appears it may be a bookdown issue, rather than a Latex issue.

I am producing a pdf in rmarkdown using the bookdown package. I have a .Rmd file that contains a title page, some acknowledgements etc. I then place my table of contents after these pages, and before the main document. The toc is automatically including the preceding pages in the toc. How do I prevent this?

---
output: 
  bookdown::pdf_document2:
    toc: false
    latex_engine: xelatex
header-includes:
- \usepackage{lmodern}
- \pagenumbering{gobble}
---

Title page text

\newpage

\pagenumbering{roman}

## Declarations {-}

## Acknowledgements {-}

## Publications {-}

\newpage


``` {=latex}
\setcounter{tocdepth}{3}
\tableofcontents
\listoffigures
\listoftables
```
\newpage

\pagenumbering{arabic}


# General Introduction

enter image description here

I just want the toc to start with "General Introduction".

As suggested I have added \addtocontents{toc}{\setcounter{tocdepth}{0}} in appropriate place, but this does not work from rmarkdown with bookdown.

I am actually rendering the document from multiple .Rmd files, using bookdown::render_book(".", "bookdown::pdf_document2", config_file = "_bookdown.yml", preview = F, clean = T)

0

There are 0 best solutions below