106

Question 1: I am creating a slide template for a presentation in LaTex using Beamer package. I found the placement of logo in the slide is not that easy. Instead of placing the logo in the same position throughout the slides, I want to place the logo in the middle or a bit up from the middle in the title slide. Is it possible?

Question 2: In the slides after the titleslide I want to have the logo in the top right corner. So, I put this command,

\logo{\includegraphics[height=0.8cm]{logo.eps}\vspace{220pt}}

It went well:

Logo visible

However, if I change the color of the top bar then the logo goes behind the bar and it's no longer visible:

Logo not visible anymore

Is there any way by which I can put the logo on the top?

Werner
  • 603,163
hmhsl
  • 1,163

2 Answers2

153

Question 1: You can use any of the fields given by \author, \title, \date, or \institute to place the image in the title page; if none of those fields allow you to achieve the desired placement, you can use the textpos package. The example below uses the \author field to add the image.

Question 2: With the help of the textpos package you can add the logo to the frametitle template using \addtobeamertemplate.

A simple example code:

\documentclass{beamer}
\usetheme{Madrid}
\usecolortheme{beaver}
\usepackage{textpos}

\title{The title}
\author[The author]{\includegraphics[height=1cm,width=2cm]{cat}\\The Author}
\institute[Inst.]{The Institute}
\date{\today}

\begin{document}

\begin{frame}
\maketitle
\end{frame}

\addtobeamertemplate{frametitle}{}{%
\begin{textblock*}{100mm}(.85\textwidth,-1cm)
\includegraphics[height=1cm,width=2cm]{cat}
\end{textblock*}}

\begin{frame}{Motivation}
Now the logo is visible
\end{frame}

\end{document}

enter image description here

enter image description here

As osjerick mentions in a comment, the above solution won't behave correctly if \framesubtitle is used (the image will shift downwards); in this case, a TikZ approach can be used to prevent the movement:

\documentclass{beamer}
\usetheme{Madrid}
\usecolortheme{beaver}
\usepackage{tikz}

\title{The title}
\author[The author]{\includegraphics[height=1cm,width=2cm]{cat}\\The Author}
\institute[Inst.]{The Institute}
\date{\today}

\begin{document}

\begin{frame}
\maketitle
\end{frame}

\addtobeamertemplate{frametitle}{}{%
\begin{tikzpicture}[remember picture,overlay]
\node[anchor=north east,yshift=2pt] at (current page.north east) {\includegraphics[height=0.8cm]{cat}};
\end{tikzpicture}}

\begin{frame}{Motivation}
Now the logo is visible
\end{frame}

\begin{frame}{Motivation}
\framesubtitle{A}
Now the logo is visible
\end{frame}

\end{document}
Gonzalo Medina
  • 505,128
  • 5
    Works like a charm! Thanks a lot. EDIT: Someone please upvote Gonzalo Medina for this reply. I can't give that because I am 4 repu short of doing that. – hmhsl Sep 09 '11 at 06:27
  • +1 for your example with addtobeamertemplate. Now I've understood it. – Ignasi Sep 09 '11 at 07:20
  • But that doesn't work well when you add the \framesubtitle. – osjerick Oct 23 '12 at 00:12
  • @osjerick can you please provide an example? Saying simply "doesn't work well" doesn't provide much information. – Gonzalo Medina Oct 23 '12 at 00:19
  • @GonzaloMedina Sure!, when you add the \framesubtitle{Some title} figure position is not the same, it moves down slightly. How I can set the figure fixed at top right? – osjerick Oct 23 '12 at 05:43
  • 1
    @osjerick please see my updated answer; the last example code in my answer (using TikZ) gives the desired result. – Gonzalo Medina Oct 24 '12 at 02:22
  • @GonzaloMedina Thanks a lot!. It works perfectly, curiously with this solution two times compilation is needed, do you know why? It's not a problem, just I'm curious. – osjerick Oct 24 '12 at 03:08
  • 1
    @osjerick You're welcome; two runs are necessary, indeed. The first one is to calculate coordinates and the second one, to place the object. – Gonzalo Medina Oct 24 '12 at 03:11
  • How to freely pose a picture on the title page, for example, on top of title-box? – Rasoul Oct 27 '13 at 12:25
  • This does not work for titlepage and TOCs, where the image is simply missing. It only works for "content-slides". So this is rather inconsistent. – hasufell Nov 16 '16 at 13:45
  • 2
    Does anyone know where to find documentation on modifying the behavior of the actual \logo command? Searches just return a bunch of these hacks using other fields. – EL_DON Mar 04 '17 at 21:47
  • Thank you very much! Was searching quite some time for this answer! – Chan Kha Vu May 21 '19 at 09:27
  • This is an old question, but I've come across a problem: Having the tikz picture in the top right shifts the contents of the slide downwards. It does this in such a way that there is always an approximately 0.7 cm gap between the highest content and the title bar, just enough space for a line or two of text, or an image of that size. Its probably a result of updates since the answer, and it can be inelegantly fized with vspace, but does anyone know the root of the problem? – Will Apr 24 '21 at 21:11
1

Regarding question 1, I'd like to add to Gonzalo Medina's answer that you can use the \titlegraphic command directly and adjust the position using the \tikzpicture environment (from here). This way, you can use the other fields (authors etc.) as they are intended.

% put logo on titlepage
\titlegraphic{
\begin{tikzpicture}[overlay,remember picture]
\node[above=0.3cm] (firstlogo) at (current page.south){\includegraphics[width=2cm]{figures/our-logo}};
%% place more logos relative to first logo
%\node[left=2cm] at (firstlogo) {\includegraphics[width=2cm]{figures/second-logo}};
%\node[right=2cm] at (firstlogo) {\includegraphics[width=2cm]{figures/third-logo}};
\end{tikzpicture}
}
Isi
  • 197