R – How to indent new paragraphs

latexrr-markdown

How can I change the rmarkdown settings in a way that a new paragraph starts with an indented first line (as the default in LateX) rather than with blank space and no indentation.

That is what I normally get:

---
output: pdf_document
---

## R Markdown

This is an R Markdown document. Markdown is a simple formatting syntax for authoring HTML, PDF, and MS Word documents. For more details on using R Markdown see <http://rmarkdown.rstudio.com>.

When you click the **Knit** button a document will be generated that includes both content as well as the output of any embedded R code chunks within the document. You can embed an R code chunk like this:**

enter image description here

That is what I want:

enter image description here

Best Answer

In the header of your Rmd document, you can add LaTeX includes. To indent the paragraph, just change parindent, e.g.

output: pdf_document
header-includes:
  - \setlength{\parindent}{4em}
  - \setlength{\parskip}{0em}

Alternatively, you could store the latex commands in a separate file:

includes:
   in_header: header.tex

See the advanced customization section.

Related Topic