First working pgfopts implementation

This commit is contained in:
Benjamin Weiss 2015-06-22 23:43:52 +02:00
parent f15d18ed05
commit 9b19181fc0
8 changed files with 319 additions and 159 deletions

View File

@ -27,28 +27,54 @@
% \iffalse % \iffalse
%<*package> %<*package>
% ------------------------------------------------------------------------- \fi % ------------------------------------------------------------------------- \fi
%
% \section{Implementation: \textsc{metropolis} color theme} % \section{Implementation: \textsc{metropolis} color theme}
% Options
%
%
% darkcolors
% %
% Load required packages.
% \begin{macrocode} % \begin{macrocode}
\newif\if@beamer@metropolis@darkcolors \RequirePackage{pgfopts}
\@beamer@metropolis@darkcolorsfalse
\DeclareOptionBeamer{darkcolors}{
\@beamer@metropolis@darkcolorstrue
}
% \end{macrocode} % \end{macrocode}
% %
% Unknown option error handling
% %
%
% \subsection{Options}
%
% \begin{macro}{block}
% This option controls whether the blocks are filled or transparent.
% \begin{macrocode} % \begin{macrocode}
\DeclareOptionBeamer*{% \pgfkeys{
\PackageWarning{beamercolorthememetropolis}{Unknown option `\CurrentOption'}% /metropolis/color/block/.cd,
.is choice,
transparent/.code=\@metropolis@block@transparent,
fill/.code=\@metropolis@block@fill,
} }
\ProcessOptionsBeamer
% \end{macrocode} % \end{macrocode}
% \end{macro}
%
% \begin{macro}{colors}
% Defines whether the background shall be dark and the foreground be light or
% vice versa
% \begin{macrocode}
\pgfkeys{
/metropolis/color/background/.cd,
.is choice,
dark/.code=\@metropolis@colors@dark,
light/.code=\@metropolis@colors@light,
}
% \end{macrocode}
% \end{macro}
%
% \begin{macro}{\@metropolis@color@setdefaults}
% Set default values for color theme options.
% \begin{macrocode}
\newcommand{\@metropolis@color@setdefaults}{
\pgfkeys{/metropolis/color/.cd,
background=light,
block=transparent,
}
}
% \end{macrocode}
% \end{macro}
% %
% %
% %
@ -69,17 +95,18 @@
% of |normal text|, |alerted text|, and |example text|. % of |normal text|, |alerted text|, and |example text|.
% %
% \begin{macrocode} % \begin{macrocode}
\if@beamer@metropolis@darkcolors \newcommand{\@metropolis@colors@dark}{
\setbeamercolor{normal text}{% \setbeamercolor{normal text}{%
fg=black!2, fg=black!2,
bg=mDarkTeal bg=mDarkTeal
} }
\else }
\newcommand{\@metropolis@colors@light}{
\setbeamercolor{normal text}{% \setbeamercolor{normal text}{%
fg=mDarkTeal, fg=mDarkTeal,
bg=black!2 bg=black!2
} }
\fi }
\setbeamercolor{alerted text}{% \setbeamercolor{alerted text}{%
fg=mLightBrown fg=mLightBrown
} }
@ -89,10 +116,6 @@
% \end{macrocode} % \end{macrocode}
% %
% %
% \begin{macrocode}
% \end{macrocode}
%
%
% %
% \subsection{Derived colors} % \subsection{Derived colors}
% %
@ -130,9 +153,9 @@
% %
% The \textsc{metropolis} inner or outer themes optionally display progress % The \textsc{metropolis} inner or outer themes optionally display progress
% bars in various locations. Their color is set by |progress bar| but the two % bars in various locations. Their color is set by |progress bar| but the two
% different kinds can be customized separately. The horizontal rule on the title % different kinds can be customized separately. The horizontal rule on the
% page is also set based on the progress bar color and can be customized with % title page is also set based on the progress bar color and can be customized
% |title separator|. % with |title separator|.
% %
% \begin{macrocode} % \begin{macrocode}
\setbeamercolor{progress bar}{% \setbeamercolor{progress bar}{%
@ -157,15 +180,16 @@
% Blocks % Blocks
% %
% \begin{macrocode} % \begin{macrocode}
\if@beamer@metropolis@blockbg \newcommand{\@metropolis@block@transparent}{
\setbeamercolor{block title}{use=normal text, parent=normal text}
}
\newcommand{\@metropolis@block@fill}{
\setbeamercolor{block title}{% \setbeamercolor{block title}{%
use=normal text, use=normal text,
fg=normal text.fg, fg=normal text.fg,
bg=normal text.bg!80!fg bg=normal text.bg!80!fg
} }
\else }
\setbeamercolor{block title}{use=normal text, parent=normal text}
\fi
\setbeamercolor{block title alerted}{% \setbeamercolor{block title alerted}{%
use={block title, alerted text}, use={block title, alerted text},
bg=block title.bg, bg=block title.bg,
@ -189,10 +213,18 @@
% \begin{macrocode} % \begin{macrocode}
\setbeamercolor{footnote}{fg=normal text.fg!90} \setbeamercolor{footnote}{fg=normal text.fg!90}
\setbeamercolor{footnote mark}{fg=.} \setbeamercolor{footnote mark}{fg=.}
\mode<all>
% \end{macrocode} % \end{macrocode}
% %
% Process package options
% %
% \begin{macrocode}
\@metropolis@color@setdefaults
\ProcessPgfPackageOptions{/metropolis/color}
% \end{macrocode}
%
% \begin{macrocode}
\mode<all>
% \end{macrocode}
% %
% \iffalse % \iffalse
%</package> %</package>

View File

@ -27,6 +27,7 @@
% \iffalse % \iffalse
%<*package> %<*package>
% ------------------------------------------------------------------------- \fi % ------------------------------------------------------------------------- \fi
%
% \section{Implementation: \textsc{metropolis} inner theme} % \section{Implementation: \textsc{metropolis} inner theme}
% %
% A |beamer| inner theme dictates the style of the frame elements traditionally % A |beamer| inner theme dictates the style of the frame elements traditionally
@ -40,14 +41,60 @@
% \item footnotes and plain text. % \item footnotes and plain text.
% \end{itemize} % \end{itemize}
% %
% Load required packages.
% \begin{macrocode}
\RequirePackage{calc}
\RequirePackage{pgfopts}
\RequirePackage{tikz}
% \end{macrocode}
%
%
%
% \subsection{Options}
%
% \begin{macro}{block}
% This option controls the block style.
% \begin{macrocode}
\pgfkeys{
/metropolis/inner/block/.cd,
.is choice,
transparent/.code=\setlength{\@metropolis@blockskip}{0ex},
fill/.code=\setlength{\@metropolis@blockskip}{1ex},
}
% \end{macrocode}
% \end{macro}
%
% \begin{macro}{sectionpage}
% The |sectionpage| option defines the behaviour of the sectionpage.
% \begin{macrocode}
\pgfkeys{
/metropolis/inner/sectionpage/.cd,
.is choice,
none/.code=\@metropolis@sectionpage@none,
progressbar/.code=\@metropolis@sectionpage@progressbar,
}
% \end{macrocode}
% \end{macro}
%
% \begin{macro}{\@metropolis@inner@setdefaults}
% Set default values for inner theme options.
% \begin{macrocode}
\newcommand{\@metropolis@inner@setdefaults}{
\pgfkeys{/metropolis/inner/.cd,
sectionpage=progressbar,
block=transparent,
}
}
% \end{macrocode}
% \end{macro}
%
%
%
% \subsection{Title page} % \subsection{Title page}
% %
% \begin{macro}{title page} % \begin{macro}{title page}
%
% Template for the title page. % Template for the title page.
%
% \begin{macrocode} % \begin{macrocode}
\RequirePackage{tikz}
\setbeamertemplate{title page}{ \setbeamertemplate{title page}{
\begin{minipage}[b][\paperheight]{\textwidth} \begin{minipage}[b][\paperheight]{\textwidth}
% \end{macrocode} % \end{macrocode}
@ -78,7 +125,7 @@
\linespread{1.0}% \linespread{1.0}%
\usebeamerfont{title}% \usebeamerfont{title}%
\usebeamercolor[fg]{title}% \usebeamercolor[fg]{title}%
\mthemetitleformat{\inserttitle}% \@metropolis@titleformat{\inserttitle}%
\par% \par%
\vspace*{0.5em} \vspace*{0.5em}
}} }}
@ -184,7 +231,12 @@
% Template for the section title slide at the beginning of each section. % Template for the section title slide at the beginning of each section.
% %
% \begin{macrocode} % \begin{macrocode}
\setbeamertemplate{section page}{ \newcommand{\@metropolis@sectionpage@none}{
\AtBeginSection{
% intenionally empty
}
}
\defbeamertemplate{section page}{progressbar}{
\vspace{2em} \vspace{2em}
\centering \centering
\begin{minipage}{22em} \begin{minipage}{22em}
@ -195,7 +247,8 @@
\end{minipage} \end{minipage}
\par \par
} }
\if@noSectionSlide\else% \newcommand{\@metropolis@sectionpage@progressbar}{
\setbeamertemplate{section page}[progressbar]
\AtBeginSection{ \AtBeginSection{
\ifbeamer@inframe \ifbeamer@inframe
\sectionpage \sectionpage
@ -203,7 +256,7 @@
\frame[plain,c]{\sectionpage} \frame[plain,c]{\sectionpage}
\fi \fi
} }
\fi }
% \end{macrocode} % \end{macrocode}
% \end{macro} % \end{macro}
% %
@ -214,7 +267,6 @@
% |progress bar in head/foot|. % |progress bar in head/foot|.
% %
% \begin{macrocode} % \begin{macrocode}
\RequirePackage{calc}
\newlength{\metropolis@progressonsectionpage} \newlength{\metropolis@progressonsectionpage}
\setbeamertemplate{progress bar in section page}{ \setbeamertemplate{progress bar in section page}{
\setlength{\metropolis@progressonsectionpage}{% \setlength{\metropolis@progressonsectionpage}{%
@ -247,27 +299,22 @@
% \subsection{Block environments} % \subsection{Block environments}
% %
% \begin{macrocode} % \begin{macrocode}
\newlength{\leftrightskip} \newlength{\@metropolis@blockskip}
\if@beamer@metropolis@blockbg
\setlength{\leftrightskip}{1ex}
\else
\setlength{\leftrightskip}{0ex}
\fi
\setbeamertemplate{block begin}{% \setbeamertemplate{block begin}{%
\vspace*{1ex} \vspace*{1ex}
\begin{beamercolorbox}[% \begin{beamercolorbox}[%
ht=2.4ex, ht=2.4ex,
dp=1ex, dp=1ex,
leftskip=\leftrightskip, leftskip=\@metropolis@blockskip,
rightskip=\leftrightskip]{block title} rightskip=\@metropolis@blockskip]{block title}
\usebeamerfont*{block title}\insertblocktitle% \usebeamerfont*{block title}\insertblocktitle%
\end{beamercolorbox}% \end{beamercolorbox}%
\vspace*{-1pt} \vspace*{-1pt}
\usebeamerfont{block body}% \usebeamerfont{block body}%
\begin{beamercolorbox}[% \begin{beamercolorbox}[%
dp=1ex, dp=1ex,
leftskip=\leftrightskip, leftskip=\@metropolis@blockskip,
rightskip=\leftrightskip, rightskip=\@metropolis@blockskip,
vmode]{block body}% vmode]{block body}%
} }
\setbeamertemplate{block end}{% \setbeamertemplate{block end}{%
@ -284,16 +331,16 @@
\begin{beamercolorbox}[% \begin{beamercolorbox}[%
ht=2.4ex, ht=2.4ex,
dp=1ex, dp=1ex,
leftskip=\leftrightskip, leftskip=\@metropolis@blockskip,
rightskip=\leftrightskip]{block title alerted} rightskip=\@metropolis@blockskip]{block title alerted}
\usebeamerfont*{block title alerted}\insertblocktitle% \usebeamerfont*{block title alerted}\insertblocktitle%
\end{beamercolorbox}% \end{beamercolorbox}%
\vspace*{-1pt} \vspace*{-1pt}
\usebeamerfont{block body alerted}% \usebeamerfont{block body alerted}%
\begin{beamercolorbox}[% \begin{beamercolorbox}[%
dp=1ex, dp=1ex,
leftskip=\leftrightskip, leftskip=\@metropolis@blockskip,
rightskip=\leftrightskip, rightskip=\@metropolis@blockskip,
vmode]{block body}% vmode]{block body}%
} }
\setbeamertemplate{block alerted end}{% \setbeamertemplate{block alerted end}{%
@ -310,16 +357,16 @@
\begin{beamercolorbox}[% \begin{beamercolorbox}[%
ht=2.4ex, ht=2.4ex,
dp=1ex, dp=1ex,
leftskip=\leftrightskip, leftskip=\@metropolis@blockskip,
rightskip=\leftrightskip]{block title example} rightskip=\@metropolis@blockskip]{block title example}
\usebeamerfont*{block title example}\insertblocktitle% \usebeamerfont*{block title example}\insertblocktitle%
\end{beamercolorbox}% \end{beamercolorbox}%
\vspace*{-1pt} \vspace*{-1pt}
\usebeamerfont{block body example}% \usebeamerfont{block body example}%
\begin{beamercolorbox}[% \begin{beamercolorbox}[%
dp=1ex, dp=1ex,
leftskip=\leftrightskip, leftskip=\@metropolis@blockskip,
rightskip=\leftrightskip, rightskip=\@metropolis@blockskip,
vmode]{block body}% vmode]{block body}%
} }
\setbeamertemplate{block example end}{% \setbeamertemplate{block example end}{%
@ -340,12 +387,16 @@
\setbeamertemplate{itemize subsubitem}{\textbullet} \setbeamertemplate{itemize subsubitem}{\textbullet}
% \end{macrocode} % \end{macrocode}
% %
%
%
% \subsection{Figures and tables} % \subsection{Figures and tables}
% \begin{macrocode} % \begin{macrocode}
\setbeamertemplate{caption label separator}{: } \setbeamertemplate{caption label separator}{: }
\setbeamertemplate{caption}[numbered] \setbeamertemplate{caption}[numbered]
% \end{macrocode} % \end{macrocode}
% %
%
%
% \subsection{Footnotes} % \subsection{Footnotes}
% \begin{macrocode} % \begin{macrocode}
\setbeamertemplate{footnote}{% \setbeamertemplate{footnote}{%
@ -355,14 +406,21 @@
} }
% \end{macrocode} % \end{macrocode}
% %
% \subsection{General text} %
%
% \subsection{General text settings}
% \begin{macrocode} % \begin{macrocode}
\mode<all> \mode<all>
\setlength{\parskip}{0.5em} \setlength{\parskip}{0.5em}
\linespread{1.15} \linespread{1.15}
% \end{macrocode} % \end{macrocode}
% %
% Process package options
% %
% \begin{macrocode}
\@metropolis@inner@setdefaults
\ProcessPgfPackageOptions{/metropolis/inner}
% \end{macrocode}
% %
% \iffalse % \iffalse
%</package> %</package>

View File

@ -27,20 +27,73 @@
% \iffalse % \iffalse
%<*package> %<*package>
% ------------------------------------------------------------------------- \fi % ------------------------------------------------------------------------- \fi
%
% \section{Implementation: \textsc{metropolis} outer theme} % \section{Implementation: \textsc{metropolis} outer theme}
% %
% A |beamer| outer theme dictates the style of the frame elements traditionally % 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. % set outside the body of each slide: the head, footline, and frame title.
% %
% % Load required packages.
%
% This customization will be removed in a future version.
%
% \begin{macrocode} % \begin{macrocode}
\def\mthemetitleformat{\scshape\MakeLowercase} \RequirePackage{calc}
\RequirePackage{pgfopts}
% \end{macrocode} % \end{macrocode}
% %
% %
%
% \subsection{Options}
%
% \begin{macro}{numbering}
% This option controls the page numbering.
% \begin{macrocode}
\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],
}
% \end{macrocode}
% \end{macro}
%
% \begin{macro}{progressbar}
% This option controls the progressbar.
% \begin{macrocode}
\pgfkeys{
/metropolis/outer/progressbar/.cd,
.is choice,
none/.code=\setbeamertemplate{progress bar in head/foot}[none],
head/.code=\setbeamertemplate{progress bar in head/foot}[head],
}
% \end{macrocode}
% \end{macro}
%
% \begin{macro}{frametitleoffset}
% This option controls the frame title offset.
% \begin{macrocode}
\pgfkeys{
/metropolis/outer/.cd,
frametitleoffset/.code=\setlength{\@metropolis@voffset}{#1},
noframetitleoffset/.code=\setlength{\@metropolis@voffset}{0em},
}
% \end{macrocode}
% \end{macro}
%
% \begin{macro}{\@metropolis@outer@setdefaults}
% Set default values for outer theme options.
% \begin{macrocode}
\newcommand{\@metropolis@outer@setdefaults}{
\pgfkeys{/metropolis/outer/.cd,
numbering=counter,
progressbar=none,
frametitleoffset=2em,
}
}
% \end{macrocode}%
% \end{macro}
%
%
%
% \subsection{Head and footline} % \subsection{Head and footline}
% %
% All good |beamer| presentations should already remove the navigation symbols, % All good |beamer| presentations should already remove the navigation symbols,
@ -50,8 +103,28 @@
\setbeamertemplate{navigation symbols}{} \setbeamertemplate{navigation symbols}{}
% \end{macrocode} % \end{macrocode}
% %
% The only element in the footline by default is the frame number. It can % Template for the frame number. Can be omitted, shown or displayed as a
% optionally be omitted or displayed as a fraction of the total frames. % fraction of the total frames.
%
% \begin{macrocode}
\defbeamertemplate{frame numbering}{none}{
% intentionally empty
}
\defbeamertemplate{frame numbering}{counter}{
\insertframenumber
}
\defbeamertemplate{frame numbering}{fraction}{
\insertframenumber/\inserttotalframenumber
}
% \end{macrocode}
%
% Define additional space between frame title and content. By default 2em.
%
% \begin{macrocode}
\newlength{\@metropolis@voffset}
% \end{macrocode}
%
% The only element in the footline by default is the frame number.
% %
% \begin{macrocode} % \begin{macrocode}
\setbeamertemplate{footline}{% \setbeamertemplate{footline}{%
@ -62,16 +135,8 @@
leftskip=0.3cm, leftskip=0.3cm,
rightskip=0.3cm rightskip=0.3cm
]{footline}% ]{footline}%
\hfill\usebeamerfont{page number in head/foot}% \hfill\usebeamerfont{page number in head/foot}%
\if@noSlideNumbers% \usebeamertemplate*{frame numbering}
%Purposefully left blank to display no slide number.%
\else%
\if@useTotalSlideIndicator%
\insertframenumber/\inserttotalframenumber%
\else%
\insertframenumber%
\fi%
\fi%
\end{beamercolorbox}% \end{beamercolorbox}%
} }
% \end{macrocode} % \end{macrocode}
@ -97,11 +162,8 @@
]{frametitle} ]{frametitle}
\insertframetitle% \insertframetitle%
\end{beamercolorbox}% \end{beamercolorbox}%
\if@useTitleProgressBar \usebeamertemplate*{progress bar in head/foot}
\nointerlineskip \vspace{\@metropolis@voffset}
\usebeamertemplate*{progress bar in head/foot}
\fi
\vspace{\@mtheme@voffset}
} }
% \end{macrocode} % \end{macrocode}
% \end{macro} % \end{macro}
@ -113,13 +175,17 @@
% |progress bar in section page|. % |progress bar in section page|.
% %
% \begin{macrocode} % \begin{macrocode}
\RequirePackage{calc}
\newlength{\metropolis@progressinheadfoot} \newlength{\metropolis@progressinheadfoot}
\setbeamertemplate{progress bar in head/foot}{ \defbeamertemplate{progress bar in head/foot}{none}{}
\defbeamertemplate{progress bar in head/foot}{head}{
\nointerlineskip
\setlength{\metropolis@progressinheadfoot}{% \setlength{\metropolis@progressinheadfoot}{%
\paperwidth * \ratio{\insertframenumber pt}{\inserttotalframenumber pt}% \paperwidth * \ratio{\insertframenumber pt}{\inserttotalframenumber pt}%
}% }%
\begin{beamercolorbox}[wd=\paperwidth,ht=0.4pt,dp=0pt]{progress bar in head/foot} \begin{beamercolorbox}[
wd=\paperwidth,
ht=0.4pt,
dp=0pt]{progress bar in head/foot}
\begin{tikzpicture} \begin{tikzpicture}
\draw[bg, fill=bg] (0,0) rectangle (\paperwidth, 0.4pt); \draw[bg, fill=bg] (0,0) rectangle (\paperwidth, 0.4pt);
\draw[fg, fill=fg] (0,0) rectangle (\metropolis@progressinheadfoot, 0.4pt); \draw[fg, fill=fg] (0,0) rectangle (\metropolis@progressinheadfoot, 0.4pt);
@ -129,7 +195,12 @@
% \end{macrocode} % \end{macrocode}
% \end{macro} % \end{macro}
% %
% Process package options
% %
% \begin{macrocode}
\@metropolis@outer@setdefaults
\ProcessPgfPackageOptions{/metropolis/outer}
% \end{macrocode}
% %
% \iffalse % \iffalse
%</package> %</package>

View File

@ -27,89 +27,75 @@
% \iffalse % \iffalse
%<*package> %<*package>
% ------------------------------------------------------------------------- \fi % ------------------------------------------------------------------------- \fi
%
% \section{Implementation: \textsc{metropolis} main theme} % \section{Implementation: \textsc{metropolis} main theme}
% %
% The primary job of this package is to load the component sub-packages of the % The primary job of this package is to load the component sub-packages of the
% \textsc{metropolis} theme and route the theme options accordingly. It also % \textsc{metropolis} theme and route the theme options accordingly. It also
% provides some custom commands and environments for the user. % provides some custom commands and environments for the user.
% %
% Load the required packages.
% \begin{macrocode}
\RequirePackage{etoolbox}
\RequirePackage{pgfopts}
\RequirePackage{ifxetex}
\RequirePackage{ifluatex}
% \end{macrocode}
% %
% Options % \subsection{Options}
%
% \begin{macro}{\setmetropolis}
% First of all we define a macro for the user to set options.
% \begin{macrocode}
\newcommand{\setmetropolis}[1]{\pgfkeys{/metropolis/.cd,#1}}
% \end{macrocode}
% \end{macro}
%
% Then we need to pass the unknown options to the sub-packages.
% %
% \begin{macrocode} % \begin{macrocode}
\newif\if@useTitleProgressBar \pgfkeys{/metropolis/.cd,
\@useTitleProgressBarfalse .search also={
\DeclareOptionBeamer{usetitleprogressbar}{ /metropolis/inner,
\@useTitleProgressBartrue /metropolis/outer,
/metropolis/color,
},
% \end{macrocode}
%
% We have to forwarded keys that affect multiple sub-packages manually.
%
% \begin{macrocode}
block/.code=\pgfkeysalso{
inner/block=#1,
color/block=#1,
}
} }
% \end{macrocode} % \end{macrocode}
% %
% usetotalslideindicator % For backwards compatibility with earlier betas of the theme, we implement
% deprecated option names as aliases to the corresponding |key=value| options.
% %
% \begin{macrocode} % \begin{macrocode}
\newif\if@useTotalSlideIndicator \pgfkeys{/metropolis/.cd,
\@useTotalSlideIndicatorfalse usetitleprogressbar/.code=\pgfkeysalso{outer/progressbar=head},
\DeclareOptionBeamer{usetotalslideindicator}{ noslidenumbers/.code=\pgfkeysalso{outer/numbering=none},
\@useTotalSlideIndicatortrue usetotalslideindicator/.code=\pgfkeysalso{outer/numbering=fraction},
nosectionslide/.code=\pgfkeysalso{inner/sectionpage=none},
darkcolors/.code=\pgfkeysalso{color/background=dark},
blockbg/.code=\pgfkeysalso{color/block=fill, inner/block=fill},
} }
% \end{macrocode} % \end{macrocode}
% %
% noslidenumbers % Set default values for options.
% %
% \begin{macrocode} % \begin{macrocode}
\newif\if@noSlideNumbers \newcommand{\@metropolis@setdefaults}{
\@noSlideNumbersfalse \pgfkeys{/metropolis/.cd,
\DeclareOptionBeamer{noslidenumbers}{ }
\@noSlideNumberstrue
} }
% \end{macrocode} % \end{macrocode}
% %
% nosectionslide
% %
% \begin{macrocode}
\newif\if@noSectionSlide
\@noSectionSlidefalse
\DeclareOptionBeamer{nosectionslide}{
\@noSectionSlidetrue
}
% \end{macrocode}
%
% nooffset
%
% \begin{macrocode}
\newlength{\@mtheme@voffset}
\setlength{\@mtheme@voffset}{2em}
\DeclareOptionBeamer{nooffset}{
\setlength{\@mtheme@voffset}{0em}
}
% \end{macrocode}
%
% blockbg
%
% \begin{macrocode}
\newif\if@beamer@metropolis@blockbg
\@beamer@metropolis@blockbgfalse
\DeclareOptionBeamer{blockbg}{
\@beamer@metropolis@blockbgtrue
}
% \end{macrocode}
%
% darkcolors
%
% \begin{macrocode}
\DeclareOptionBeamer{darkcolors}{
\PassOptionsToPackage{darkcolors}{beamercolorthememetropolis}%
}
% \end{macrocode}
%
% Unknown option error handling
%
% \begin{macrocode}
\DeclareOptionBeamer*{
\PackageWarning{beamerthemem}{Unknown option `\CurrentOption'}%
}
\ProcessOptionsBeamer
% \end{macrocode}
% %
% \subsection{Component sub-packages} % \subsection{Component sub-packages}
% %
@ -125,8 +111,6 @@
% document is being processed by Xe\LaTeX{} or Lua\LaTeX{}. % document is being processed by Xe\LaTeX{} or Lua\LaTeX{}.
% %
% \begin{macrocode} % \begin{macrocode}
\RequirePackage{etoolbox}
\RequirePackage{ifxetex,ifluatex}
\ifboolexpr{bool {xetex} or bool {luatex}}{ \ifboolexpr{bool {xetex} or bool {luatex}}{
\usefonttheme{metropolis} \usefonttheme{metropolis}
}{ }{
@ -146,21 +130,23 @@
} }
% \end{macrocode} % \end{macrocode}
% %
%
%
% \subsection{Custom commands} % \subsection{Custom commands}
% %
% We define custom commands in this package as their proper usage may depend % We define custom commands in this package as their proper usage may depend
% on multiple sub-packages. % on multiple sub-packages.
% %
% \begin{macro}{\mthemetitleformat} % \begin{macro}{\@metropolis@titleformat}
% \begin{macro}{\mthemesectiontitleformat} % \begin{macro}{\@metropolis@sectiontitleformat}
% \begin{macro}{\mthemeframetitleformat} % \begin{macro}{\@metropolis@frametitleformat}
% \begin{macro}{\mthemeplaintitleformat} % \begin{macro}{\@metropolis@plaintitleformat}
% Creates hooks to change the case format of the four different titles. % Creates hooks to change the case format of the four different titles.
% \begin{macrocode} % \begin{macrocode}
\def\mthemetitleformat#1{\MakeLowercase{#1}} \def\@metropolis@titleformat#1{\MakeLowercase{#1}}
\def\mthemesectiontitleformat#1{\mthemetitleformat{#1}} \def\@metropolis@sectiontitleformat#1{\@metropolis@titleformat{#1}}
\def\mthemeframetitleformat#1{\mthemetitleformat{#1}} \def\@metropolis@frametitleformat#1{\@metropolis@titleformat{#1}}
\def\mthemeplaintitleformat#1{\mthemetitleformat{#1}} \def\@metropolis@plaintitleformat#1{\@metropolis@titleformat{#1}}
% \end{macrocode} % \end{macrocode}
% %
% To give users the option to |\MakeUppercase| or |\MakeLowercase| the % To give users the option to |\MakeUppercase| or |\MakeLowercase| the
@ -173,11 +159,11 @@
% \begin{macrocode} % \begin{macrocode}
\patchcmd{\sectionentry} \patchcmd{\sectionentry}
{\def\insertsectionhead{#2}} {\def\insertsectionhead{#2}}
{\def\insertsectionhead{\mthemesectiontitleformat{#2}}} {\def\insertsectionhead{\@metropolis@sectiontitleformat{#2}}}
{}{} {}{}
\patchcmd{\beamer@section} \patchcmd{\beamer@section}
{\def\insertsectionhead{\hyperlink{Navigation\the\c@page}{#1}}} {\def\insertsectionhead{\hyperlink{Navigation\the\c@page}{#1}}}
{\def\insertsectionhead{\hyperlink{Navigation\the\c@page}{\mthemesectiontitleformat{#1}}}} {\def\insertsectionhead{\hyperlink{Navigation\the\c@page}{\@metropolis@sectiontitleformat{#1}}}}
{}{} {}{}
\patchcmd{\beamer@@frametitle} \patchcmd{\beamer@@frametitle}
@ -187,7 +173,7 @@
\gdef\beamer@shortframetitle{#1}% \gdef\beamer@shortframetitle{#1}%
}} }}
{\beamer@ifempty{#2}{}{% {\beamer@ifempty{#2}{}{%
\gdef\insertframetitle{{\mthemeframetitleformat{#2}\ifnum\beamer@autobreakcount>0\relax{}\space\usebeamertemplate*{frametitle continuation}\fi}}% \gdef\insertframetitle{{\@metropolis@frametitleformat{#2}\ifnum\beamer@autobreakcount>0\relax{}\space\usebeamertemplate*{frametitle continuation}\fi}}%
\gdef\beamer@frametitle{#2}% \gdef\beamer@frametitle{#2}%
\gdef\beamer@shortframetitle{#1}% \gdef\beamer@shortframetitle{#1}%
}} }}
@ -211,7 +197,7 @@
\vspace{1em} \vspace{1em}
\usebeamercolor[fg]{palette primary} \usebeamercolor[fg]{palette primary}
\usebeamerfont{section title} \usebeamerfont{section title}
\mthemeplaintitleformat{#2} \@metropolis@plaintitleformat{#2}
\vfill \vfill
\end{frame} \end{frame}
\endgroup \endgroup
@ -225,6 +211,13 @@
% \end{macrocode} % \end{macrocode}
% \end{macro} % \end{macro}
% %
% Process package options
%
% \begin{macrocode}
\@metropolis@setdefaults
\ProcessPgfOptions{/metropolis}
% \end{macrocode}
%
% \iffalse % \iffalse
%</package> %</package>
% \fi % \fi

BIN
demo.pdf

Binary file not shown.

View File

@ -2,6 +2,12 @@
\usetheme{m} \usetheme{m}
\setmetropolis{
sectionpage=none,
block=fill,
numbering=fraction,
}
\usepackage{booktabs} \usepackage{booktabs}
\usepackage[scale=2]{ccicons} \usepackage[scale=2]{ccicons}

View File

@ -62,7 +62,7 @@
xrightmargin=0em, xrightmargin=0em,
aboveskip=1em, aboveskip=1em,
belowskip=1em, belowskip=1em,
morekeywords={usetheme,institute,maketitle,mthemetitleformat,plain,setbeamercolor}, morekeywords={usetheme,institute,maketitle,@metropolis@titleformat,plain,setbeamercolor},
} }
\lstMakeShortInline| \lstMakeShortInline|
@ -238,17 +238,17 @@ colors in |beamercolorthememetropolis|, including progress bar.
\subsection{Title Case Formatting} \subsection{Title Case Formatting}
The main title, section titles, frame titles and plain frame titles are all The main title, section titles, frame titles and plain frame titles are all
formatted according to the custom command |\mthemetitleformat|. By default, formatted according to the custom command |\@metropolis@titleformat|. By default,
this is equivalent to |\MakeLowercase{#1}|, hence seting the titles in small this is equivalent to |\MakeLowercase{#1}|, hence seting the titles in small
capitals. You can change this behaviour in your preamble. For example: capitals. You can change this behaviour in your preamble. For example:
\begin{lstlisting} \begin{lstlisting}
% camel case % camel case
\renewcommand{\mthemetitleformat}{} \renewcommand{\@metropolis@titleformat}{}
% lowercase % lowercase
\renewcommand{\mthemetitleformat}\MakeLowercase} \renewcommand{\@metropolis@titleformat}\MakeLowercase}
% uppercase % uppercase
\renewcommand{\mthemetitleformat}{\MakeUppercase} \renewcommand{\@metropolis@titleformat}{\MakeUppercase}
\end{lstlisting} \end{lstlisting}
Be aware that these formatting macros will be replaced with theme options in Be aware that these formatting macros will be replaced with theme options in

Binary file not shown.