How to I vertically center the title of my rmarkdown pdf document? - r-markdown

I have the following preamble:
---
title: "Luke Klein Dissertation MARKDOWN ROUGH DRAFT"
author: "Luke KLEIN"
date: "`r Sys.Date()`"
output:
pdf_document:
toc: true
---
How do I get my title centered on the cover page?

You probably already finished your dissertation :-) but leaving the solution for future reference as i came here through google.
---
title: |
| \vspace{5cm} \LARGE{Luke Klein Dissertation MARKDOWN ROUGH DRAFT}
author: "Luke KLEIN"
date: "`r Sys.Date()`"
output:
pdf_document:
toc: true
---
Using a combination of vspace and hspace you can put the title anywhere you want.
Other combinations of fonts (both size and type) can be seen here:
https://www.sharelatex.com/learn/Font_sizes,_families,_and_styles?nocdn=true

Late to the party, this worked for me :
---
title: "Luke Klein Dissertation MARKDOWN ROUGH DRAFT"
author: "Luke KLEIN"
date: "`r Sys.Date()`"
output:
pdf_document:
toc: true
header-includes:
- \pretitle{\begin{center} \vspace{5cm}}
---

Related

Journal Name not italicized in rmarkdown pdf

I have recently updated my RStudio. The new RStudio version is 2022.12.0.
Then I have knitted an old manuscript of mine in pdf, but now in bibliography, the journal name is not italicized. Here are my YAML (a little edited for privacy). Before the update, there was no such issue.
I use Zotero to create my bib file. Also if I export reference from zotero to word file, then there is no issue as well regarding Journal name italics.
---
title: |
| \vspace{2cm} THE MANUSCRIPT TITLE
subtitle:
author:
date:
abstract: |
\justify ABABBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBB
BBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBB
|
`r kableExtra::text_spec ("Keywords:", bold = TRUE)` A; B; C.
|
`r kableExtra::text_spec ("JEL Classifications:", bold = TRUE)` C, Y.
<p> </p>
<p> </p>
|
output:
bookdown::pdf_document2:
fig_caption: yes
keep_tex: yes
header-includes:
- \pagenumbering{gobble}
- \usepackage[document]{ragged2e}
- \usepackage{sectsty} \sectionfont{\centering \emph}
- \usepackage{lscape}
- \newcommand{\blandscape}{\begin{landscape}}
- \newcommand{\elandscape}{\end{landscape}}
- \usepackage{xcolor}
link-citations: yes
linkcolor: blue
geometry: "left=2.75cm,right=2.75cm,top=2.5cm,bottom=2.5cm"
fontsize: 12pt
citecolor: blue
urlcolor: blue
toc: false
bibliography: reference_case.bib
---

Some help to write a doctoral thesis with R Markdown

I'm trying to figure out how I could write my doctoral thesis using R Markdown. Usually, I write articles with Latex. But, I'd like to be able to compile my file both for Word and pdf. Could you please help me understand how I could achieve that? I need to number the \frontmatter in roman numbers and the \mainmatter in arabic numbers.
This is my MWE:
---
title: "A title"
documentclass: book
classoption:
- hidelinks
- twoside
- openright
papersize: a4paper
output:
pdf_document:
includes:
in_header: Mypreamble.tex
latex_engine: xelatex
citation_package: biblatex
toc: yes
toc_depth: 4
number_sections: yes
html_document:
toc: yes
toc_depth: '4'
df_print: paged
word_document:
toc: yes
toc_depth: 4
date: "8 juillet 2022"
bibliography: Lectures.bib
fontsize: 12pt
geometry: left=4cm,right=4cm,top=4cm,bottom=4cm
linestretch: 1.2
toc-title: Plan
links-as-notes: yes
link-citations: yes
header-includes:
- \usepackage{fontspec}
- \setmainfont[Mapping=tex-text]{Arial}
- \usepackage [french]{babel}
- \usepackage[backend=biber,style=apa]{biblatex}
---
Introduction
I did my PhD thesis entirely in R Markdown, outputting to Microsoft Word.
I have a Github repository here if it helps: https://github.com/dannyjnwong/PhD_Thesis
I have also previously blogged about the process here:
https://dannyjnwong.github.io/Writing-a-multi-chapter-document-with-R-Markdown/

How to reduce space between title and content in pdf_output of Rmarkdown

I am using Rmarkdown to output pdf file. Here is the code:
---
title: |
| This is title
|
| \vspace{-5truemm}Supplementary Material\vspace{-5truemm}
author: 'xxx^[Correspondence to: xxx. Email: xxx]'
geometry: margin=0.3in
fontfamily: mathpazo
fontsize: 11pt
documentclass: article
urlcolor: blue
output:
pdf_document:
toc: true
toc_depth: 4
number_sections: yes
subparagraph: yes
header-includes: |
\usepackage{titlesec}
\titlespacing{\title}{0pt}{\parskip}{-\parskip}
---
\vspace{-5truemm}
# Introduction
This is introduction...
# Installation
This is installation...
## test1
### subtest1
And I want to know how to reduce space between the title (Supplementary Material) and content (not the body because I set toc as true).
Many thanks advanced!
As described in TeXSO, you can use the following package:
\usepackage{tocloft}
\setlength{\cftbeforetoctitleskip}{-\baselineskip}
So, the complete example would be like this.
---
title: |
| This is title
|
| \vspace{-5truemm}Supplementary Material\vspace{-5truemm}
author: 'xxx^[Correspondence to: xxx. Email: xxx]'
geometry: margin=0.3in
fontfamily: mathpazo
fontsize: 11pt
documentclass: article
urlcolor: blue
output:
pdf_document:
toc: true
toc_depth: 4
number_sections: yes
subparagraph: yes
header-includes: |
\usepackage{titlesec}
\titlespacing{\title}{0pt}{\parskip}{-\parskip}
\usepackage{tocloft}
\setlength{\cftbeforetoctitleskip}{-\baselineskip}
---
<!--
The following \vspace{} changes the spacing
between the first section ("Introduction" here)
and the last line of the title ("Supplementary Material")
-->
\vspace{-5truemm}
# Introduction
This is introduction...
# Installation
This is installation...
## test1
### subtest1
Note that the \vspace{} before the # Introduction changes the spacing
between the first section (Introduction here)
and the last line of the title (Supplementary Material).
Thus, the \vspace{} has nothing to do with
the space between the title and TOC.

Missing tittle and author

I have a Rmd (see bellow) file and when I execute the file without toc and pandoc I am able to get the title and author, but with them I am not able to see them. How can I get my title and author name to appear with numbered sections and toc?
---
title: "Design"
author: "Jen"
output:
html_document:
toc: true
pandoc_args: [
"--number-sections"
]
---
# plots
You should give rmarkdown full control over the pandoc arguments:
---
title: "Design"
author: "Jen"
output:
html_document:
toc: true
number_sections: true
---
# plots
Source: https://bookdown.org/yihui/rmarkdown/html-document.html#section-numbering

R Markdown + bib file: unused argument error

My .rmd file fails to compile when including citations as a .bib file.
I attached the code and error message here and very appreciate if someone could help.
The indentation of the YAML options is important. You currently have bibliography within the output section, but it should be placed in as a top-level YAML.
title: "Title"
author: "Author"
output:
pdf_document:
keep_tex: true
bibliography: bib.bib
Edit: Make sure you have moved the bibliography out of the pdf_document options completely, as follows:
author: "Author"
output:
pdf_document:
keep_tex: true
fig_caption: yes
number_sections: yes
bibliography: bib.bib
---