Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Indent without adding a bullet point or number in RMarkdown output to PDF

A question was previously asked on how to indent text without a bullet point in RMarkdown, but this was for HTML output: Indent without adding a bullet point or number in RMarkdown

How would a similar thing be done for a PDF output?

like image 433
Michael Power Avatar asked Mar 08 '23 16:03

Michael Power


1 Answers

Update::

Line Blocks can be used to force R Markdown to respect indents. This works for multiple-output formats.

---
output: 
    pdf_document
---

This is normal text.

|        Item 1
|        Item 2
|        Item 3

More Text

Original Answer:

If we are writing to a PDF file, LaTeX code can be used within the .Rmd file to expand the functionality of markdown. Pandoc will respect both the LaTeX and RMarkdown formatting when converting the file to the LaTeX file.

Here are some examples of how you could do it without having to install additional LaTeX packages:

---
title: "Untitled"
output: 
    pdf_document
---

This is normal text. If we want to indent a paragraph we could change the size of the left margin:

\setlength{\leftskip}{2cm}

Items 1

Item 2

Item 3

\setlength{\leftskip}{0pt}

Or we can make a list and suppress the items. 

\begin{itemize}
  \item[] First.
  \item[] Second.
\end{itemize}

enter image description here

like image 94
Michael Harper Avatar answered Mar 10 '23 13:03

Michael Harper