1

I am trying to add a logo and have a vertical gradient in each frame title on my presentation. In the end, I would like to have this type of frame:

enter image description here

I have tried this code: \begin{frame} \frametitle{Title \hspace{12.2cm} \raisebox{\dimexpr \baselineskip - \totalheight}{\includegraphics[width=2cm]{example-image.png}}} \end{frame} but it's not the way I want it...

Thanks for your help !

1 Answer 1

0

There are a couple of themes which do have a gradient in the frametitle, e.g. the Warsaw theme:

\documentclass{beamer}

\usetheme{Warsaw}
\usecolortheme{beaver}

\setbeamercolor{frametitle}{bg=lightgray}
\setbeamercolor{frametitle right}{bg=white}


\makeatletter

\setbeamertemplate{frametitle}{%
  \nointerlineskip%
  \vskip-2pt%
  \hbox{\leavevmode
    \advance\beamer@leftmargin by -12bp%
    \advance\beamer@rightmargin by -12bp%
    \beamer@tempdim=\textwidth%
    \advance\beamer@tempdim by \beamer@leftmargin%
    \advance\beamer@tempdim by \beamer@rightmargin%
    \hskip-\Gm@lmargin\hbox{%
      \setbox\beamer@tempbox=\hbox{\begin{minipage}[b]{.8\paperwidth}%
          \vbox{}\vskip-.75ex%
          \leftskip0.3cm%
          \rightskip0.3cm plus1fil\leavevmode
          \usebeamercolor[fg]{frametitle}\usebeamerfont{frametitle}\strut\insertframetitle\strut\par%
          \ifx\insertframesubtitle\@empty\else%
            {\usebeamerfont*{framesubtitle}{\usebeamercolor[fg]{framesubtitle}\insertframesubtitle}\strut\par}%
          \fi%
          \nointerlineskip
          \vbox{}%
          \end{minipage}\begin{minipage}[b][.7cm][t]{.2\paperwidth}
          \hfill\includegraphics[height=0.7cm]{example-image-duck}\quad\mbox{}
          \end{minipage}}%
      \beamer@tempdim=\ht\beamer@tempbox%
      \advance\beamer@tempdim by 2pt%
      \begin{pgfpicture}{0pt}{0pt}{\paperwidth}{\beamer@tempdim}
        \begin{pgfscope}
          \pgfsetfillcolor{beamer@safeblack}%
          \pgfpathrectangle{\pgfpoint{0pt}{-4pt}}{\pgfpoint{\paperwidth}{8pt}}%
          \pgfsetfading{beamer@topshadowmask}{}%
          \pgfusepath{fill}%
        \end{pgfscope}
        \begin{pgfscope}
          \usebeamercolor{frametitle right}%
          \pgfpathrectangle{\pgfpointorigin}{\pgfpoint{\paperwidth}{\beamer@tempdim}}%
          \pgfusepath{clip}%
          \pgftext[left,base]{\pgfuseshading{beamer@frametitleshade}}%
        \end{pgfscope}
      \end{pgfpicture}
      \hskip-\paperwidth%
      \box\beamer@tempbox%
    }%
    \hskip-\Gm@rmargin%
  }%
  \vskip-2pt
}
\makeatother

\begin{document}

\begin{frame}
\frametitle{title}
eee
\end{frame}
    
\end{document}

enter image description here

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .