rshinyr-markdown

How to insert a logo on left and right side of pdf title


I can insert the Rlogo.png on both sides of the page using ![](RLogo2.png) \hspace{3 in} ![](RLogo2.png) 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

![](RLogo2.png) \hspace{3 in} ![](RLogo2.png)


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:

enter image description here


Solution

  • You can use \makeatletter and redefinde 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.

    out

    ---
    title: "Shiny Installation here"
    output:
      pdf_document:
        toc: yes
    header-includes: |
        \usepackage{graphicx}
        \usepackage{geometry}
        \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
    ---