Search code examples
latexbeamer

logo to the top right corner latex Beamer


I want to add a logo to each frame of my latex beamer. The space I want to put it in is the right-corner. This is at the right of the rectangle where the current section is displayed.

Please find below the code :

\documentclass{beamer}
\usepackage[utf8]{inputenc}
\usepackage{caption}
\usepackage{subcaption}
\usepackage{mathrsfs}
\usepackage{graphics}
\usepackage{tikz}
\usepackage{beamerthemeWarsaw} 
\usepackage[export]{adjustbox}

\title{Modélisation des courants de turbidité}
\date{}
\addtobeamertemplate{miniframe}{}{ %footline headline frametitle
\includegraphics[height=1cm]{Pics/organism/ifremer_logo.jpg} \hspace{0.5cm}
\includegraphics[height=1cm]{Pics/organism/polytech_logo.png}
}

\begin{document}

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

\begin{frame}{Contexte du stage}    
\end{frame}

\begin{frame}{Intérêts}
\end{frame}

\begin{frame}{Objectifs}
    \begin{block}{Améliorations du modèle }
    \end{block}
    
\end{frame}
    
\begin{frame}
    \tableofcontents
\end{frame}

\section{Equations du modèle}
\begin{frame}{Equations du modèle}
\end{frame}
\end{document}

Solution

  • Given that you have enough sections to make the headline tall enough to host your images, you could redefine the headline and replace the right hand site, which would normally show the subsections, with your images:

    \documentclass{beamer}
    %\usepackage[utf8]{inputenc}
    \usepackage{caption}
    \usepackage{subcaption}
    \usepackage{mathrsfs}
    %\usepackage{graphics}
    \usepackage{tikz}
    \usetheme{Warsaw} 
    \usepackage[export]{adjustbox}
    
    \title{Modélisation des courants de turbidité}
    \date{}
    
    \makeatletter
    \setbeamertemplate{headline}
    {%
      \leavevmode%
      \@tempdimb=2.4375ex%
      \ifnum\beamer@subsectionmax<\beamer@sectionmax%
        \multiply\@tempdimb by\beamer@sectionmax%
      \else%
        \multiply\@tempdimb by\beamer@subsectionmax%
      \fi%
      \ifdim\@tempdimb>0pt%
        \advance\@tempdimb by 1.825ex%
        \begin{beamercolorbox}[wd=.5\paperwidth,ht=\@tempdimb]{section in head/foot}%
          \vbox to\@tempdimb{\vfil\insertsectionnavigation{.5\paperwidth}\vfil}%
        \end{beamercolorbox}%
    %    \begin{beamercolorbox}[wd=.4\paperwidth,ht=\@tempdimb]{subsection in head/foot}%
    %      \vbox to\@tempdimb{\vfil\insertsubsectionnavigation{.4\paperwidth}\vfil}%
    %    \end{beamercolorbox}%
        \begin{beamercolorbox}[wd=.5\paperwidth,ht=\@tempdimb]{subsection in head/foot}%
          \hfill
          \includegraphics[height=\@tempdimb]{example-image-duck} \hspace{0.5cm}
          \includegraphics[height=\@tempdimb]{example-image-duck}
          \hfill\mbox{}
        \end{beamercolorbox}%    
      \fi%
    }
    \makeatother
    
    
    %\addtobeamertemplate{miniframe}{}{ %footline headline frametitle
    %\includegraphics[height=1cm]{Pics/organism/ifremer_logo.jpg} \hspace{0.5cm}
    %\includegraphics[height=1cm]{Pics/organism/polytech_logo.png}
    %}
    
    \begin{document}
    
    \begin{frame}
        \maketitle
    \end{frame}
    
    \begin{frame}{Contexte du stage}    
    \end{frame}
    
    \begin{frame}{Intérêts}
    \end{frame}
    
    \begin{frame}{Objectifs}
        \begin{block}{Améliorations du modèle }
        \end{block}
        
    \end{frame}
        
    \begin{frame}
        \tableofcontents
    \end{frame}
    
    \section{Equations du modèle}
    \begin{frame}{Equations du modèle}
    \end{frame}
    \section{Equations du modèle}
    \begin{frame}{Equations du modèle}
    \end{frame}
    \section{Equations du modèle}
    \begin{frame}{Equations du modèle}
    \end{frame}
    \section{Equations du modèle}
    \begin{frame}{Equations du modèle}
    \end{frame}
    \end{document}
    

    enter image description here

    Some other comments:

    • if your tex distribution isn't completely outdated, you don't need \usepackage[utf8]{inputenc}, that's now default

    • no need for \usepackage{graphics}, beamer automatically loads the more powerful graphicx package

    • the more beamer way to load a theme is \usetheme{Warsaw}