0
votes

I am using RMarkdown to generate a PDF document. I am trying to find a solution whereby I can adjust the line spacing on my cover page (Table of Contents as well as the spacing between the Title, Name and Date), as I noticed that adding linestretch in my YAML only affects the rest of the document and not the cover page. I am also hoping for a solution to move the logo on the cover page below the date if possible as opposed to it appearing on top

My YAML is as follows

---
title: "A Template for a Dynamic Report you can use for work"
author: My Name
date: "`r format(Sys.time(), '%d %B, %Y')`"
Uni_Logo: Tex/logo.jpg
toc: TRUE             # Add a table of contents. Change this to false if you don't want one
numbersections: TRUE   # Should sections (and thus figures and tables) be numbered?
fontsize: 11pt         # Set fontsize
linestretch: 1.5      # Set distance between lines.
link-citations: TRUE   # This creates dynamic links to the papers in reference list.
header-includes:      
  - \usepackage {hyperref, xcolor, float}
- \usepackage{makeidx}
- \definecolor{winered}{rgb}{0.5,0,0}
- \hypersetup {colorlinks = true, linkcolor = winered, urlcolor = winered}
output:
  pdf_document:
  includes:
  in_header: "header.tex" 
---

and here is the header.tex file I'm using

\usepackage{fancyhdr}
\usepackage{titling}
\pagestyle{fancy}
\fancyhead{}
\fancyfoot{}
\setlength{\headheight}{50pt}
\rhead{\includegraphics[width = .2\textwidth]{logo.jpg}}
\fancyfoot[R]{\thepage}
\renewcommand{\footrulewidth}{1pt}

\pretitle{%
  \begin{center}
  \LARGE
  \includegraphics[width=10cm,height=15cm]{logo.jpg}\\[\bigskipamount]
}
\posttitle{\end{center}}


TIA! enter image description here

1

1 Answers

0
votes

You're using the titling package, which gives you a lot of flexibility. You can add a spacing command to your \posttitle{} command, and have \predate, \postdate, \preauthor, \postauthor commands to customize spacing there. You should read the docs at https://ctan.org/pkg/titling?lang=en for all the details.

For example, change your header.tex file as follows to move the logo and add really big spacing:

\usepackage{fancyhdr}
\usepackage{titling}
\pagestyle{fancy}
\fancyhead{}
\fancyfoot{}
\setlength{\headheight}{50pt}
\rhead{\includegraphics[width = .2\textwidth]{logo.jpg}}
\fancyfoot[R]{\thepage}
\renewcommand{\footrulewidth}{1pt}
\pretitle{\begin{center}\LARGE}
\posttitle{\par\end{center}\vskip 1in}
\preauthor{\begin{center}
\large \lineskip 0.5em%
\begin{tabular}[t]{c}}
\postauthor{\end{tabular}\par\end{center}\vskip 1in}
\predate{\begin{center}\large}
\postdate{\par\end{center}\vskip 1in LOGO HERE}

Use smaller amounts than 1in if you want more reasonable spacing.

For the TOC part of your question, see here: https://tex.stackexchange.com/q/56546