Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is it possible to define a letterhead header in Rmarkdown?

R gurus,

I am struggling to design a letterhead template in Rmarkdown for a massive mail merge project.

What I ideally need is something like following: enter image description here

Question is if the header can be defined in YAML? The code might look something like following:

---
output: 
  pdf_document:
    fig_caption: false

logo: logo.png
institute: UNIVERSITY OF CALIFORNIA
name: Prof. Jones
address: Mathematics Search Committee
         Department of Mathematics
         University of California
         Berkeley, California 12345
email: [email protected]

latex_engine: pdflatex
fontfamily: mathpazo
fontsize: 11pt
# spacing: double
endnote: no
---
like image 929
M.Qasim Avatar asked Feb 08 '18 22:02

M.Qasim


1 Answers

---
title: "Prof. Jones  \nDepartment  \nUniversity  \nState  \nEmail"
output: pdf_document
editor_options: 
  chunk_output_type: console
header-includes:
  - \usepackage{titling}
  - \usepackage{graphicx} 
  - \usepackage{fancyhdr}
  - \pagestyle{fancy}
  - \pretitle{\begin{flushright}\LARGE\includegraphics[width=8cm]{logo.jpg}\\[\bigskipamount]}
  - \posttitle{\end{flushright}}
---

enter image description here

Add your logo to where it has {logo.jpg} and the width might need altering as well.

Bit of a workaround using double space and \n to add a line break to the heading to create the address.

flushright right aligns the logo and title then.

like image 118
NColl Avatar answered Sep 28 '22 10:09

NColl