I am aware that there are already an infinite number of entries here about the YAML header in rmarkdown. However, I have not yet been able to find an answer to the following question:
I need:
- a PDF
- a title page
- the table of contents starting on the second page
- a page numbering starting at the table of contents
- numbered sections
- no automatic chapter numbering
I would like to do this without LateX code, bookdown
or the import of any text files.
Except for the last point, this seems to work with documentclass: report
. Unfortunately I can't get rid of the chapters. Is there no pure rmarkdown YAML header solution for this?
---
title: The Force
subtitle: May it be with you
author: "Obi-Wan Kenobi"
date: "`r Sys.Date()`"
output:
pdf_document:
toc: yes
toc_depth: 3
number_sections: true
documentclass: report
---
# Introduction
## Sub
### SubSub
# Methods
## Sub
### SubSub
CodePudding user response:
CodePudding user response:
If your only reason to use the report
class is the page break before the table of contents, you could easily add it to the default class article
:
---
title: The Force
subtitle: May it be with you
author: "Obi-Wan Kenobi"
date: "`r Sys.Date()`"
output:
pdf_document:
keep_tex: true
toc: yes
toc_depth: 3
number_sections: true
header-includes:
- \pretocmd{\tableofcontents}{\clearpage}{}{}
- \apptocmd{\tableofcontents}{\clearpage}{}{}
---
# Introduction
## Sub
### SubSub
# Methods
## Sub
### SubSub