made the case settings package options and a lot of documenting

This commit is contained in:
Benjamin Weiss 2015-06-23 14:35:04 +02:00
parent f6fc58c6c7
commit 4a8557a124
13 changed files with 229 additions and 123 deletions

View File

@ -22,7 +22,7 @@ DOCKER_CONTAINER = latex-container
.PHONY: sty doc demo demo-min ctan clean install uninstall docker-run docker-build docker-rm
all: sty doc demo
all: sty doc demo demo-min
$(STY): $(DTX) $(INS)
@latex $(INS)

View File

@ -28,7 +28,7 @@
%<*package>
% ------------------------------------------------------------------------- \fi
%
% \section{Implementation: \textsc{metropolis} color theme}
% \subsection{\textsc{metropolis} color theme}
%
% Load required packages.
% \begin{macrocode}
@ -37,7 +37,7 @@
%
%
%
% \subsection{Options}
% \subsubsection{Options}
%
% \begin{macro}{block}
% This option controls whether the blocks are filled or transparent.
@ -78,7 +78,7 @@
%
%
%
% \subsection{Base colors}
% \subsubsection{Base colors}
%
% \begin{macrocode}
\definecolor{mDarkBrown}{HTML}{604c38}
@ -89,7 +89,7 @@
%
%
%
% \subsection{Base styles}
% \subsubsection{Base styles}
%
% All colors in the \textsc{metropolis} theme are derived from the definitions
% of |normal text|, |alerted text|, and |example text|.
@ -117,7 +117,7 @@
%
%
%
% \subsection{Derived colors}
% \subsubsection{Derived colors}
%
% The titles and structural elements (e.g. |itemize| bullets) are set in the
% same color as |normal text|. This would ideally done by setting |normal text|

View File

@ -27,7 +27,7 @@
% \iffalse
%<*package>
% ------------------------------------------------------------------------- \fi
% \section{Implementation: Fira font theme}
% \subsection{Fira font theme}
% Font Definitions
%
% \begin{macrocode}

View File

