Merge pull request #96 from benjamin-weiss/new-makeuppercase-implementation

New frame title format implementation
This commit is contained in:
Matthias Vogelgesang 2015-06-22 17:00:23 +02:00
commit a00878e3a4
9 changed files with 125 additions and 91 deletions

View File

@ -50,14 +50,14 @@
% Font Assignment
%
% \begin{macrocode}
\setbeamerfont{title}{family=\Book, size=\Large}
\setbeamerfont{title}{family=\Book, size=\Large, shape=\scshape}
\setbeamerfont{author}{family=\ExtraLight, size=\small}
\setbeamerfont{date}{family=\ExtraLight, size=\small}
\setbeamerfont{section title}{family=\Book, size=\Large}
\setbeamerfont{section title}{family=\Book, size=\Large, shape=\scshape}
\setbeamerfont{block title}{family=\Book, size=\normalsize}
\setbeamerfont{block title alerted}{family=\Book,size=\normalsize}
\setbeamerfont{subtitle}{family=\Light, size=\fontsize{12}{14}}
\setbeamerfont{frametitle}{family=\Book, size=\large}
\setbeamerfont{frametitle}{family=\Book, size=\large, shape=\scshape}
\setbeamerfont{caption}{size=\small}
\setbeamerfont{caption name}{family=\Book}
\setbeamerfont{description item}{family=\Book}

View File

@ -40,16 +40,6 @@
% \item footnotes and plain text.
% \end{itemize}
%
%
%
% This customization will be changed in a future update.
%
% \begin{macrocode}
\def\mthemetitleformat{\scshape\MakeLowercase}
% \end{macrocode}
%
%
%
% \subsection{Title page}
%
% \begin{macro}{title page}
@ -200,7 +190,7 @@
\begin{minipage}{22em}
\usebeamercolor[fg]{section title}
\usebeamerfont{section title}
\insertsectionHEAD\\[-1ex]
\insertsectionhead\\[-1ex]
\usebeamertemplate*{progress bar in section page}
\end{minipage}
\par
@ -215,17 +205,6 @@
}
\fi
% \end{macrocode}
%
% To give users the option to \MakeUppercase or \MakeLowercase the section
% title, we need to expand |\insertsectionhead| before applying the relevant
% formatting command. This solution was suggested by Enrico Gregorio in an
% answer to \href{http://tex.stackexchange.com/questions/112526/}{this
% StackExchange question}.
%
% \begin{macrocode}
\providecommand{\insertsectionHEAD}{\expandafter\formatsectionhead\insertsectionhead}
\providecommand{\formatsectionhead}[3]{#1{#2}{\mthemetitleformat{#3}}}
% \end{macrocode}
% \end{macro}
%
% \begin{macro}{progress bar in section page}

View File

@ -95,11 +95,7 @@
ht=2.5ex,
dp=1.5ex
]{frametitle}
\if@protectFrameTitle%
\mthemetitleformat{\protect\insertframetitle}%
\else%
\mthemetitleformat{\insertframetitle}%
\fi%
\insertframetitle%
\end{beamercolorbox}%
\if@useTitleProgressBar
\nointerlineskip

View File

