From c907c434b2299f59f1ecf40cb208ad2e9e8e5bc5 Mon Sep 17 00:00:00 2001 From: Benno2000 Date: Wed, 28 Feb 2024 21:43:18 +0100 Subject: [PATCH 1/2] rename mycolumns enviroment and adapt demo-slides --- demo-slides/demoSlides.tex | 74 +++++++++++++++++++------------------- fancybeamer.sty | 8 ++--- 2 files changed, 41 insertions(+), 41 deletions(-) diff --git a/demo-slides/demoSlides.tex b/demo-slides/demoSlides.tex index 58596c5..9d2f084 100644 --- a/demo-slides/demoSlides.tex +++ b/demo-slides/demoSlides.tex @@ -35,7 +35,7 @@ \subsection{Lists and Numbered Lists} \begin{frame}{\insertsubsection} - \begin{mycolumns} + \begin{fancycolumns} Lists can be nested to a depth of three: \begin{itemize} \item Item on the first level @@ -63,14 +63,14 @@ \end{enumerate} \end{enumerate} \end{enumerate} - \end{mycolumns} + \end{fancycolumns} \end{frame} \subsection{Colored Boxes} \begin{frame}{\insertsubsection} Normal versions: - \begin{mycolumns}[columns=3] - \begin{definition}{A {\color{orange} Definition}} + \begin{fancycolumns}[columns=3] + \begin{definition}{A Definition} This is a definition. \end{definition} \mynextcolumn @@ -81,10 +81,10 @@ \begin{note}{A {\color{red} Note}} This is a note. \end{note} - \end{mycolumns} + \end{fancycolumns} \vfill Versions without captions: - \begin{mycolumns}[columns=3] + \begin{fancycolumns}[columns=3] \begin{definition}{} This is a {\color{orange} definition}. \end{definition} @@ -96,10 +96,10 @@ \begin{note}{} This is a {\color{red} note}. \end{note} - \end{mycolumns} + \end{fancycolumns} \vfill - Tight versions with {\color{green} white background} (e.g., for use with pictures): - \begin{mycolumns}[columns=3] + Tight versions with white background (e.g., for use with pictures): + \begin{fancycolumns}[columns=3] \begin{definitiontight}{A Definition} \centering\includegraphics[width=.75\linewidth]{example-image} \end{definitiontight} @@ -111,12 +111,12 @@ \begin{notetight}{A Note} \centering\includegraphics[width=.75\linewidth]{example-image} \end{notetight} - \end{mycolumns} + \end{fancycolumns} \end{frame} {\MakeNewBox{amazing}{purple} \begin{frame}{Create New and Modify Existing Boxes} - \begin{mycolumns} + \begin{fancycolumns} \begin{amazing}{An Amazing Box} You can create new boxes with \texttt{\textbackslash MakeNewBox\{name\}\{color\}} (which will check if any of the new box commands is already taken) or \texttt{\textbackslash DeclareBox\{name\}\{color\}} (which may overwrite existing commands). This box was created by \texttt{\textbackslash MakeNewBox\{amazing\}\{purple\}}. \end{amazing} @@ -129,7 +129,7 @@ \begin{definition}{Another Definition} This definition appears outside of the group, so \texttt{\textbackslash UpdateBoxColor\{definition\}\{teal\}} is no longer active. \end{definition} - \end{mycolumns} + \end{fancycolumns} \end{frame} } @@ -158,7 +158,7 @@ \subsection{Automatic Dark-Mode for Pictures} \begin{frame}{\insertsubsection} - \begin{mycolumns} + \begin{fancycolumns} \begin{notetight}{Normal Image with \texttt{\textbackslash pic}} \centering \pic[width=.7\textwidth]{example-image} @@ -168,7 +168,7 @@ \centering \picDark[width=.7\textwidth]{example-image.jpg} % does only work for bitmap images so far \end{notetight} - \end{mycolumns} + \end{fancycolumns} \begin{note}{Explanation} Using \texttt{\textbackslash picDark} instead of \texttt{\textbackslash pic}, the dark version of an image that is saved as \texttt{-dark} automatically gets used when dark-mode is enabled. @@ -180,7 +180,7 @@ \subsection{Multiple Columns} \begin{frame}{\insertsubsection} - \begin{mycolumns}[columns=4] % default: 2 columns + \begin{fancycolumns}[columns=4] % default: 2 columns This is an example text that is shown in the \textbf{first column}. \mynextcolumn This is an example text that is shown in the \textbf{second column}. @@ -188,7 +188,7 @@ This is an example text that is shown in the \textbf{third column}. \mynextcolumn This is an example text that is shown in the \textbf{last column}. - \end{mycolumns} + \end{fancycolumns} \vfill \begin{note}{Explanation} Columns are separated by the command \texttt{\textbackslash mynextcolumn}. @@ -199,7 +199,7 @@ \subsection{Columns with Custom Width} \begin{frame}{\insertsubsection} - \begin{mycolumns}[columns=3,widths={20,30}] + \begin{fancycolumns}[columns=3,widths={20,30}] \begin{example}{} The \textbf{first column} takes 20\,\% of the width of the slide. \end{example} @@ -211,7 +211,7 @@ \begin{example}{} The \textbf{third column} takes the remaining 50\,\% of the width of the slide. \end{example} - \end{mycolumns} + \end{fancycolumns} \vfill \begin{note}{Explanation} The widths of the single columns can also be manually specified by a list of percentages given to the option \texttt{widths}. @@ -222,7 +222,7 @@ \subsection{Columns with Custom Height} \begin{frame}{\insertsubsection} - \begin{mycolumns}[height=6cm] + \begin{fancycolumns}[height=6cm] \begin{example}{} This is the content of the first column. \end{example} @@ -234,16 +234,16 @@ This is the content of the second column. It is too high and would make the first column move downwards without additional options. \vspace{80mm} \end{example} - \end{mycolumns} + \end{fancycolumns} \end{frame} \subsection{Nested Columns} \begin{frame}{\insertsubsection} - \begin{mycolumns}[T] + \begin{fancycolumns}[T] \begin{example}{} This is the content of the first column. \end{example} - \begin{mycolumns}[columns=4] + \begin{fancycolumns}[columns=4] \mynote{}{1.1} \mynextcolumn \mynote{}{1.2} @@ -251,35 +251,35 @@ \mynote{}{1.3} \mynextcolumn \mynote{}{1.4} - \end{mycolumns} + \end{fancycolumns} \mynextcolumn \begin{example}{} A column on the right side \end{example} - \begin{mycolumns}[T] + \begin{fancycolumns}[T] \mynote{}{2.1} - \begin{mycolumns}[columns=3] + \begin{fancycolumns}[columns=3] \mynote{}{2.1.1} \mynextcolumn \mynote{}{2.1.2} \mynextcolumn \mynote{}{2.1.3} - \end{mycolumns} + \end{fancycolumns} \mynextcolumn \mynote{}{2.2} - \end{mycolumns} - \end{mycolumns} + \end{fancycolumns} + \end{fancycolumns} \end{frame} \subsection{Column Animations} \begin{frame}{\insertsubsection\ -- Option keep} - \begin{mycolumns}[columns=3,keep] % short for animation=keep + \begin{fancycolumns}[columns=3,keep] % short for animation=keep This is an example text that is shown in the \textbf{first column}. \mynextcolumn This is an example text that is shown in the \textbf{second column}. \mynextcolumn This is an example text that is shown in the \textbf{third column}. - \end{mycolumns} + \end{fancycolumns} \vfill \begin{note}{Explanation} The option \texttt{keep} (short for \texttt{animation=keep}) introduces an animation which lets the columns appear one after another. @@ -291,13 +291,13 @@ \end{frame} \begin{frame}{\insertsubsection\ -- Option forget} - \begin{mycolumns}[columns=3,forget] % short for animation=forget + \begin{fancycolumns}[columns=3,forget] % short for animation=forget This is an example text that is shown in the \textbf{first column}. \mynextcolumn This is an example text that is shown in the \textbf{second column}. \mynextcolumn This is an example text that is shown in the \textbf{third column}. - \end{mycolumns} + \end{fancycolumns} \vfill \begin{note}{Explanation} The option \texttt{forget} (short for \texttt{animation=forget}) introduces an animation which lets the columns appear one after another. @@ -309,23 +309,23 @@ \end{frame} \begin{frame}{\insertsubsection\ -- Option animation=none} - \begin{mycolumns}[columns=3,animation=none] + \begin{fancycolumns}[columns=3,animation=none] This is an example text that is shown in the \textbf{first column}. \mynextcolumn This is an example text that is shown in the \textbf{second column}. \mynextcolumn This is an example text that is shown in the \textbf{third column}. - \end{mycolumns} + \end{fancycolumns} \vfill \begin{note}{Explanation} The option \texttt{animation=none} deactivates the animation of the columns. - In the template, this is the default. However, you can overwrite the defaults to animate all slides easily (see \texttt{setmycolumnsdefault} in the source code). Then, it might be necessary to deactivate those animations for some slides. + In the template, this is the default. However, you can overwrite the defaults to animate all slides easily (see \texttt{setfancycolumnsdefault} in the source code). Then, it might be necessary to deactivate those animations for some slides. \end{note} \end{frame} \begin{frame}[label=current]{\insertsubsection\ -- Option reverse} - \begin{mycolumns}[columns=4,forget,reverse,b] + \begin{fancycolumns}[columns=4,forget,reverse,b] \pic[width=\linewidth]{example-image}\\[0mm]~ \mynextcolumn \pic[width=\linewidth]{example-image}\\[5mm]~ @@ -333,7 +333,7 @@ \pic[width=\linewidth]{example-image}\\[10mm]~ \mynextcolumn \pic[width=\linewidth]{example-image}\\[15mm]~ - \end{mycolumns} + \end{fancycolumns} \begin{note}{Explanation} The option \texttt{reverse} inverts the order of any animation that is specified (i.e., using \texttt{keep} or \texttt{forget}). \end{note} diff --git a/fancybeamer.sty b/fancybeamer.sty index e129563..1bb9019 100644 --- a/fancybeamer.sty +++ b/fancybeamer.sty @@ -373,7 +373,7 @@ \newdimen\fancy@cols@height % holds the target height of the columns environment (negative for auto) \def\fancy@cols@widths@max{100} % the maximum number to be used for widths -% with this, we define the keys that are usable within the optional argument of '\mycolumns' +% with this, we define the keys that are usable within the optional argument of '\fancycolumns' \def\@fancy@animation@none{\fancy@cols@animation{0}{-}} \def\@fancy@animation@keep{\fancy@cols@animation{1}{-}} @@ -430,7 +430,7 @@ } % allows to user to overwrite the defaults -\newcommand\setmycolumnsdefault[1]{\pgfqkeys{/fancy columns}{@defaults/.append style={#1}}} +\newcommand\setfancycolumnsdefault[1]{\pgfqkeys{/fancy columns}{@defaults/.append style={#1}}} % we need two counters % 'fancy@cols@current' holds the column we are currently in (starts with 0) @@ -544,7 +544,7 @@ \fi } -% this is the macro, that will become '\mynextcolumn' within the 'mycolumns' environment +% this is the macro, that will become '\mynextcolumn' within the 'fancycolumns' environment \newcommand\fancy@mynextcolumn{% % issue a warning if too many columns \ifnum\value{fancy@cols@current}<\fancy@cols@count\else @@ -581,7 +581,7 @@ } % #1: arguments like 'columns=3, keep, reverse' -\newenvironment{mycolumns}[1][]{\begingroup +\newenvironment{fancycolumns}[1][]{\begingroup \pgfqkeys{/fancy columns}{@defaults, #1}% \edef\fancy@previous@fancy@cols{\thefancy@cols@current}% store the current column counter \ifdim\fancy@cols@height<0pt\begin{minipage}{\fancy@cols@target@width}\else\begin{minipage}[\fancy@cols@valign][\fancy@cols@height]{\fancy@cols@target@width}\fi% From 6771d82516c3c45fa8aeaba76f846c4260fa5712 Mon Sep 17 00:00:00 2001 From: Benno2000 Date: Wed, 6 Mar 2024 09:54:02 +0100 Subject: [PATCH 2/2] replace mynextcolumn by nextcolumn --- demo-slides/demoSlides.tex | 64 +++++++++++++++++++------------------- fancybeamer.sty | 10 +++--- 2 files changed, 37 insertions(+), 37 deletions(-) diff --git a/demo-slides/demoSlides.tex b/demo-slides/demoSlides.tex index 9d2f084..f0879ba 100644 --- a/demo-slides/demoSlides.tex +++ b/demo-slides/demoSlides.tex @@ -49,7 +49,7 @@ \end{itemize} \end{itemize} \end{itemize} - \mynextcolumn + \nextcolumn Numbered lists can be nested to a depth of three: \begin{enumerate} \item Item on the first level @@ -73,11 +73,11 @@ \begin{definition}{A Definition} This is a definition. \end{definition} - \mynextcolumn + \nextcolumn \begin{example}{An {\color{blue} Example}} This is an example. \end{example} - \mynextcolumn + \nextcolumn \begin{note}{A {\color{red} Note}} This is a note. \end{note} @@ -88,11 +88,11 @@ \begin{definition}{} This is a {\color{orange} definition}. \end{definition} - \mynextcolumn + \nextcolumn \begin{example}{} This is an {\color{blue} example}. \end{example} - \mynextcolumn + \nextcolumn \begin{note}{} This is a {\color{red} note}. \end{note} @@ -103,11 +103,11 @@ \begin{definitiontight}{A Definition} \centering\includegraphics[width=.75\linewidth]{example-image} \end{definitiontight} - \mynextcolumn + \nextcolumn \begin{exampletight}{An Example} \centering\includegraphics[width=.75\linewidth]{example-image} \end{exampletight} - \mynextcolumn + \nextcolumn \begin{notetight}{A Note} \centering\includegraphics[width=.75\linewidth]{example-image} \end{notetight} @@ -120,7 +120,7 @@ \begin{amazing}{An Amazing Box} You can create new boxes with \texttt{\textbackslash MakeNewBox\{name\}\{color\}} (which will check if any of the new box commands is already taken) or \texttt{\textbackslash DeclareBox\{name\}\{color\}} (which may overwrite existing commands). This box was created by \texttt{\textbackslash MakeNewBox\{amazing\}\{purple\}}. \end{amazing} - \mynextcolumn + \nextcolumn {\UpdateBoxColor{definition}{teal} \begin{definition}{This is a Definition} With \texttt{\textbackslash UpdateBoxColor\{name\}\{color\}} you can change the color of a box (locally to the current group). This definition was changed with \texttt{\textbackslash UpdateBoxColor\{definition\}\{teal\}}. @@ -163,7 +163,7 @@ \centering \pic[width=.7\textwidth]{example-image} \end{notetight} - \mynextcolumn + \nextcolumn \begin{notetight}{Inverted Image with \texttt{\textbackslash picDark} (in dark-mode only)} \centering \picDark[width=.7\textwidth]{example-image.jpg} % does only work for bitmap images so far @@ -182,16 +182,16 @@ \begin{frame}{\insertsubsection} \begin{fancycolumns}[columns=4] % default: 2 columns This is an example text that is shown in the \textbf{first column}. - \mynextcolumn + \nextcolumn This is an example text that is shown in the \textbf{second column}. - \mynextcolumn + \nextcolumn This is an example text that is shown in the \textbf{third column}. - \mynextcolumn + \nextcolumn This is an example text that is shown in the \textbf{last column}. \end{fancycolumns} \vfill \begin{note}{Explanation} - Columns are separated by the command \texttt{\textbackslash mynextcolumn}. + Columns are separated by the command \texttt{\textbackslash nextcolumn}. The option \texttt{columns} specifies the number of columns that should be generated. The default number of columns is two. \end{note} @@ -203,11 +203,11 @@ \begin{example}{} The \textbf{first column} takes 20\,\% of the width of the slide. \end{example} - \mynextcolumn + \nextcolumn \begin{example}{} The \textbf{second column} takes 30\,\% of the width of the slide. \end{example} - \mynextcolumn + \nextcolumn \begin{example}{} The \textbf{third column} takes the remaining 50\,\% of the width of the slide. \end{example} @@ -229,7 +229,7 @@ \begin{note}{Explanation} If the content of a column exceeds a certain height, the common centering of all columns will not work anymore because beamer does not define the height of a slide. In this case, you can set the height of the columns manually by adding the option \texttt{height=}. \end{note} - \mynextcolumn + \nextcolumn \begin{example}{} This is the content of the second column. It is too high and would make the first column move downwards without additional options. \vspace{80mm} @@ -245,14 +245,14 @@ \end{example} \begin{fancycolumns}[columns=4] \mynote{}{1.1} - \mynextcolumn + \nextcolumn \mynote{}{1.2} - \mynextcolumn + \nextcolumn \mynote{}{1.3} - \mynextcolumn + \nextcolumn \mynote{}{1.4} \end{fancycolumns} - \mynextcolumn + \nextcolumn \begin{example}{} A column on the right side \end{example} @@ -260,12 +260,12 @@ \mynote{}{2.1} \begin{fancycolumns}[columns=3] \mynote{}{2.1.1} - \mynextcolumn + \nextcolumn \mynote{}{2.1.2} - \mynextcolumn + \nextcolumn \mynote{}{2.1.3} \end{fancycolumns} - \mynextcolumn + \nextcolumn \mynote{}{2.2} \end{fancycolumns} \end{fancycolumns} @@ -275,9 +275,9 @@ \begin{frame}{\insertsubsection\ -- Option keep} \begin{fancycolumns}[columns=3,keep] % short for animation=keep This is an example text that is shown in the \textbf{first column}. - \mynextcolumn + \nextcolumn This is an example text that is shown in the \textbf{second column}. - \mynextcolumn + \nextcolumn This is an example text that is shown in the \textbf{third column}. \end{fancycolumns} \vfill @@ -293,9 +293,9 @@ \begin{frame}{\insertsubsection\ -- Option forget} \begin{fancycolumns}[columns=3,forget] % short for animation=forget This is an example text that is shown in the \textbf{first column}. - \mynextcolumn + \nextcolumn This is an example text that is shown in the \textbf{second column}. - \mynextcolumn + \nextcolumn This is an example text that is shown in the \textbf{third column}. \end{fancycolumns} \vfill @@ -311,9 +311,9 @@ \begin{frame}{\insertsubsection\ -- Option animation=none} \begin{fancycolumns}[columns=3,animation=none] This is an example text that is shown in the \textbf{first column}. - \mynextcolumn + \nextcolumn This is an example text that is shown in the \textbf{second column}. - \mynextcolumn + \nextcolumn This is an example text that is shown in the \textbf{third column}. \end{fancycolumns} \vfill @@ -327,11 +327,11 @@ \begin{frame}[label=current]{\insertsubsection\ -- Option reverse} \begin{fancycolumns}[columns=4,forget,reverse,b] \pic[width=\linewidth]{example-image}\\[0mm]~ - \mynextcolumn + \nextcolumn \pic[width=\linewidth]{example-image}\\[5mm]~ - \mynextcolumn + \nextcolumn \pic[width=\linewidth]{example-image}\\[10mm]~ - \mynextcolumn + \nextcolumn \pic[width=\linewidth]{example-image}\\[15mm]~ \end{fancycolumns} \begin{note}{Explanation} diff --git a/fancybeamer.sty b/fancybeamer.sty index 1bb9019..9dc86f4 100644 --- a/fancybeamer.sty +++ b/fancybeamer.sty @@ -452,13 +452,13 @@ % due to the way beamer calculates the columns, we remove the margin from the width % see etoolbox for an explanation of '\dimdef' (basically allows for calculations with dimensions) \dimdef{\fancy@cols@total@width}{\linewidth-\fancy@cols@margin*\fancy@cols@count+\fancy@cols@margin}% - % activate(/overwrite) the '\mynextcolumn' macro within the environment - \let\mynextcolumn\fancy@mynextcolumn + % activate(/overwrite) the '\nextcolumn' macro within the environment + \let\nextcolumn\fancy@nextcolumn % a rather complicated macro, which sets/calculates the widths for all columns \fancy@cols@initialize@widths % issue the first column % NOTE: we don't guard if 'columns' is below 1 (e.g. we always assume, there is 1 column) - \mynextcolumn + \nextcolumn } % a temporary counter so we do not need to use low-level tex counters (like @tempcnta) @@ -544,8 +544,8 @@ \fi } -% this is the macro, that will become '\mynextcolumn' within the 'fancycolumns' environment -\newcommand\fancy@mynextcolumn{% +% this is the macro, that will become '\nextcolumn' within the 'fancycolumns' environment +\newcommand\fancy@nextcolumn{% % issue a warning if too many columns \ifnum\value{fancy@cols@current}<\fancy@cols@count\else % this mus be an error, we calculate widths etc. only for the given columns