metropolis_theme/source/beamerouterthememetropolis.dtx

237 lines
6.8 KiB
Plaintext
Raw Normal View History

2015-06-18 08:46:34 +02:00
% \iffalse meta-comment -------------------------------------------------------
% Copyright 2015 Matthias Vogelgesang and the LaTeX community. A full list of
% contributors can be found at
%
% https://github.com/matze/mtheme/graphs/contributors
%
% and the original template was based on the HSRM theme by Benjamin Weiss.
%
% This work is licensed under a Creative Commons Attribution-ShareAlike 4.0
% International License (https://creativecommons.org/licenses/by-sa/4.0/).
% ------------------------------------------------------------------------- \fi
% \iffalse
%<*package>
\NeedsTeXFormat{LaTeX2e}
2017-01-23 12:55:26 +01:00
\ProvidesPackage{beamerouterthememetropolis}[2017/01/23 Metropolis outer theme]
2015-06-18 08:46:34 +02:00
%</package>
% \fi
% \CheckSum{0}
% \StopEventually{}
% \iffalse
%<*package>
% ------------------------------------------------------------------------- \fi
2015-06-22 23:43:52 +02:00
%
% \subsection{\themename outer theme}
2015-06-18 09:22:03 +02:00
%
% A |beamer| outer theme dictates the style of the frame elements traditionally
% set outside the body of each slide: the head, footline, and frame title.
%
2016-02-07 07:26:41 +01:00
%
%
% \subsubsection{Package dependencies}
%
2015-06-22 23:43:52 +02:00
% \begin{macrocode}
\RequirePackage{etoolbox}
2015-06-22 23:43:52 +02:00
\RequirePackage{calc}
\RequirePackage{pgfopts}
% \end{macrocode}
%
2015-06-18 09:22:03 +02:00
%
%
% \subsubsection{Options}
2015-06-22 07:24:49 +02:00
%
2015-06-22 23:43:52 +02:00
% \begin{macro}{numbering}
2016-02-07 07:26:41 +01:00
% Adds slide numbers to the bottom right of each slide.
2015-06-22 07:24:49 +02:00
% \begin{macrocode}
2015-06-22 23:43:52 +02:00
\pgfkeys{
/metropolis/outer/numbering/.cd,
.is choice,
none/.code=\setbeamertemplate{frame numbering}[none],
counter/.code=\setbeamertemplate{frame numbering}[counter],
fraction/.code=\setbeamertemplate{frame numbering}[fraction],
}
2015-06-22 07:24:49 +02:00
% \end{macrocode}
2015-06-22 23:43:52 +02:00
% \end{macro}
%
% \begin{macro}{progressbar}
2016-02-07 07:26:41 +01:00
% Adds a progress bar to the top, bottom, or frametitle of each slide.
2015-06-22 23:43:52 +02:00
% \begin{macrocode}
\pgfkeys{
/metropolis/outer/progressbar/.cd,
.is choice,
2015-07-10 08:09:39 +02:00
none/.code={%
\setbeamertemplate{headline}[plain]
\setbeamertemplate{frametitle}[plain]
\setbeamertemplate{footline}[plain]
},
head/.code={\pgfkeys{/metropolis/outer/progressbar=none}
2015-12-03 20:53:25 +01:00
\addtobeamertemplate{headline}{}{%
\usebeamertemplate*{progress bar in head/foot}
}
2015-07-10 08:09:39 +02:00
},
frametitle/.code={\pgfkeys{/metropolis/outer/progressbar=none}
2015-12-03 20:53:25 +01:00
\addtobeamertemplate{frametitle}{}{%
\usebeamertemplate*{progress bar in head/foot}
}
2015-07-10 08:09:39 +02:00
},
foot/.code={\pgfkeys{/metropolis/outer/progressbar=none}
2015-12-03 20:53:25 +01:00
\addtobeamertemplate{footline}{}{%
\usebeamertemplate*{progress bar in head/foot}%
}
2015-07-10 08:09:39 +02:00
},
}
% \end{macrocode}
% \end{macro}
%
% \begin{macro}{\metropolis@outer@setdefaults}
2016-02-07 07:26:41 +01:00
% Sets default values for outer theme options.
2015-06-22 23:43:52 +02:00
% \begin{macrocode}
\newcommand{\metropolis@outer@setdefaults}{
2015-06-22 23:43:52 +02:00
\pgfkeys{/metropolis/outer/.cd,
numbering=counter,
progressbar=none,
}
}
% \end{macrocode}%
% \end{macro}
%
2015-06-22 07:24:49 +02:00
%
%
% \subsubsection{Head and footline}
2015-06-18 09:22:03 +02:00
%
% All good |beamer| presentations should already remove the navigation symbols,
% but \themename removes them automatically (just in case).
2015-06-18 09:22:03 +02:00
%
% \begin{macrocode}
\setbeamertemplate{navigation symbols}{}
% \end{macrocode}
%
2016-02-07 07:26:41 +01:00
% \begin{macro}{frame numbering}
% Templates for the frame number. Can be omitted, shown or displayed as a
% fraction of the total frames.
2015-06-22 23:43:52 +02:00
% \begin{macrocode}
\defbeamertemplate{frame footer}{none}{}
\defbeamertemplate{frame footer}{custom}[1]{ #1 }
% \end{macrocode}
%
% \begin{macrocode}
2015-07-10 08:09:39 +02:00
\defbeamertemplate{frame numbering}{none}{}
\defbeamertemplate{frame numbering}{counter}{\insertframenumber}
2015-06-22 23:43:52 +02:00
\defbeamertemplate{frame numbering}{fraction}{
\insertframenumber/\inserttotalframenumber
}
% \end{macrocode}
2016-02-07 07:26:41 +01:00
% \end{macro}
2015-06-22 23:43:52 +02:00
%
2016-02-07 07:26:41 +01:00
% \begin{macro}{headline}
% \begin{macro}{footline}
% Templates for the head- and footline at the top and bottom of each frame.
2015-06-18 09:22:03 +02:00
% \begin{macrocode}
2015-07-10 08:09:39 +02:00
\defbeamertemplate{headline}{plain}{}
\defbeamertemplate{footline}{plain}{%
\begin{beamercolorbox}[wd=\textwidth, sep=3ex]{footline}%
\usebeamerfont{page number in head/foot}%
\usebeamertemplate*{frame footer}
\hfill%
2015-07-10 08:09:39 +02:00
\usebeamertemplate*{frame numbering}
2015-06-18 09:22:03 +02:00
\end{beamercolorbox}%
}
% \end{macrocode}
2016-02-07 07:26:41 +01:00
% \end{macro}
% \end{macro}
2015-06-18 09:22:03 +02:00
%
%
%
% \subsubsection{Frametitle}
%
% \begin{macro}{frametitle}
2016-02-07 07:26:41 +01:00
% Templates for the frame title, which is optionally underlined with a
% progress bar.
% \begin{macrocode}
2016-02-26 19:31:25 +01:00
\newlength{\metropolis@frametitle@padding}
\setlength{\metropolis@frametitle@padding}{2.2ex}
2016-02-26 19:31:25 +01:00
\newcommand{\metropolis@frametitlestrut@start}{
\rule{0pt}{\metropolis@frametitle@padding +%
\totalheightof{%
2016-02-28 12:16:26 +01:00
\ifcsdef{metropolis@frametitleformat}{\metropolis@frametitleformat X}{X}%
2016-02-26 19:31:25 +01:00
}%
}%
}
\newcommand{\metropolis@frametitlestrut@end}{
\rule[-\metropolis@frametitle@padding]{0pt}{\metropolis@frametitle@padding}
2016-02-07 05:43:18 +01:00
}
\defbeamertemplate{frametitle}{plain}{%
2015-07-21 03:24:05 +02:00
\nointerlineskip%
\begin{beamercolorbox}[%
2015-07-21 03:24:05 +02:00
wd=\paperwidth,%
2016-02-26 19:31:25 +01:00
sep=0pt,%
leftskip=\metropolis@frametitle@padding,%
rightskip=\metropolis@frametitle@padding,%
2015-07-21 03:24:05 +02:00
]{frametitle}%
\metropolis@frametitlestrut@start%
\insertframetitle%
\nolinebreak%
\metropolis@frametitlestrut@end%
\end{beamercolorbox}%
}
\setbeamertemplate{frametitle continuation}{%
\usebeamerfont{frametitle}
\romannumeral \insertcontinuationcount
}
% \end{macrocode}
% \end{macro}
%
% \begin{macro}{progress bar in head/foot}
2016-02-07 07:26:41 +01:00
% Template for the progress bar optionally displayed below the frame title
% on each page. Much of this code is duplicated in the inner theme's
% template |progress bar in section page|.
% \begin{macrocode}
\newlength{\metropolis@progressinheadfoot}
\newlength{\metropolis@progressinheadfoot@linewidth}
\setlength{\metropolis@progressinheadfoot@linewidth}{0.4pt}
\setbeamertemplate{progress bar in head/foot}{
2015-06-22 23:43:52 +02:00
\nointerlineskip
\setlength{\metropolis@progressinheadfoot}{%
\paperwidth * \ratio{\insertframenumber pt}{\inserttotalframenumber pt}%
}%
2015-07-10 08:09:39 +02:00
\begin{beamercolorbox}[wd=\paperwidth]{progress bar in head/foot}
\begin{tikzpicture}
\fill[bg] (0,0) rectangle (\paperwidth, \metropolis@progressinheadfoot@linewidth);
\fill[fg] (0,0) rectangle (\metropolis@progressinheadfoot, \metropolis@progressinheadfoot@linewidth);
\end{tikzpicture}%
\end{beamercolorbox}
}
% \end{macrocode}
% \end{macro}
%
2016-02-07 07:26:41 +01:00
%
%
2016-02-23 07:48:01 +01:00
% \begin{macro}{appendix}
2016-02-23 21:46:56 +01:00
% Removes page numbering and per-slide progress bars when |\appendix| is
% called. This makes it easier to include additional ``backup slides'' at
% the end of the presentation, especially in conjunction with the package
% |appendixnumberbeamer|.
2016-02-23 07:48:01 +01:00
% \begin{macrocode}
\AtBeginDocument{%
\apptocmd{\appendix}{%
\pgfkeys{%
/metropolis/outer/.cd,
numbering=none,
progressbar=none}
}{}{}
}
% \end{macrocode}
% \end{macro}
2016-02-07 07:26:41 +01:00
% \subsubsection{Process package options}
%
2015-06-22 23:43:52 +02:00
% \begin{macrocode}
\metropolis@outer@setdefaults
2015-06-22 23:43:52 +02:00
\ProcessPgfPackageOptions{/metropolis/outer}
% \end{macrocode}
%
2015-06-18 08:46:34 +02:00
% \iffalse
%</package>
% \fi
% \Finale
\endinput