Debian Codegraph @

texmf-dist/doc/latex/beamertheme-rainbow/beamertheme-rainbow-doc.tex

raw
1 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2 %
3 % Documentation for the rainbow colour theme
4 % A beamer colour theme which alternates theme colours on every frame
5 % Maintained by samcarter
6 %
7 % Project repository and bug tracker:
8 % https://github.com/samcarter/beamertheme-rainbow
9 %
10 % Released under the LaTeX Project Public License v1.3c or later
11 % See https://www.latex-project.org/lppl.txt
12 %
13 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
14 % !TeX program = txs:///arara
15 % arara: latexmk: {
16 % arara: --> engine: pdflatex,
17 % arara: --> options: [
18 % arara: --> '-shell-escape',
19 % arara: --> '-synctex=1',
20 % arara: --> '-interaction=nonstopmode',
21 % arara: --> ]
22 % arara: --> }
23 \documentclass{scrartcl}
24
25 % meta %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
26 \title{\texorpdfstring{\gradient{HSB}{The rainbow beamer colour theme}{0,240,200}{240,240,200}}{The rainbow beamer colour theme}}
27 \subtitle{A beamer colour theme which alternates theme colours on every frame}
28 \author{%
29 \texorpdfstring{
30 \texttt{samcarter}\\
31 \url{https://github.com/samcarter/beamertheme-rainbow}\\
32 \url{https://www.ctan.org/pkg/beamertheme-rainbow}
33 }{samcarter}}
34 \date{Version v1.0 \textendash{} 2024/11/14}
35
36 \usepackage[
37 themecolor=samlila
38 ]{\jobname-settings}
39
40 % rainbow text (based on the gradient-text package) %%%%%%%%%%%%%%%%%
41 \makeatletter
42 \ExplSyntaxOn
43 \clist_new:N\l_gtext_First_clist
44 \clist_new:N\l_gtext_Last_clist
45 \int_new:N\l_gtext_MaxIndex_int
46 \int_new:N\l_gtext_Ratio_int
47 \newcommand{\gr@dient}[8]{
48 \int_set:Nn\l_gtext_MaxIndex_int{\int_eval:n{\str_count:n{#1}}}
49 \int_step_inline:nnn{1}{\l_gtext_MaxIndex_int}{
50 \exp_args:Ne\str_if_eq:nnTF{\str_item:Nn{#1}{##1}}{~}{}{
51 \int_set:Nn\l_gtext_Ratio_int{\int_eval:n{\l_gtext_Ratio_int+1}}
52 }
53 \color_select:nn{#8}{
54 \int_eval:n{(\int_use:N\l_gtext_Ratio_int*#5+(\l_gtext_MaxIndex_int-##1)*#2)/\l_gtext_MaxIndex_int},
55 \int_eval:n{(\int_use:N\l_gtext_Ratio_int*#6+(\l_gtext_MaxIndex_int-##1)*#3)/\l_gtext_MaxIndex_int},
56 \int_eval:n{(\int_use:N\l_gtext_Ratio_int*#7+(\l_gtext_MaxIndex_int-##1)*#4)/\l_gtext_MaxIndex_int}
57 }\str_item:Nn{#1}{##1}
58 }
59 }
60
61 \NewDocumentCommand\gradient{mmmm}{{
62 \clist_set:Nn\l_gtext_First_clist {#3}
63 \clist_set:Nn\l_gtext_Last_clist {#4}
64 \gr@dient{#2}
65 {\clist_item:Nn\l_gtext_First_clist{1}}
66 {\clist_item:Nn\l_gtext_First_clist{2}}
67 {\clist_item:Nn\l_gtext_First_clist{3}}
68 {\clist_item:Nn\l_gtext_Last_clist{1}}
69 {\clist_item:Nn\l_gtext_Last_clist{2}}
70 {\clist_item:Nn\l_gtext_Last_clist{3}}
71 {#1}
72 }}
73 \ExplSyntaxOff
74 \makeatother
75
76 % customisation %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
77 \renewcommand*\dictumwidth{0.35\linewidth}
78 \renewcommand*{\dictumrule}{\vskip1ex}
79 \renewcommand*{\dictumauthorformat}[1]{#1}
80
81 \newcommand{\prefix}{./include}
82 \tcbset{
83 compilable listing/.style={listing file={\prefix/\jobname-listing-\thetcblistingcount.tex}},
84 run pdflatex/.style={run@system@command={cd\space \prefix;\space pdflatex}{\jobname-listing-\thetcblistingcount.tex}},%
85 }
86
87 \begin{document}
88 \maketitle
89
90 \dictum[Marc Chagall]{Colour is all. When colour is right, form is right. Colour is everything, colour is vibration like music; everything is vibration.}
91
92 \section{Introduction}
93 \label{intro}
94
95 The rainbow beamer colour theme will bring more colours to your presentation. It works similarly to the structure beamer colour theme, but instead of having just one theme colour throughout the whole presentation, the rainbow beamer colour theme will cycle through a list of colours and change the theme colour on every frame or (sub)section.
96
97 By default, it will cycle through colours of the rainbow (hence the name), but a custom set of colours is also possible.
98
99 The package is included in \texlive and \miktex and available from \CTAN (\url{https://www.ctan.org/pkg/beamertheme-tcolorbox}).
100 The development version of this package is located at \url{https://github.com/samcarter/beamertheme-rainbow}. If you have any problems, ideas or other feedback, please make constructive use of the issue tracker.
101
102 Copyright \raisebox{0.2em}{\tiny\fontfamily{cmr}\selectfont\textcopyright} \texttt{samcarter}. Permission is granted to copy, distribute and\slash or modify this software under the terms of the LaTeX project public licence, version 1.3c or later \url{https://www.latex-project.org/lppl.txt}.
103
104 \section{Usage}
105
106 The basic usage is fairly simple. After choosing a beamer theme, one can load the rainbow beamer colour theme via
107 \begin{tcolorbox}[title={Usage}]
108 \begin{samcode}
109 \usecolortheme{rainbow}
110 \end{samcode}
111 \end{tcolorbox}
112
113 This will work with most of the themes which are provided by the beamer class as well some third party themes. Notable exceptions are the \saminline|AnnArbor| and \saminline|CambridgeUS| themes.
114
115 This basic usage will colour frames in alternating rainbow colours:
116 \nopagebreak
117 \begin{tcblisting}{
118 listing and comment,
119 pdf comment,
120 freeze pdf,
121 compilable listing,
122 run pdflatex,
123 comment={
124 \begin{tikzpicture}
125 \foreach \i in {1,...,6}{%
126 \node at (0.35*\i,-0.7*\i) {\includegraphics[page=\i,width=3.7cm]{beamertheme-rainbow-doc-listing-1.pdf}};
127 }
128 \end{tikzpicture}
129 },
130 title={Basic example}
131 }
132 \documentclass{beamer}
133
134 \usetheme{Berkeley}
135 \usecolortheme{rainbow}
136
137 \begin{document}
138
139 % just for this test example
140 \ExplSyntaxOn
141 \prg_replicate:nn{6}{
142 \begin{frame}
143 \end{frame}
144 }
145 \ExplSyntaxOff
146
147 \end{document}
148 \end{tcblisting}
149
150 As pretty as rainbow colours are, there might be some users who would like to choose their own colours. This can be done with the \saminline|colors={...}| option which accepts a comma separated list of colours. The colours can be predefined colours e.g. from the \saminline|xcolor| package, user-defined colours or (for more fun) from the \saminline|xkcdcolors| package.
151
152 \begin{tcblisting}{
153 listing and comment,
154 pdf comment,
155 freeze pdf,
156 compilable listing,
157 run pdflatex,
158 comment={
159 \begin{tikzpicture}
160 \foreach \i in {1,...,6}{%
161 \node at (0.35*\i,-0.7*\i) {\includegraphics[page=\i,width=3.7cm]{beamertheme-rainbow-doc-listing-2.pdf}};
162 }
163 \end{tikzpicture}
164 },
165 title={\strut Custom colours}
166 }
167 \documentclass{beamer}
168
169 \usetheme{Copenhagen}
170 \usepackage{xkcdcolors}
171 \definecolor{mycolor}{RGB}{101,67,159}
172
173 \usecolortheme[
174 colors={
175 orange,
176 mycolor,
177 xkcdMediumBlue
178 }
179 ]{rainbow}
180
181 \begin{document}
182
183 % just for this test example
184 \ExplSyntaxOn
185 \prg_replicate:nn{6}{
186 \begin{frame}
187 \frametitle{Title}
188 \end{frame}
189 }
190 \ExplSyntaxOff
191
192 \end{document}
193 \end{tcblisting}
194
195 Changing the colour on every frame might be too frequent. For these use cases, the theme offers the option \saminline|auto=...|, which allows the user to control when automatic colour changes should happen. Possible values are \saminline|frame| (default), \saminline|section| and \saminline|subsection|. All other values will disable automatic colour changes.
196
197 \begin{tcblisting}{
198 listing and comment,
199 pdf comment,
200 freeze pdf,
201 compilable listing,
202 run pdflatex,
203 comment={
204 \begin{tikzpicture}
205 \foreach \i in {1,...,3}{%
206 \node at (0.35*\i,-0.7*\i) {\includegraphics[page=\i,width=3.7cm]{beamertheme-rainbow-doc-listing-3.pdf}};
207 }
208 \end{tikzpicture}
209 },
210 title={\strut Automatic colour changing}
211 }
212 \documentclass{beamer}
213
214 \usetheme{Bergen}
215 \usecolortheme[
216 colors={blue,red},
217 auto=section
218 ]{rainbow}
219
220 \begin{document}
221
222 \begin{frame}
223 \end{frame}
224
225 \section{Section}
226 \begin{frame}
227 \end{frame}
228 \begin{frame}
229 \end{frame}
230
231 \end{document}
232 \end{tcblisting}
233
234 It is also possible to manually change to the next colour using the macro \saminline|\rainbow|:
235
236 \begin{tcblisting}{
237 listing and comment,
238 pdf comment,
239 freeze pdf,
240 compilable listing,
241 run pdflatex,
242 comment={
243 \begin{tikzpicture}
244 \foreach \i in {1,...,3}{%
245 \node at (0.35*\i,-0.7*\i) {\includegraphics[page=\i,width=3.7cm]{beamertheme-rainbow-doc-listing-4.pdf}};
246 }
247 \end{tikzpicture}
248 },
249 title={\strut Manual colour changing}
250 }
251 \documentclass{beamer}
252
253 \usetheme{Rochester}
254 \usecolortheme[
255 colors={orange,teal},
256 auto=none
257 ]{rainbow}
258
259 \begin{document}
260
261 \begin{frame}
262 \frametitle{Title}
263 \end{frame}
264 \begin{frame}
265 \frametitle{Title}
266 \end{frame}
267
268 \rainbow
269
270 \begin{frame}
271 \frametitle{Title}
272 \end{frame}
273
274 \end{document}
275 \end{tcblisting}
276
277 \end{document}
278