J. Doe
J. Doe

Reputation: 1730

Logo in R Markdown PDF output, only on the first page

Previously I've asked a very similar question to the question I am currently trying to ask. Actually, this question can be thought of as an extension of my previous question.

I am looking for a way to include my company's logo on the first page of a PDF R Markdown output. As stated in the previous question, I've looked for answers online, but most of the solutions resulted in either the logo being on all the pages (not just the first) or in some redundant elements (chapter titles, horizontal lines below them etc.) being added to every page. This has led me to ask the previous question - how to include the logo only at the first page, with no additional elements besides the logo.

I got my answer, which satisfied the criteria that I had posted (for details of the answer, please see the previous post). However, the problem is that if my Markdown doc contains the title, author or some other fields, the logo appears below them, whereas I want it to appear above those fields in the header.

To summarize, my question is: How to print a logo in the Markdown PDF document which satisfies the following criteria:

Many thanks!

Upvotes: 0

Views: 1054

Answers (1)

Gainz
Gainz

Reputation: 1771

I was the one that originally answered your first question.

\begin{center}
\includegraphics[width=7cm]{logo.jpg} 
\end{center}

I currently use the code like this after the R Setup and the logo is centered over the title. Unless you mean you want your logo at the extreme top of the page it should work.

You could also use something along those lines if you want to add the title, author and more under the logo :

\title{%
\includegraphics[width=0.1\textwidth]{files/image.jpg}~ 
\\[1cm]
Title
\\more text 
}
\author{Some.Name
\\ where}
\date{August 27, 2019}
\maketitle

EDIT : If you want to have your table of contents under all of this simply add the following code under the previous code :

\pagebreak

\tableofcontents

\pagebreak

\pagebreak will skip a page (the one with the title, logo, author...).

\tableofcontents create/put your table of contents here (you can skip another page after).

Upvotes: 2

Related Questions