I can insert the Rlogo.png on both sides of the page using  \hspace{3 in} 
However, I can't find the way to insert the Rlogo.png right next to the pdf title. I would like the logo to be on both left and right sides of the title on the first page. Can someone help with this please. Code below:
---
title: "Shiny Installation here"
output:
pdf_document:
toc: yes
---
```{r setup, include=FALSE}
knitr::opts_chunk$set(echo = TRUE)
```
## Software
 \hspace{3 in} 
Mr. Tony Moore
West Coast Products
5555 Club Drive
Houston, Texas
Subject: Business meeting.
Dear Mr. Moore:
This letter is in response to our meeting on July 31, 2015
## Download R packages
To download packages using R, type the following command:
## Run the shiny application
To run the application..........
See screenshot below:
Edit: I came up with a solution that handles all 3 file formats
If output is pdf
a header.tex
file is written and referenced. It uses \makeatletter
and redefines the title with \def\@maketitle
to include the RLogo2.png
to the left and to the right. This assumes, that the file RLogo2.png
lies in the same directory as your r-markdown file.
If output is html
a myheader.html
file is written (Source) and referenced. It uses straight HTML to place the two images left and right from the title_ideal_text
.
If output is docx
a custom-template.docx
as per this which has the images inside the header. I know this will then go over all pages but I could not find a better solution for this.
.docx
file template called custom-template.docx
inside the markdown folder and paste the images inside the header like shown - then save it
---
output:
html_document:
toc: yes
includes:
in_header: myheader.html
pdf_document:
toc: yes
includes:
in_header: header.tex
word_document:
toc: yes
reference_docx: custom-template.docx
---
```{r, echo=FALSE, results='asis'}
library(htmltools)
knitr::opts_chunk$set(echo = FALSE)
output_format <- knitr::opts_knit$get("rmarkdown.pandoc.to")
title_ideal_text <- "Shiny Installation here"
tit <- ""
if (output_format == "html") {
fileConn <- file("myheader.html")
writeLines(paste0('
<div style="display: flex; align-items: center; justify-content: center; gap: 20px;">
<img src="RLogo2.png" style="height:50px;">
<h1>',title_ideal_text,'</h1>
<img src="RLogo2.png" style="height:50px;">
</div>
'), fileConn)
close(fileConn)
} else if (output_format == "docx") {
#cat('| {width=80px} | **Shiny Installation here** | {width=80px} |\n|:---:|:---:|:---:|\n\n')
tit <- title_ideal_text
} else {
tit <- title_ideal_text
fileConn <- file("header.tex")
writeLines('
\\makeatletter
\\def\\@maketitle{%
\\begin{center}%
\\includegraphics[height=2cm]{RLogo2.png}
\\hspace{2.5cm} % adjust spacing between left logo and title
{\\LARGE \\@title}
\\hspace{2.5cm} % adjust spacing between title and right logo
\\includegraphics[height=2cm]{RLogo2.png}
\\end{center}%
\\par}%
\\makeatother%
', fileConn)
close(fileConn)
}
```
---
title: "`r tit`"
---
## Software
Mr. Tony Moore
West Coast Products
5555 Club Drive
Houston, Texas
Subject: Business meeting.
Dear Mr. Moore:
This letter is in response to our meeting on July 31, 2015
## Download R packages
To download packages using R, type the following command:
## Run the shiny application
To run the application..........