Goal
I'm trying to create a beamer
theme where in the top we have the following layout:
________________________________________
| | |
| Author & Insitute | L O G O |
|_______________________|_ _____|
| \_______/ |
| Frame Title |
|_______________________________________|
| |
| C O N T E N T H E R E . . . |
ie. an overlapping logo.
Approaches
I have three approaches but I haven't gotten either to work:
- Put the Frame Title into the Head Line as well, then try to achieve the wanted layout using
beamercolorbox
-- but not only did I not achieve the layout, it seems that you cannot also put the Frame Title into the Head Line. - Have the Head Line only contain Authorship Info and Logo, but make the latter somehow "overlap" into the stuff below, without pushing the Frame Title down.
- Make the Head Line vertically bigger, containing also the overlapping area, this'd mean that also the background (if existing) of the Head Line needed to be colored in two colors, because it actually just took some part of the Frame Title area-wise.
The three approaches I've tried to illustrate here:
MWE / Code
What I've done code-wise so far is:
main.tex
:
\documentclass{beamer}
\usetheme{mytheme}
\title{The Title}
\author{S.~Author}
\institute{The Institute}
\usepackage{graphicx}
\pgfdeclareimage[height=0.5cm]{logo}{example-image}
\logo{\pgfuseimage{logo}}
\begin{document}
\begin{frame}[plain]
\titlepage
\end{frame}
\begin{frame}{Outline}
\tableofcontents
\end{frame}
\end{document}
and in my local TEXMF
: tex/latex/beamertheme-mytheme/
beamerthememytheme.sty
:
\mode<presentation>
\useinnertheme{mytheme}
\useoutertheme{mytheme}
\usecolortheme{mytheme}
\mode<all>
beamerouterthememytheme.sty
:
\mode<presentation>
% background: transparent
\setbeamercolor{background}{bg=}
% Grid overlay, to test alignment, 0.028 is given magic value
\setbeamertemplate{background}[grid][step=0.028\pagewidth]
\defbeamertemplate*{headline}{mytheme}
{%
% either make headline contain
% 1. both logo and frame title (not possible?)
% 2. only logo, and let it somehow "grow" or "overlap" into the frame title
% 3. only logo + some vertical space to make it seem like it's overlapping, but this would create more problems, probably.
}
\mode
<all>
Can you give me any pointers which of these might be the best approach (or if none, what would be better)? I tried searching and there might really well be a solution to this, but I think I lack the terminology for finding anything useful right now.
답변1
A bit hacky, but the basic idea is to have the logo and the coloured areas in the background. For the following example I used https://i.stack.imgur.com/XXQjl.png as image.
caveat: frames without frametitle will still have the Gray line
\documentclass{beamer}
\setbeamerfont{headline}{size=\normalfont}
\setbeamercolor{headline}{bg=white}
\setbeamertemplate{headline}{%
\begin{beamercolorbox}[sep=0.3cm,left,wd=.67\paperwidth]{headline}
\usebeamerfont{headline}%
\insertshortauthor~\&~\insertshortinstitute
\end{beamercolorbox}%
}
\setbeamercolor{frametitle}{bg=}
\setbeamercolor{framesubtitle}{bg=gray!55!white}
\makeatletter
\setbeamertemplate{frametitle}{%
\vspace*{-0.1cm}
\ifbeamercolorempty[bg]{frametitle}{}{\nointerlineskip}%
\@tempdima=\textwidth%
\advance\@tempdima by\beamer@leftmargin%
\advance\@tempdima by\beamer@rightmargin%
\begin{beamercolorbox}[sep=0.3cm,left,wd=\the\@tempdima]{frametitle}
\usebeamerfont{frametitle}%
\vbox{}\vskip-1ex%
\if@tempswa\else\csname beamer@fteleft\endcsname\fi%
\strut\insertframetitle\strut\par%
\end{beamercolorbox}
% {%
\ifx\insertframesubtitle\@empty%
\else%
\vskip-0.3cm%
\begin{beamercolorbox}[sep=0.1cm,left,wd=\the\@tempdima]{framesubtitle}
{\hspace{0.2cm}\usebeamerfont{framesubtitle}\usebeamercolor[fg]{framesubtitle}\insertframesubtitle\strut\par}%
\end{beamercolorbox}
\fi
% }%
\vskip-1ex%
\if@tempswa\else\vskip-.3cm\fi% set inside beamercolorbox... evil here...
% \end{beamercolorbox}%
}
\makeatother
\setbeamercolor{background}{bg=}
\setbeamertemplate{background}{\includegraphics[width=\paperwidth,height=.17\paperheight]{XXQjl}}
\logo{\includegraphics[width=.2\paperwidth]{example-image}}
\title{The Title}
\author{S.~Author}
\institute{The Institute}
\begin{document}
{
\setbeamertemplate{background}{}
\begin{frame}[plain]
\titlepage
\end{frame}
}
\begin{frame}{Outline}
\tableofcontents
\end{frame}
\begin{frame}
\frametitle{title}
\framesubtitle{subtitle}
\end{frame}
\end{document}