@ -28,7 +28,7 @@
%<*package>
% ------------------------------------------------------------------------- \fi
%
% \section{Implementation: \textsc{metropolis} inner theme}
% \subsection{\textsc{metropolis} inner theme}
%
% A |beamer| inner theme dictates the style of the frame elements traditionally
% set in the ``body'' of each slide. These include:
@ -43,6 +43,7 @@
%
% Load required packages.
% \begin{macrocode}
\RequirePackage{etoolbox}
\RequirePackage{calc}
\RequirePackage{pgfopts}
\RequirePackage{tikz}
@ -50,7 +51,7 @@
%
%
%
% \subsection{Options}
% \subsubsection{Options}
%
% \begin{macro}{block}
% This option controls the block style.
@ -64,6 +65,40 @@
% \end{macrocode}
% \end{macro}
%
% \begin{macro}{titleformat}
% Control the case style of the title
% \begin{macrocode}
\pgfkeys{
/metropolis/inner/titleformat/.cd,
.is choice,
regular/.code=\renewcommand{\@metropolis@titleformat}{},
lowercase/.code={%
\renewcommand{\@metropolis@titleformat}{\MakeLowercase}
},
uppercase/.code={%
\renewcommand{\@metropolis@titleformat}{\MakeUppercase}
},
}
% \end{macrocode}
% \end{macro}
%
% \begin{macro}{sectiontitleformat}
% Control the case style of the section title
% \begin{macrocode}
\pgfkeys{
/metropolis/inner/sectiontitleformat/.cd,
.is choice,
regular/.code=\renewcommand{\@metropolis@sectiontitleformat}{},
lowercase/.code={%
\renewcommand{\@metropolis@sectiontitleformat}{\MakeLowercase}
},
uppercase/.code={%
\renewcommand{\@metropolis@sectiontitleformat}{\MakeUppercase}
},
}
% \end{macrocode}
% \end{macro}
%
% \begin{macro}{sectionpage}
% The |sectionpage| option defines the behaviour of the sectionpage.
% \begin{macrocode}
@ -83,6 +118,8 @@
\pgfkeys{/metropolis/inner/.cd,
sectionpage=progressbar,
block=transparent,
titleformat=lowercase,
sectiontitleformat=lowercase,
}
}
% \end{macrocode}
@ -90,7 +127,34 @@
%
%
%
% \subsection{Title page}
% \subsubsection{Title page}
%
% \begin{macro}{\@metropolis@titleformat}
% Define hooks to change the case format of the titles.
% \begin{macrocode}
\def\@metropolis@titleformat#1{#1}
\def\@metropolis@sectiontitleformat#1{#1}
% \end{macrocode}
% \end{macro}
%
% To make the |\MakeLowercase| and |\MakeUppercase| macros work in the
% sectiontitle we have to patch |\sectionentry| and |\beamer@section|. This
% solution was suggested by Enrico Gregorio in an answer to
% \href{http://tex.stackexchange.com/questions/112526/}{this StackExchange
% question}.
%
% \begin{macrocode}
\patchcmd{\sectionentry}
{\def\insertsectionhead{#2}}
{\def\insertsectionhead{\@metropolis@sectiontitleformat{#2}}}
{}
{\PackageError{beamerinnerthememetropolis}{Patching section title failed.}}
\patchcmd{\beamer@section}
{\def\insertsectionhead{\hyperlink{Navigation\the\c@page}{#1}}}
{\def\insertsectionhead{\hyperlink{Navigation\the\c@page}{\@metropolis@sectiontitleformat{#1}}}}
{}
{\PackageError{beamerinnerthememetropolis}{Patching section title failed.}}
% \end{macrocode}
%
% \begin{macro}{title page}
% Template for the title page.
@ -224,7 +288,7 @@
%
%
%
% \subsection{Section page}
% \subsubsection{Section page}
%
% \begin{macro}{section page}
%
@ -296,7 +360,9 @@
%
%
%
% \subsection{Block environments}
% \subsubsection{Block environments}
%
% Regular block environment
%
% \begin{macrocode}
\newlength{\@metropolis@blockskip}
@ -377,7 +443,7 @@
%
%
%
% \subsection{Itemize/enumerate environments}
% \subsubsection{Itemize/enumerate environments}
% \begin{macrocode}
\setlength{\leftmargini}{1em}
\setlength{\leftmarginii}{1em}
@ -389,7 +455,7 @@
%
%
%
% \subsection{Figures and tables}
% \subsubsection{Figures and tables}
% \begin{macrocode}
\setbeamertemplate{caption label separator}{: }
\setbeamertemplate{caption}[numbered]
@ -397,7 +463,7 @@
%
%
%
% \subsection{Footnotes}
% \subsubsection{Footnotes}
% \begin{macrocode}
\setbeamertemplate{footnote}{%
\parindent 0em\noindent%
@ -408,7 +474,7 @@
%
%
%
% \subsection{General text settings}
% \subsubsection{General text settings}
% \begin{macrocode}
\mode<all>
\setlength{\parskip}{0.5em}

View File

@ -28,20 +28,21 @@
%<*package>
% ------------------------------------------------------------------------- \fi
%
% \section{Implementation: \textsc{metropolis} outer theme}
% \subsection{\textsc{metropolis} outer theme}
%
% 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.
%
% Load required packages.
% \begin{macrocode}
\RequirePackage{etoolbox}
\RequirePackage{calc}
\RequirePackage{pgfopts}
% \end{macrocode}
%
%
%
% \subsection{Options}
% \subsubsection{Options}
%
% \begin{macro}{numbering}
% This option controls the page numbering.
@ -63,7 +64,24 @@
/metropolis/outer/progressbar/.cd,
.is choice,
none/.code=\setbeamertemplate{progress bar in head/foot}[none],
head/.code=\setbeamertemplate{progress bar in head/foot}[head],
top/.code=\setbeamertemplate{progress bar in head/foot}[top],
}
% \end{macrocode}
% \end{macro}
%
% \begin{macro}{frametitleformat}
% Control the case style of the frame title
% \begin{macrocode}
\pgfkeys{
/metropolis/outer/frametitleformat/.cd,
.is choice,
regular/.code=\renewcommand{\@metropolis@frametitleformat}{},
lowercase/.code={%
\renewcommand{\@metropolis@frametitleformat}{\MakeLowercase}
},
uppercase/.code={%
\renewcommand{\@metropolis@frametitleformat}{\MakeUppercase}
},
}
% \end{macrocode}
% \end{macro}
@ -86,6 +104,7 @@
\pgfkeys{/metropolis/outer/.cd,
numbering=counter,
progressbar=none,
frametitleformat=lowercase,
frametitleoffset=2em,
}
}
@ -94,7 +113,7 @@
%
%
%
% \subsection{Head and footline}
% \subsubsection{Head and footline}
%
% All good |beamer| presentations should already remove the navigation symbols,
% but \textsc{metropolis} removes them automatically (just in case).
@ -143,12 +162,41 @@
%
%
%
% \subsection{Frametitle}
% \subsubsection{Frametitle}
%
% \begin{macro}{\@metropolis@frametitleformat}
% Define a hook to change the case format of the frame title.
% \begin{macrocode}
\def\@metropolis@frametitleformat#1{#1}
% \end{macrocode}
% \end{macro}
%
% To make the |\MakeLowercase| and |\MakeUppercase| macros work in the
% frame title we have to patch |\beamer@@frametitle|. This solution was
% suggested by Enrico Gregorio in an answer to
% \href{http://tex.stackexchange.com/questions/112526/}{this StackExchange
% question}.
%
% \begin{macrocode}
\patchcmd{\beamer@@frametitle}
{\beamer@ifempty{#2}{}{%
\gdef\insertframetitle{{#2\ifnum\beamer@autobreakcount>0\relax{}\space\usebeamertemplate*{frametitle continuation}\fi}}%
\gdef\beamer@frametitle{#2}%
\gdef\beamer@shortframetitle{#1}%
}}
{\beamer@ifempty{#2}{}{%
\gdef\insertframetitle{{\@metropolis@frametitleformat{#2}\ifnum\beamer@autobreakcount>0\relax{}\space\usebeamertemplate*{frametitle continuation}\fi}}%
\gdef\beamer@frametitle{#2}%
\gdef\beamer@shortframetitle{#1}%
}}
{}
{\PackageError{beamerouterthememetropolis}{Patching frame title failed.}}
% \end{macrocode}
%
% \begin{macro}{frametitle}
%
% Template for the frame title, which is optionally underlined with a
% progress bar.
% Template for the frame title, which is optionally underlined with a
% progress bar.
%
% \begin{macrocode}
\setbeamertemplate{frametitle}{%
@ -170,9 +218,9 @@
%
% \begin{macro}{progress bar in head/foot}
%
% 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|.
% 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}

View File

@ -28,7 +28,7 @@
%<*package>
% ------------------------------------------------------------------------- \fi
%
% \section{Implementation: \textsc{metropolis} main theme}
% \subsection{\textsc{metropolis} main theme}
%
% 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
@ -42,7 +42,7 @@
\RequirePackage{ifluatex}
% \end{macrocode}
%
% \subsection{Options}
% \subsubsection{Options}
%
% \begin{macro}{\metropolisset}
% First of all we define a macro for the user to set options.
@ -68,10 +68,41 @@
block/.code=\pgfkeysalso{
inner/block=#1,
color/block=#1,
}
},
}
% \end{macrocode}
%
% \begin{macro}{plaintitleformat}
% Control the case style of the plain title
% \begin{macrocode}
\pgfkeys{
/metropolis/plaintitleformat/.cd,
.is choice,
regular/.code=\renewcommand{\@metropolis@plaintitleformat}{#1},
lowercase/.code={%
\renewcommand{\@metropolis@plaintitleformat}{\MakeLowercase{#1}}
},
uppercase/.code={%
\renewcommand{\@metropolis@plaintitleformat}{\MakeUppercase{#1}}
},
}
% \end{macrocode}
% \end{macro}
%
% \begin{macro}{everytitleformat}
% Control the case style of the every title
% \begin{macrocode}
\pgfkeys{
/metropolis/everytitleformat/.code=\pgfkeysalso{
inner/titleformat=#1,
inner/sectiontitleformat=#1,
outer/frametitleformat=#1,
plaintitleformat=#1,
}
}
% \end{macrocode}
% \end{macro}
%
% For backwards compatibility with earlier betas of the theme, we implement
% deprecated option names as aliases to the corresponding |key=value| options.
%
@ -91,13 +122,14 @@
% \begin{macrocode}
\newcommand{\@metropolis@setdefaults}{
\pgfkeys{/metropolis/.cd,
plaintitleformat=lowercase,
}
}
% \end{macrocode}
%
%
%
% \subsection{Component sub-packages}
% \subsubsection{Component sub-packages}
%
% Having processed the options, we can now load the component sub-packages of
% the theme.
@ -132,56 +164,16 @@
%
%
%
% \subsection{Custom commands}
% \subsubsection{Custom commands}
%
% We define custom commands in this package as their proper usage may depend
% on multiple sub-packages.
%
% \begin{macro}{\@metropolis@titleformat}
% \begin{macro}{\@metropolis@sectiontitleformat}
% \begin{macro}{\@metropolis@frametitleformat}
% \begin{macro}{\@metropolis@plaintitleformat}
% Creates hooks to change the case format of the four different titles.
% Define a hook to change the case format of the plain title.
% \begin{macrocode}
\def\@metropolis@titleformat#1{\MakeLowercase{#1}}
\def\@metropolis@sectiontitleformat#1{\@metropolis@titleformat{#1}}
\def\@metropolis@frametitleformat#1{\@metropolis@titleformat{#1}}
\def\@metropolis@plaintitleformat#1{\@metropolis@titleformat{#1}}
\def\@metropolis@plaintitleformat#1{#1}
% \end{macrocode}
%
% To give users the option to |\MakeUppercase| or |\MakeLowercase| the
% section title and frame title we need to patch the commands
% |\sectionentry|, |\beamer@section| and |\beamer@@frametitle|. This
% solution was suggested by Enrico Gregorio in an answer to
% \href{http://tex.stackexchange.com/questions/112526/}{this StackExchange
% question}.
%
% \begin{macrocode}
\patchcmd{\sectionentry}
{\def\insertsectionhead{#2}}
{\def\insertsectionhead{\@metropolis@sectiontitleformat{#2}}}
{}{}
\patchcmd{\beamer@section}
{\def\insertsectionhead{\hyperlink{Navigation\the\c@page}{#1}}}
{\def\insertsectionhead{\hyperlink{Navigation\the\c@page}{\@metropolis@sectiontitleformat{#1}}}}
{}{}
\patchcmd{\beamer@@frametitle}
{\beamer@ifempty{#2}{}{%
\gdef\insertframetitle{{#2\ifnum\beamer@autobreakcount>0\relax{}\space\usebeamertemplate*{frametitle continuation}\fi}}%
\gdef\beamer@frametitle{#2}%
\gdef\beamer@shortframetitle{#1}%
}}
{\beamer@ifempty{#2}{}{%
\gdef\insertframetitle{{\@metropolis@frametitleformat{#2}\ifnum\beamer@autobreakcount>0\relax{}\space\usebeamertemplate*{frametitle continuation}\fi}}%
\gdef\beamer@frametitle{#2}%
\gdef\beamer@shortframetitle{#1}%
}}
{}{}
% \end{macrocode}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
%
% \begin{macro}{\plain}

BIN
demo-minimal.pdf Normal file

Binary file not shown.

View File

@ -1,10 +1,6 @@
\documentclass[10pt]{beamer}
\usetheme{m}
\metropolisset{
numbering=fraction,
progressbar=top,
}
\title{A modern beamer theme}
\subtitle{}
@ -35,10 +31,6 @@
\end{block}
\end{frame}
\metropolisset{
block=fill,
}
\begin{frame}{Frame 4}
Content 4
\begin{block}{Block 2}

BIN
demo.pdf

Binary file not shown.

View File

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

View File

@ -130,11 +130,13 @@ computer. The complete list of make rules is as follows:
\item[uninstall] \hfill \\
Remove the theme from your local texmf folder.
\item[sty] \hfill \\
Build the manual.
\item[manual] \hfill \\
Build the manual.
Creat the package files.
\item[doc] \hfill \\
Build the documentation.
\item[demo] \hfill \\
Build the demo presentation.
\item[demo-min] \hfill \\
Build the minimal demo presentation.
\item[ctan] \hfill \\
Create a package for CTAN distribution.
\end{description}
@ -196,37 +198,56 @@ The theme provides a number of options. The options use a key=value interface.
So every option is controlled by a key its value. To use an option you can
either provide a comma separated list of options when invoking
\textsc{mtheme} in the preamble of the presentation.
\begin{lstlisting}[numbers=none]
\begin{lstlisting}
\usetheme[<key=value list>]{m}
\end{lstlisting}
Or you can set them at any time with the |\metropolisset| macro.
\begin{lstlisting}[numbers=none]
\begin{lstlisting}
\metropolisset[<key=value list>]
\end{lstlisting}
To set an option on a specific sub-package only you have to add the
corresponding prefix (inner, outer, color), e.g.
\begin{lstlisting}[numbers=none]
\begin{lstlisting}
\metropolisset[inner/block=fill]
\end{lstlisting}
The following list of options is structured as shown in the following example.
The list of options is structured as shown in the following example.
\DescribeOption{key}{list of possible values}{default value}{
A short description of the option.
}
Although the options are grouped into the corresponding sub-packages every
option can and in most cases should be set on the main theme directly. If an
option is listed in multiple themes, setting it on the main theme will set the
option on every sub-package.
Although the options are grouped into the corresponding packages every option
can and in most cases should be set on the main theme directly. If an option
is listed in multiple sub-packages, setting it on the main theme will set the
option on every sub-package accordingly.
\subsubsection{Main theme}
\DescribeOption{everytitleformat}{regular, lowercase, uppercase}{lowercase}{
Shortcut option to change the case style of all titles together.
}
\DescribeOption{plainformat}{regular, lowercase, uppercase}{lowercase}{
Control the case style of the plain title.
}
\subsubsection{Inner theme}
\DescribeOption{block}{transparent, fill}{transparent}{
This option controls the block background. It can either be filled with a
light grey or be transparent.
}
\DescribeOption{sectionpage}{none, progressbar}{progressbar}{
Adds a thin progress bar similar to the section progress bar underneath each frame title.
}
\DescribeOption{titleformat}{regular, lowercase, uppercase}{lowercase}{
Control the case style of the title.
}
\DescribeOption{sectiontitleformat}{regular, lowercase, uppercase}{lowercase}{
Control the case style of the section title.
}
\subsubsection{Outer theme}
\DescribeOption{numbering}{none, counter, fraction}{counter}{
In the bottom right corner of each frame the current frame number is
@ -239,27 +260,32 @@ option on every sub-package.
progress bar underneath each frame title.
}
\DescribeOption{frametitleformat}{regular, lowercase, uppercase}{lowercase}{
Control the case style of the frame title.
}
\DescribeOption{frametitleoffset\\noframetitleoffset}{<dimension>}{2em}{
The frametitle offset is an additional vertical space after the frame title
to center the content vertically on the frame. To remove this space entirely
the short option |noframetitleoffset| is defined.
}
\subsubsection{Color theme}
\DescribeOption{block}{transparent, fill}{transparent}{
This option controls the block background. It can either be filled with a
light grey or be transparent.
}
\DescribeOption{background}{dark, light}{light}{
This option defines whether the background shall be dark and the foreground
be light or vice versa.
}
\subsection{Color Customization}
The included metropolis color theme is used by default, but its colors can be
easily changed to suit your tastes. All of the theme's styles are defined in
terms of three beamer colors:
The included \textsc{metropolis} color theme is used by default, but its
colors can be easily changed to suit your tastes. All of the theme's styles
are defined in terms of three beamer colors:
\begin{itemize}
\item |normal text| (dark fg, light bg)
\item |alerted text| (colored fg, should be visible against dark or light)
@ -267,38 +293,26 @@ terms of three beamer colors:
\end{itemize}
An easy way to customize the theme is to redefine these colors using
\begin{lstlisting}[numbers=none]
\begin{lstlisting}
\setbeamercolor{ ... }{ fg= ... , bg= ... }
\end{lstlisting}
in your preamble. For greater customization, you can redefine any of the other
colors in |beamercolorthememetropolis|, including progress bar.
\subsection{Title Case Formatting}
The main title, section titles, frame titles and plain frame titles are all
formatted according to the custom command |\@metropolis@titleformat|. By default,
this is equivalent to |\MakeLowercase{#1}|, hence seting the titles in small
capitals. You can change this behaviour in your preamble. For example:
stock beamer colors. In addition to the stock colors the theme defines a number
of \textsc{metropolis} specific colors, which can also be redefined to your
liking.
\begin{lstlisting}
% camel case
\renewcommand{\@metropolis@titleformat}{}
% lowercase
\renewcommand{\@metropolis@titleformat}\MakeLowercase}
% uppercase
\renewcommand{\@metropolis@titleformat}{\MakeUppercase}
\setbeamercolor{progress bar}{ ... }
\setbeamercolor{title separator}{ ... }
\setbeamercolor{progress bar in head/foot}{ ... }
\setbeamercolor{progress bar in section page}{ ... }
\end{lstlisting}
Be aware that these formatting macros will be replaced with theme options in
the future.
\subsection{Commands}
The |\plain{title=[]}{<body>}| command sets a slide in plain dark colors which
can be useful to focus attention on a single sentence or image.
\subsection{Paul Tol's colors: a \texttt{pgfplots} theme}
A good presentation uses colors that are

Binary file not shown.

View File

@ -30,7 +30,7 @@
%<*package>
% ------------------------------------------------------------------------- \fi
%
% \section{Implementation: Tol \texttt{pgfplots} theme}
% \subsection{Tol \texttt{pgfplots} theme}
%
% Paul Tol's 12-color palette\footnote{Tol actually describes several
% palettes; these colours are taken from the bottom row of Figure 3 in his