forked from upb/FancyBeamerUPB
Merge branch '2-replace-mycolumns-by-fancycolumns'
This commit is contained in:
commit
1011785d8f
@ -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
|
||||
@ -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
|
||||
@ -63,64 +63,64 @@
|
||||
\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
|
||||
\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}
|
||||
\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}
|
||||
\mynextcolumn
|
||||
\nextcolumn
|
||||
\begin{example}{}
|
||||
This is an {\color{blue} example}.
|
||||
\end{example}
|
||||
\mynextcolumn
|
||||
\nextcolumn
|
||||
\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}
|
||||
\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}
|
||||
\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}
|
||||
\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\}}.
|
||||
@ -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,17 +158,17 @@
|
||||
|
||||
\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}
|
||||
\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
|
||||
\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{<image-name>-dark} automatically gets used when dark-mode is enabled.
|
||||
|
||||
@ -180,18 +180,18 @@
|
||||
|
||||
\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
|
||||
\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{mycolumns}
|
||||
\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}
|
||||
@ -199,19 +199,19 @@
|
||||
|
||||
\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}
|
||||
\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}
|
||||
\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,64 +222,64 @@
|
||||
|
||||
\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}
|
||||
\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=<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}
|
||||
\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
|
||||
\nextcolumn
|
||||
\mynote{}{1.2}
|
||||
\mynextcolumn
|
||||
\nextcolumn
|
||||
\mynote{}{1.3}
|
||||
\mynextcolumn
|
||||
\nextcolumn
|
||||
\mynote{}{1.4}
|
||||
\end{mycolumns}
|
||||
\mynextcolumn
|
||||
\end{fancycolumns}
|
||||
\nextcolumn
|
||||
\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
|
||||
\nextcolumn
|
||||
\mynote{}{2.1.2}
|
||||
\mynextcolumn
|
||||
\nextcolumn
|
||||
\mynote{}{2.1.3}
|
||||
\end{mycolumns}
|
||||
\mynextcolumn
|
||||
\end{fancycolumns}
|
||||
\nextcolumn
|
||||
\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
|
||||
\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{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
|
||||
\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{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,29 +309,29 @@
|
||||
\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
|
||||
\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{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=3,forget,reverse]
|
||||
\begin{fancycolumns}[columns=3,forget,reverse]
|
||||
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{mycolumns}
|
||||
\end{fancycolumns}
|
||||
\vfill
|
||||
\begin{note}{Explanation}
|
||||
The option \texttt{reverse} inverts the order of any animation that is specified (i.e., using \texttt{keep} or \texttt{forget}).
|
||||
|
@ -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)
|
||||
@ -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 'mycolumns' 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
|
||||
@ -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%
|
||||
|
Loading…
x
Reference in New Issue
Block a user