I am using R and rmarkdown to print formal letters.
I would like to format the sender and receiver addresses as in the image below
However in rmarkdown I have only managed to do the following
---
title: "Untitled"
output: pdf_document
---
```{r setup, include=FALSE}
knitr::opts_chunk$set(echo = TRUE)
```
\
This is where the reciepient goes \hfill This is where the sender goes \
Address 1 \hfill Person \
Address 2 \hfill Department \
Address 3 \hfill Address 1 \
Address 3 \hfill Address 2 \
\
\raggedleft Address 3 \
Address 4 \
Address 5 \
Address 6 \
Telephone \
Fax \
Email \
Which leads to
However this is not why I need. I would like both boxes to have left alignment. Clearly /hfill is not the right use. How can I achieve defining these 2 boxes, their position, the text inside them and the alignment of the text?
I am knitting to PDF.
CodePudding user response:
Try this solution:
---
title: "Untitled"
output: pdf_document
---
```{r setup, include=FALSE}
knitr::opts_chunk$set(echo = TRUE)
```
\begin{tabular}[t]{@{}l}
This is where the reciepient goes \\
Address 1 \\
Address 2 \\
Address 3 \\
Address 3 \\
\end{tabular}
\hfill
\begin{tabular}[t]{@{}l}
This is where the sender goes \\
Person \\
Department \\
Address 1 \\
Address 2 \\
Address 3 \\
Address 4 \\
Address 5 \\
Address 6 \\
Telephone \\
Fax \\
Email \\
\end{tabular}



