Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to make part of rmarkdown document without section numbering?

I have an rmarkdown document (.Rmd) that I want to knit into a pdf document. number_sections has been put to 'yes' and toc to 'true'. How can I add appendix sections that appear in the table of contents but don't have a section number?

Here is an example .Rmd code. How can I let appendix A and appendix B be numberless sections and let them appear in the table of contents at the same time?

---
title: "Test"
author: "test test"
geometry: margin=1in
output:
  pdf_document:
    keep_tex: yes
    latex_engine: xelatex
    number_sections: yes
    toc: yes
    toc_depth: 3
header-includes:
- \usepackage[dutch]{babel}
- \usepackage{fancyhdr}
- \pagestyle{fancy}
- \fancyfoot[LE,RO]{this is a fancy foot}
- \usepackage{dcolumn}
- \usepackage{here}
- \usepackage{longtable}
- \usepackage{caption}
- \captionsetup{skip=2pt,labelsep=space,justification=justified,singlelinecheck=off}
subtitle: test test test
fontsize: 12pt
---
# start

# second

```{r results="asis",eval=TRUE,echo=FALSE,message=FALSE, error=FALSE, warning=FALSE, comment = NA,fig.height=4}
cat("and here some R")
```

# appendix A

# appandix B
like image 213
rdatasculptor Avatar asked Dec 20 '15 16:12

rdatasculptor


People also ask

How do I separate paragraphs in R markdown?

To break a line in R Markdown and have it appear in your output, use two trailing spaces and then hit return .

How do I add a section in R markdown?

2.4 Code Chunks. Code chunks are those parts of the RMarkdown document where it is possible to embed R code within your output. To insert these chunks within your RMarkdown file you can use the following shortcuts: the keyboard shortcut Ctrl + Alt + I (OS X: Cmd + Option + I)

How do I add blank space in RMarkdown?

To create vertical space (Markdown to PDF), I use   This command works like \vspace{12pt} for latex. Fantastic! This works beautifully.

What is a Knitr document?

knitr is an R package that integrates computing and reporting. By incorporating code into text documents, the analysis, results and discussion are all in one place.


1 Answers

Just add {-} after the section name. Thus, for your appendices, you should do something like:

# appendix A {-}

# appendix B {-}

For more details, see this section of the docs.


Result:

enter image description here

like image 158
A5C1D2H2I1M1N2O1R2T1 Avatar answered Oct 04 '22 15:10

A5C1D2H2I1M1N2O1R2T1