@ -74,16 +74,6 @@
}
% \end{macrocode}
%
% protectframetitle
%
% \begin{macrocode}
\newif\if@protectFrameTitle
\@protectFrameTitlefalse
\DeclareOptionBeamer{protectframetitle}{
\@protectFrameTitletrue
}
% \end{macrocode}
%
% nooffset
%
% \begin{macrocode}
@ -121,13 +111,6 @@
\ProcessOptionsBeamer
% \end{macrocode}
%
% mthemetitleformat
%
% \begin{macro}{\mthemetitleformat}
% \begin{macrocode}
\def\mthemetitleformat#1{\scshape #1}
% \end{macrocode}
% \end{macro}
% \subsection{Component sub-packages}
%
% Having processed the options, we can now load the component sub-packages of
@ -163,12 +146,57 @@
}
% \end{macrocode}
%
%
%
% \subsection{Custom commands}
%
% We define custom commands in this package as their proper usage may depend
% depend on multiple sub-packages.
% on multiple sub-packages.
%
% \begin{macro}{\mthemetitleformat}
% \begin{macro}{\mthemesectiontitleformat}
% \begin{macro}{\mthemeframetitleformat}
% \begin{macro}{\mthemeplaintitleformat}
% Creates hooks to change the case format of the four different titles.
% \begin{macrocode}
\def\mthemetitleformat#1{\MakeLowercase{#1}}
\def\mthemesectiontitleformat#1{\mthemetitleformat{#1}}
\def\mthemeframetitleformat#1{\mthemetitleformat{#1}}
\def\mthemeplaintitleformat#1{\mthemetitleformat{#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{\mthemesectiontitleformat{#2}}}
{}{}
\patchcmd{\beamer@section}
{\def\insertsectionhead{\hyperlink{Navigation\the\c@page}{#1}}}
{\def\insertsectionhead{\hyperlink{Navigation\the\c@page}{\mthemesectiontitleformat{#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{{\mthemeframetitleformat{#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}
% Creates a plain frame with dark background, suitable for displaying images
@ -183,7 +211,7 @@
\vspace{1em}
\usebeamercolor[fg]{palette primary}
\usebeamerfont{section title}
\mthemetitleformat{#2}
\mthemeplaintitleformat{#2}
\vfill
\end{frame}
\endgroup

43
demo.bib Normal file
View File

@ -0,0 +1,43 @@
@article{Knuth92,
author = "D.E. Knuth",
title = "Two notes on notation",
journal = "Amer. Math. Monthly",
volume = "99",
year = "1992",
pages = "403--422",
}
@book{ConcreteMath,
author = "R.L. Graham and D.E. Knuth and O. Patashnik",
title = "Concrete mathematics",
publisher = "Addison-Wesley",
address = "Reading, MA",
year = "1989"
}
@unpublished{Simpson,
author = "H. Simpson",
title = "Proof of the {R}iemann {H}ypothesis",
note = "preprint (2003), available at
\texttt{http://www.math.drofnats.edu/riemann.ps}",
year = "2003"
}
@incollection{Er01,
author = "P. Erd{\H o}s",
title = "A selection of problems and results in combinatorics",
booktitle = "Recent trends in combinatorics (Matrahaza, 1995)",
publisher = "Cambridge Univ. Press",
address = "Cambridge",
pages = "1--6",
year = "1995"
}
@article{greenwade93,
author = "George D. Greenwade",
title = "The {C}omprehensive {T}ex {A}rchive {N}etwork ({CTAN})",
year = "1993",
journal = "TUGBoat",
volume = "14",
number = "3",
pages = "342--351"
}

BIN
demo.pdf

Binary file not shown.

View File

@ -1,7 +1,6 @@
\documentclass[10pt]{beamer}
\usetheme[usetitleprogressbar]{m}
\renewcommand{\mthemetitleformat}{\scshape\MakeLowercase}
\usetheme{m}
\usepackage{booktabs}
\usepackage[scale=2]{ccicons}
@ -204,21 +203,7 @@ or show \textbf{bold} results.\end{verbatim}
\end{frame}
\begin{frame}{References}
\begin{thebibliography}{10}
\beamertemplatebookbibitems
\bibitem{Oppenheim2009}
Alan~V.~Oppenheim
\newblock Discrete-Time Signal Processing
\newblock Prentice Hall Press, 2009
\newblock Notes nobody is interested in
\beamertemplatearticlebibitems
\bibitem{EBU2011}
European~Broadcasting~Union
\newblock Specification of the Broadcast Wave Format (BWF)
\newblock 2011
\end{thebibliography}
Some references to showcase [allowframebreaks] \cite{knuth92,ConcreteMath,Simpson,Er01,greenwade93}
\end{frame}
\section{Conclusion}
@ -239,4 +224,13 @@ or show \textbf{bold} results.\end{verbatim}
\plain{Questions?}
\begin{frame}[allowframebreaks]
\frametitle{References}
\bibliography{demo}
\bibliographystyle{abbrv}
\end{frame}
\end{document}

View File

@ -140,10 +140,10 @@ computer. The complete list of make rules is as follows:
Depending on the Linux distribution, the packaged name of |Fira Sans| might be
|Fira Sans OT| instead of |Fira Sans|. In that case, you may have to edit
|beamerfontthememetropolis.dtx|. You may also need to install Fira Sans; see the
|contrib/| directory for more. Users of Debian or Ubuntu can also install this
\href{https://launchpad.net/\%7Eedd/+archive/ubuntu/misc/+files/latex-mtheme_0.1.0vidid1_all.deb}{.deb
package} containing the theme files as well as the Fira Sans font files.
|beamerfontthememetropolis.dtx|. You may also need to install Fira Sans; see
the |contrib/| directory for more. Users of Debian or Ubuntu can also install
this \href{https://launchpad.net/\%7Eedd/+archive/ubuntu/misc/+files/latex-mtheme_0.1.0vidid1_all.deb}{.deb package} containing the theme files as well
as the Fira Sans font files.
\subsection{Pandoc}
@ -158,8 +158,8 @@ $ pandoc -t beamer --latex-engine=xelatex -V theme:m -o output.pdf input.md
\subsection{A Minimal Example}
To get started with the theme is very simple. The following code shows a minimal
example of a Beamer presentation using the \textsc{mtheme}.
To get started with the theme is very simple. The following code shows a
minimal example of a Beamer presentation using the \textsc{mtheme}.
\begin{lstlisting}
\documentclass[10pt]{beamer}
@ -192,10 +192,6 @@ them when invoking \textsc{mtheme} in the preamble of the slides, i.e.
Adds a thin progress bar similar to the section progress bar underneath each
frame title.\\
\noindent\DescribeMacro{protectframetitle}
In order to use |\cite|, |\ref| and similar commands in a frame title you have
to protect the title. This can be done automatically with this option.\\
\noindent\DescribeMacro{blockbg}
Adds background color to the blocks similar to other beamer themes.\\
@ -239,26 +235,24 @@ in your preamble. For greater customization, you can redefine any of the other
colors in |beamercolorthememetropolis|, including progress bar.
\subsection{Title Formatting}
\subsection{Title Case Formatting}
The main title, section titles, and frame titles are all formatted according to
the custom command |\mthemetitleformat|. By default, this is equivalent to
|\scshape| and sets the titles in small capitals, but you can change it in your
preamble. For example:
The main title, section titles, frame titles and plain frame titles are all
formatted according to the custom command |\mthemetitleformat|. 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:
\begin{lstlisting}
% no small capitals
% camel case
\renewcommand{\mthemetitleformat}{}
% all small capitals
\renewcommand{\mthemetitleformat}{\scshape\MakeLowercase}
% all capitals
% lowercase
\renewcommand{\mthemetitleformat}\MakeLowercase}
% uppercase
\renewcommand{\mthemetitleformat}{\MakeUppercase}
\end{lstlisting}
Note that |\MakeLowercase| and |\MakeUppercase| can have unexpected behaviour in
math mode, are disabled when |protectframetitle| is used, and cause crashes when
an unprotected frametitle appears on a slide with |allowframebreaks|.
Be aware that these formatting macros will be replaced with theme options in
the future.
\subsection{Commands}

Binary file not shown.