I'm sure this is already out there but I can't seem to find it. How can I change the font size and spacing for the title in an R markdown document compiled as a pdf?
Thanks!
To transform your markdown file into an HTML, PDF, or Word document, click the “Knit” icon that appears above your file in the scripts editor. A drop down menu will let you select the type of output that you want. When you click the button, rmarkdown will duplicate your text in the new file format.
There are two types of output formats in the rmarkdown package: documents, and presentations.
We can insert headings and subheadings in R Markdown using the pound sign # . There are six heading/subheading sizes in R Markdown. The number of pound signs before your line of text determines the heading size, 1 being the largest heading and 6 being the smallest.
**text** is used to make the title bold and <br> to break the line.
I'm not sure exactly how you want the document to look, but here are some ways to control spacing and fontsize with Latex
tags. In the rmd
document below:
\vspace{5cm}
adds space above the first line of the title. \vspace{0.5cm}
adds space between the two lines of the title.\LARGE
and \Large
give different font sizes on different lines of the title.|
at the beginning of each line of the title allows a multi-line title.\newpage
at the beginning of the main document will start the main document text on a new page after the title page.---
title: |
| \vspace{5cm} \LARGE My Title is really long and takes up several lines of text
| \vspace{0.5cm} \Large My Title is really long and takes up several lines of text
author: "eipi10"
date: "5/16/2017"
output: pdf_document
---
\newpage
Document text here.
For a smaller title section, the following may be helpful. It builds on eipi10's answer but with two modifications:
vspace{}
commands include negative values to shrink white spacebegin{}
and end{}
syntax because, with simpler code like \normalsize{}
, I found extraneous braces appeared around the title, name, etc.---
title: \vspace{-0.75cm} \begin{normalsize} My Title \end{normalsize} \vspace{-0.5cm}
author: \begin{normalsize} My Name \end{normalsize}
date: \begin{normalsize} 5/16/2017 \end{normalsize}
output: pdf_document
---
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With