diff options
author | Karl Berry <karl@freefriends.org> | 2021-04-14 20:06:10 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2021-04-14 20:06:10 +0000 |
commit | 72c53c389c8fe1a5ace9910e0ef123a4e4384232 (patch) | |
tree | 483b0c063537539091805a9f7e631b3c3547dd9b /Master/texmf-dist/source/latex | |
parent | 83af909e5ead1dbdc0cf1b80399aa84fc1e31d36 (diff) |
beamerswitch (14apr21)
git-svn-id: svn://tug.org/texlive/trunk@58873 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/source/latex')
-rw-r--r-- | Master/texmf-dist/source/latex/beamerswitch/beamerswitch.dtx | 243 |
1 files changed, 173 insertions, 70 deletions
diff --git a/Master/texmf-dist/source/latex/beamerswitch/beamerswitch.dtx b/Master/texmf-dist/source/latex/beamerswitch/beamerswitch.dtx index e8a6919c147..ee8b3498eeb 100644 --- a/Master/texmf-dist/source/latex/beamerswitch/beamerswitch.dtx +++ b/Master/texmf-dist/source/latex/beamerswitch/beamerswitch.dtx @@ -93,7 +93,7 @@ first three steps. ## Licence -Copyright 2016–2020 Alex Ball. +Copyright 2016–2021 Alex Ball. This work consists of the file beamerswitch.dtx and a Makefile. @@ -106,9 +106,10 @@ This work is "maintained" (as per LPPL maintenance status) by %</readme> %<*example> -\PassOptionsToClass{a4paper,12pt}{article} -\PassOptionsToClass{14pt}{beamer} -\documentclass[also={trans,handout,article}]{beamerswitch} +\documentclass[% + beameroptions={ignorenonframetext,14pt}, + articleoptions={a4paper,12pt}, + also={trans,handout,article}]{beamerswitch} \handoutlayout{nup=3plus,border=1pt} \articlelayout{maketitle,frametitles=none} \usepackage[british]{babel} @@ -125,8 +126,8 @@ This work is "maintained" (as per LPPL maintenance status) by \title{A demonstration of the \textsf{beamerswitch} class} \subtitle{Testing features} -\author{Alex Ball} -\institute{University of Life} +\author{Alex Ball\inst{1}} +\institute{\inst{1}University of Life} \date{1 September 2016} \subject{A LaTeX class} \keywords{CTAN, literate programming} @@ -193,7 +194,7 @@ See: http://www.latex-project.org/lppl.txt \endpreamble \postamble -Copyright (C) 2016-2020 by Alex Ball <ab318@bath.ac.uk> +Copyright (C) 2016-2021 by Alex Ball <ab318@bath.ac.uk> \endpostamble \usedir{tex/latex/\jobname} @@ -228,7 +229,7 @@ Copyright (C) 2016-2020 by Alex Ball <ab318@bath.ac.uk> %<class>\NeedsTeXFormat{LaTeX2e}[1999/12/01] %<class>\ProvidesClass{beamerswitch} %<*class> - [2020/06/06 v1.7 Convenient mode selection in Beamer documents] + [2021/04/12 v1.8 Convenient mode selection in Beamer documents] %</class> %<*driver> \documentclass[12pt]{article} @@ -296,7 +297,7 @@ Copyright (C) 2016-2020 by Alex Ball <ab318@bath.ac.uk> \egroup } \makeatother -\tcbuselibrary{documentation,breakable,minted} +\tcbuselibrary{documentation,breakable,minted,raster} \colorlet{Option}{violet} \colorlet{Command}{red!75!black} \colorlet{Environment}{blue!75!black} @@ -311,6 +312,13 @@ Copyright (C) 2016-2020 by Alex Ball <ab318@bath.ac.uk> , numbersep=20pt , firstnumber=last } + , documentation minted options= + { breaklines + , fontsize=\small + , breakbefore=\{\[ + , breakafter=/\}\] + , breakbeforesymbolpre={} + } , index format=pgf , color command=Command , color environment=Environment @@ -381,7 +389,6 @@ Copyright (C) 2016-2020 by Alex Ball <ab318@bath.ac.uk> \index{\MyName@\tcbIndexPrintValCA {\MyName}|)}% } \makeatletter -\def\MY@EQUALS{=}% \newcommand{\resetmintedformat}{% % Comments \expandafter\def\csname PYGdefault@tok@c\endcsname{\let\PYGdefault@it=\textit\def\PYGdefault@tc####1{\textcolor{gray}{####1}}} @@ -525,30 +532,43 @@ If you have an existing \pkg{beamer} presentation and want convert it to use \begin{enumerate} \item - Have you specified class options other than \key{ignorenonframetext}? - If so, start by rewriting your \cs{documentclass} line in terms of - \cs{PassOptionsToClass} -- note that the optional argument (in square - brackets) becomes mandatory (in curly braces): + Replace the class \pkg{beamer} with \pkg{beamerswitch}. - \begin{multicols}{2} + Wrap any class options you have specified in braces and turn them into the + value of the \key{beameroptions} option: + + \begin{tcbraster}[raster equal height=rows] \begin{dispListing*}{title=Before,coltitle=black,fonttitle=\sffamily} \documentclass[10pt]{beamer} \end{dispListing*} - \columnbreak \begin{dispListing*}{title=After,coltitle=black,fonttitle=\sffamily} -\PassOptionsToClass{10pt}{beamer} +\documentclass[beameroptions={10pt}]{beamerswitch} \end{dispListing*} - \end{multicols} + \end{tcbraster} - Then add `\cs{documentclass}\brackets{beamerswitch}' directly below. + If you didn't specify any options, then give \key{beameroptions} a blank + value: - Otherwise, simply replace your \cs{documentclass} line with the - \texttt{beamerswitch} one. + \begin{tcbraster}[raster equal height=rows] +\begin{dispListing*}{title=Before,coltitle=black,fonttitle=\sffamily} +\documentclass{beamer} +\end{dispListing*} +\begin{dispListing*}{title=After,coltitle=black,fonttitle=\sffamily} +\documentclass[beameroptions={}]{beamerswitch} +\end{dispListing*} + \end{tcbraster} -\item - If you did \emph{not} specify \key{ignorenonframetext} as one of your - \pkg{beamer} options, add a `\cs{mode}\texttt{<all>}' line directly after - `\cs{begin}\brackets{document}'. + If you only specified \key{ignorenonframetext}, then you don't + need \key{beameroptions}: + + \begin{tcbraster}[raster equal height=rows] +\begin{dispListing*}{title=Before,coltitle=black,fonttitle=\sffamily} +\documentclass[ignorenonframetext]{beamer} +\end{dispListing*} +\begin{dispListing*}{title=After,coltitle=black,fonttitle=\sffamily} +\documentclass{beamerswitch} +\end{dispListing*} + \end{tcbraster} \item Wrap any preamble content intended only for your slides (like \cs{usetheme} @@ -558,7 +578,7 @@ If you have an existing \pkg{beamer} presentation and want convert it to use In summary, here is an example: -\begin{multicols}{2} +\begin{tcbraster}[raster equal height=rows] \begin{dispListing*}{title=Before,coltitle=black,fonttitle=\sffamily} \documentclass[10pt]{beamer} @@ -567,32 +587,28 @@ In summary, here is an example: \title{Test presentation} \begin{document} - \maketitle \end{document} \end{dispListing*} - \columnbreak \begin{dispListing*}{title=After,coltitle=black,fonttitle=\sffamily} -\PassOptionsToClass{10pt}{beamer} -\documentclass{beamerswitch} +\documentclass[beameroptions={10pt}]{beamerswitch} \mode<presentation>{% \usetheme{metropolis} } \title{Test presentation} \begin{document} -\mode<all> \maketitle \end{document} \end{dispListing*} -\end{multicols} +\end{tcbraster} At this point the document should compile exactly as before. If you intend to use article mode at all, I strongly suggest that you -proceed by converting your document body so it that works without the -`\cs{mode}\texttt{<all>}' line. That means making sure all slide content is in -a \env{frame} environment, new command definitions are moved to the preamble, -and so on. +proceed by converting your document body so it that works with \pkg{beamer}'s +\key{ignorenonframetext} option in place. That means making sure all slide +content is in a \env{frame} environment, new command definitions are moved +to the preamble, and so on. Lastly, read through the rest of this manual and see what \pkg{beamerswitch} can do for you! @@ -705,13 +721,27 @@ The class is loaded in the usual way: The various options are described below. +\subsection{Passing options to the underlying classes} + +\begin{docKey}{articleoptions}{=\marg{options}}{default and initially empty} + Passes the \meta{options} to the \pkg{article} class when in \key{article} + mode. +\end{docKey} + +\begin{docKey}{beameroptions}{=\marg{options}}{default and initially \val{ignorenonframetext}} + Passes the \meta{options} to the \pkg{beamer} class when in \key{beamer}, + \key{handout} or \key{trans} mode. Do not specify \val{handout} or \val{trans} + among the options as \pkg{beamerswitch} handles those for you. Note that the + default behaviour is to pass the \val{ignorenonframetext} option, so remember + to include it yourself if you start specifying other options. +\end{docKey} + + \subsection{Choosing the mode of the current run} The \pkg{beamerswitch} class, as explained above, does not do much itself but rather helps you to switch between \pkg{beamer} modes, specifically -\key{article}, \key{beamer}, \key{trans} and \key{handout}. Note that it loads -\pkg{beamer} with the \key{ignorenonframetext} option, so that text outside -frames is only shown in \key{article} mode. +\key{article}, \key{beamer}, \key{trans} and \key{handout}. The normal way of choosing the mode is to use the respective class options. @@ -856,8 +886,8 @@ If you want to switch to using \texttt{rubber}, say, pre-define \documentclass{beamerswitch} \end{dispListing} -If you don't need the engine selection routine provided, simply pre-define -\cs{BeamerswitchSpawn} to do whatever you need it to do: +If you don't need the engine selection routine provided, you can replace it +by pre-defining \cs{BeamerswitchSpawn} to do whatever you need it to do instead: \begin{dispListing} \newcommand*{\BeamerswitchSpawn}[1]{% @@ -894,13 +924,6 @@ directives: load \pkg{hyperref} yourself at a different point, use this option. \end{docKey} -\pagebreak % TWEAK: may not be needed in future versions -\begin{docKey}{textinst}{}{no value, initially unset} - In all modes, patches the \cs{inst} command so that it prints its argument - using \cs{textsuperscript} instead of a mathematical superscript. This helps - avoid unnecessary font changes. -\end{docKey} - \section{Setting the layout of the handouts} The class provides a simplified interface to the \pkg{pgfpages} package. By @@ -1171,12 +1194,20 @@ preamble. \end{dispListing} \end{docKey} +\begin{docKey}{instbreak}{=\meta{definition}}{no default, initially \cs{linebreak}} + In \key{article} mode, defines how \cs{and} is rendered when + \cs{insertinstitute} is used (such when the \key{maketitle} option is + active). Another good \meta{definition} to use might be \cs{quad}. +\end{docKey} + + \section{Tips for further configuration} There are some other ways to customize the behaviour of the various modes. You can use the standard \LaTeX\ methods for customizing how the \pkg{article} -and \pkg{beamer} classes are loaded: +and \pkg{beamer} classes are loaded, if you don't like the class facilities for +doing this: \begin{dispListing} \PassOptionsToClass{a4paper,11pt}{article} % for article mode @@ -1335,6 +1366,26 @@ suggestions for improvements or new features to the % \end{optionkey} % \end{optionkey} % +% \changes{v1.8}{2021/04/12}{Add \key{beameroptions} option.} +% \begin{optionkey}{beameroptions} +% +% The \key{beameroptions} will passed to the \pkg{beamer} class. +% +% \begin{macrocode} +\define@cmdkey[DC]{beamerswitch}{beameroptions}[ignorenonframetext]{} +% \end{macrocode} +% \end{optionkey} +% +% \changes{v1.8}{2021/04/12}{Add \key{articleoptions} option.} +% \begin{optionkey}{articleoptions} +% +% The \key{articleoptions} will passed to the \pkg{article} class. +% +% \begin{macrocode} +\define@cmdkey[DC]{beamerswitch}{articleoptions}[]{} +% \end{macrocode} +% \end{optionkey} +% % \begin{optionkey}{nohyperref} % The \key{nohyperref} option stops the class from loading the \pkg{hyperref} % package in article mode. @@ -1344,9 +1395,10 @@ suggestions for improvements or new features to the % \end{macrocode} % \end{optionkey} % +% \changes{v1.8}{2021/04/12}{Deprecate redundant \key{textinst} option.} % \begin{optionkey}{textinst} -% The \key{textinst} option adjusts the superscript used for institution -% markers. +% The \key{textinst} option enforces \cs{textsuperscript} for institution +% markers. Recent versions of \pkg{beamer} do this by default. % % \begin{macrocode} \define@boolkey[DC]{beamerswitch}{textinst}[true]{} @@ -1357,7 +1409,7 @@ suggestions for improvements or new features to the % % \begin{macrocode} \setkeys[DC]{beamerswitch}{beamer=true,alsobeamer=false,alsotrans=false,% - alsohandout=false,alsoarticle=false} + alsohandout=false,alsoarticle=false,beameroptions,articleoptions} % \end{macrocode} % % Now we process the options given by the user. @@ -1481,12 +1533,27 @@ suggestions for improvements or new features to the % For article mode, we load the \pkg{article} class and the \pkg{beamerarticle} % support package. Apologies for anyone hoping for \pkg{scrartcl} or % \pkg{memoir} alternatives. +% \begin{macro}{beamer@insttitle} +% \begin{macro}{beamer@andtitle} +% \begin{macro}{beamer@instinst} +% \begin{macro}{beamer@andinst} +% We also add some beamer base macros that are needed for the +%\cs{insertinstitute} command. % % \begin{macrocode} \ifbool{DC@beamerswitch@article}{% + \PassOptionsToClass{\cmdDC@beamerswitch@articleoptions}{article} \LoadClass{article} \RequirePackage{beamerarticle} + \def\beamer@insttitle#1{\textsuperscript{#1}} + \def\beamer@andtitle{\quad} + \def\beamer@instinst#1{\textsuperscript{#1}\ignorespaces} + \def\beamer@andinst{\linebreak} % \end{macrocode} +% \end{macro} +% \end{macro} +% \end{macro} +% \end{macro} % % It seems as though \pkg{beamerarticle} expects \pkg{hyperref} to be loaded, % but doesn't actually do it itself. So we oblige, using the default options @@ -1532,7 +1599,8 @@ suggestions for improvements or new features to the % % \begin{macrocode} \ifbool{DC@beamerswitch@handout}{% - \LoadClass[ignorenonframetext,handout]{beamer} + \PassOptionsToClass{\cmdDC@beamerswitch@beameroptions}{beamer} + \LoadClass[handout]{beamer} % \end{macrocode} % % Handout mode lays multiple slides out on a single page. For this we use @@ -1547,9 +1615,11 @@ suggestions for improvements or new features to the % \begin{macrocode} }{% \ifbool{DC@beamerswitch@trans}{% - \LoadClass[ignorenonframetext,trans]{beamer} + \PassOptionsToClass{\cmdDC@beamerswitch@beameroptions}{beamer} + \LoadClass[trans]{beamer} }{% - \LoadClass[ignorenonframetext]{beamer} + \PassOptionsToClass{\cmdDC@beamerswitch@beameroptions}{beamer} + \LoadClass{beamer} }% } } @@ -1557,8 +1627,10 @@ suggestions for improvements or new features to the % % \subsection{Mode-independent layout} % +% \begin{macro}{beamer@insttitle} +% \begin{macro}{beamer@instinst} % We implement the option that formats institution markers in text mode rather -% than math mode. +% than math mode in older versions of \pkg{beamer}. % % \begin{macrocode} \ifbool{DC@beamerswitch@textinst}{% @@ -1566,7 +1638,10 @@ suggestions for improvements or new features to the \def\beamer@instinst#1{\textsuperscript{#1}\ignorespaces} }{} % \end{macrocode} +% \end{macro} +% \end{macro} % +% \begin{macro}{handoutlayout} % \subsection{Handout layout} % % \begin{optionkey}{paper} @@ -1594,8 +1669,8 @@ suggestions for improvements or new features to the % \begin{optionvalue}{4plus} % \begin{optionvalue}{6} % \begin{optionvalue}{8} -% \changes{v1.7}{2020/06/06}{Add \key{nup}\string\MY@EQUALS\val{1} option.} -% \changes{v1.7}{2020/06/06}{Add \key{nup}\string\MY@EQUALS\val{1plus} option.} +% \changes{v1.7}{2020/06/06}{Add \key{nup}!=\val{1} option.} +% \changes{v1.7}{2020/06/06}{Add \key{nup}!=\val{1plus} option.} % The \key{nup} option specifies how many slides to include per page. % The `plus' keyword indicates a layout with additional gaps for writing. % @@ -1656,7 +1731,7 @@ suggestions for improvements or new features to the % \end{optionkey} % % \begin{optionkey}{margin} -% \changes{v1.4}{2018/08/29}{Make margins around slides a configurable size} +% \changes{v1.4}{2018/08/29}{Make margins around slides a configurable size.} % \begin{macro}{beamerswitch@margin} % The \key{margin} option controls how much white space is added around each % slide on handout pages. It corresponds to the \texttt{border shrink} option @@ -1711,7 +1786,6 @@ suggestions for improvements or new features to the % \end{macrocode} % \end{macro} % -% \begin{macro}{handoutlayout} % \begin{macro}{beamerswitch@pnoadjust} % We set up the \cs{handoutlayout} command for applying these options. % @@ -2808,6 +2882,7 @@ suggestions for improvements or new features to the } % \end{macrocode} % +% \begin{macro}{articlelayout} % \subsection{Article layout} % % We provide some options for configuring the appearance of article mode. @@ -2834,7 +2909,7 @@ suggestions for improvements or new features to the % \end{macrocode} % % \begin{macro}{bsw@punct@test} -% \changes{v1.6.1}{2020/01/20}{Update expl3 syntax} +% \changes{v1.6.1}{2020/01/20}{Update expl3 syntax.} % Of course, we would rather not bother the user with this, so we introduce a % command for testing the title for final punctuation. % @@ -2916,7 +2991,20 @@ suggestions for improvements or new features to the % \end{optionvalue} % \end{optionkey} % -% \begin{macro}{articlelayout} +% \changes{v1.8}{2021/04/12}{Add \key{instbreak} option.} +% \begin{optionkey}{instbreak} +% \begin{macro}{beamerswitch@andinst} +% We offer an easy way of customizing how institutes are strung together. +% +% \begin{macrocode} +\let\beamerswitch@andinst\beamer@andinst +\define@key[AL]{beamerswitch}{instbreak}{% + \def\beamerswitch@andinst{#1}% +} +% \end{macrocode} +% \end{macro} +% \end{optionkey} +% % We provide a command for setting these options. % % \begin{macrocode} @@ -2943,10 +3031,10 @@ suggestions for improvements or new features to the \ifcsstring{beamerswitch@articleframetitles}{margin}{% \setbeamertemplate{frametitle}{% \marginpar[% - \raggedleft\noindent\emshape\textbf{\insertframetitle}\par + \raggedleft\noindent\itshape\textbf{\insertframetitle}\par \noindent\insertframesubtitle\par ]{% - \raggedright\noindent\emshape\textbf{\insertframetitle}\par + \raggedright\noindent\itshape\textbf{\insertframetitle}\par \noindent\insertframesubtitle\par }% } @@ -2964,6 +3052,12 @@ suggestions for improvements or new features to the % \end{optionvalue} % \end{optionvalue} % +% This is where the \key{instbreak} option takes effect. +% +% \begin{macrocode} + \let\beamer@andinst\beamerswitch@andinst +% \end{macrocode} +% % This is where we make our adjustments to \cs{maketitle}. We start by joining % the subtitle to the title by means of a colon instead of a newline. % @@ -2978,10 +3072,12 @@ suggestions for improvements or new features to the % % \begin{macrocode} \ifundef{\beamer@originstitute}{% - \renewcommand{\institute}[2][]{\def\insertinstitute{##2}}% + \renewcommand{\institute}[2][]{% + \def\insertinstitute{\def\inst{\beamer@instinst}\def\and{\beamer@andinst}##2}}% }{% \renewcommand{\institute}[2][]{% - \def\insertinstitute{##2}\beamer@originstitute{##2}}% + \def\insertinstitute{\def\inst{\beamer@instinst}\def\and{\beamer@andinst}##2}% + \beamer@originstitute{##2}}% }% % \end{macrocode} % @@ -2999,21 +3095,28 @@ suggestions for improvements or new features to the \vskip 1.5em% {% \large\lineskip .5em% +% \end{macrocode} +% +% \changes{v1.8}{2021/04/12}{Ensure proper rendering of \cs{inst} and \cs{and} +% in \cs{author}.} +% The second is to add the beamer definitions for \cs{inst} and \cs{and} in the +% author row. +% +% \begin{macrocode} \begin{tabular}[t]{c}% + \def\inst{\beamer@insttitle}\def\and{\beamer@andtitle}% \@author \end{tabular}\par }% % \end{macrocode} % -% The other is to add in a row for the institute information. +% The third is to add in a row for the institute information. % % \begin{macrocode} \ifdefvoid{\insertinstitute}{}{% {% \normalsize\lineskip .5em% - \begin{tabular}[t]{c}% - \insertinstitute - \end{tabular}\par + \insertinstitute\par }% }% \vskip 1em% |