Debian Codegraph @

texmf-dist/source/latex/beamertheme-trigon/beamerfontthemetrigon.dtx

raw
1 % \iffalse meta-comment -------------------------------------------------------
2 % Copyright (C) 2021 Thomas Lambert <[email protected]>
3 % Other contributors to this theme are listed here:
4 % https://gitlab.com/thlamb/beamertheme-trigon/-/graphs/master
5 %
6 % The original template was heavily inspired by Metropolis from Matthias
7 % Vogelgesang.
8 %
9 % License CC-BY-SA 4.0
10 % This work is licensed under a Creative Commons Attribution-ShareAlike 4.0
11 % International License (https://creativecommons.org/licenses/by-sa/4.0/)
12 % ------------------------------------------------------------------------- \fi
13 % \iffalse
14 %<*package>
15 \NeedsTeXFormat{LaTeX2e}
16 \ProvidesPackage{beamerfontthemetrigon}[2023/02/20 v0.7.0 Trigon font theme]
17 %</package>
18 % \fi
19 % \CheckSum{0}
20 % \StopEventually{}
21 % \iffalse
22 %<*package>
23 % ------------------------------------------------------------------------- \fi
24 %
25 % \subsection{\themename font theme}
26 % A |beamer| font theme sets the style of the font used in the document.
27 %
28 % \subsubsection{Package dependencies}
29 % \begin{macrocode}
30 \RequirePackage{pgfopts}
31 % \end{macrocode}
32 %
33 % \subsubsection{Title format options}
34 %
35 % \begin{macro}{titleformat title}
36 % Controls the format of the title.
37 % \begin{macrocode}
38 \pgfkeys{
39 /trigon/font/titleformat title/.cd,
40 .is choice,
41 regular/.code={%
42 \let\trigon@titleformat\@empty%
43 \setbeamerfont{title}{shape=\normalfont}%
44 },
45 smallcaps/.code={%
46 \let\trigon@titleformat\@empty%
47 \setbeamerfont{title}{shape=\scshape}%
48 },
49 allsmallcaps/.code={%
50 \let\trigon@titleformat\lowercase%
51 \setbeamerfont{title}{shape=\scshape}%
52 \PackageWarning{beamerthemetrigon}{%
53 Be aware that titleformat title=allsmallcaps can lead to problems%
54 }
55 },
56 allcaps/.code={%
57 \let\trigon@titleformat\uppercase%
58 \setbeamerfont{title}{shape=\normalfont}%
59 \PackageWarning{beamerthemetrigon}{%
60 Be aware that titleformat title=allcaps can lead to problems%
61 }
62 },
63 }
64 % \end{macrocode}
65 % \end{macro}
66 %
67 % \begin{macro}{titleformat subtitle}
68 % Controls the format of the subtitle.
69 % \begin{macrocode}
70 \pgfkeys{
71 /trigon/font/titleformat subtitle/.cd,
72 .is choice,
73 regular/.code={%
74 \let\trigon@subtitleformat\@empty%
75 \setbeamerfont{subtitle}{shape=\normalfont}%
76 },
77 smallcaps/.code={%
78 \let\trigon@subtitleformat\@empty%
79 \setbeamerfont{subtitle}{shape=\scshape}%
80 },
81 allsmallcaps/.code={%
82 \let\trigon@subtitleformat\lowercase%
83 \setbeamerfont{subtitle}{shape=\scshape}%
84 \PackageWarning{beamerthemetrigon}{%
85 Be aware that titleformat subtitle=allsmallcaps can lead to problems%
86 }
87 },
88 allcaps/.code={%
89 \let\trigon@subtitleformat\uppercase%
90 \setbeamerfont{subtitle}{shape=\normalfont}%
91 \PackageWarning{beamerthemetrigon}{%
92 Be aware that titleformat subtitle=allcaps can lead to problems%
93 }
94 },
95 }
96 % \end{macrocode}
97 % \end{macro}
98 %
99 % \begin{macro}{titleformat section}
100 % Controls the format of the section title.
101 % \begin{macrocode}
102 \pgfkeys{
103 /trigon/font/titleformat section/.cd,
104 .is choice,
105 regular/.code={%
106 \let\trigon@sectiontitleformat\@empty%
107 \setbeamerfont{section title}{shape=\normalfont}%
108 },
109 smallcaps/.code={%
110 \let\trigon@sectiontitleformat\@empty%
111 \setbeamerfont{section title}{shape=\scshape}%
112 },
113 allsmallcaps/.code={%
114 \let\trigon@sectiontitleformat\MakeLowercase%
115 \setbeamerfont{section title}{shape=\scshape}%
116 \PackageWarning{beamerthemetrigon}{%
117 Be aware that titleformat section=allsmallcaps can lead to problems%
118 }
119 },
120 allcaps/.code={%
121 \let\trigon@sectiontitleformat\MakeUppercase%
122 \setbeamerfont{section title}{shape=\normalfont}%
123 \PackageWarning{beamerthemetrigon}{%
124 Be aware that titleformat section=allcaps can lead to problems%
125 }
126 },
127 }
128 % \end{macrocode}
129 % \end{macro}
130 %
131 % \begin{macro}{titleformat frame}
132 % Controls the format of the frame title.
133 % \begin{macrocode}
134 \pgfkeys{
135 /trigon/font/titleformat frame/.cd,
136 .is choice,
137 regular/.code={%
138 \let\trigon@frametitleformat\@empty%
139 \setbeamerfont{frametitle}{shape=\normalfont}%
140 },
141 smallcaps/.code={%
142 \let\trigon@frametitleformat\@empty%
143 \setbeamerfont{frametitle}{shape=\scshape}%
144 },
145 allsmallcaps/.code={%
146 \let\trigon@frametitleformat\MakeLowercase%
147 \setbeamerfont{frametitle}{shape=\scshape}%
148 \PackageWarning{beamerthemetrigon}{%
149 Be aware that titleformat frame=allsmallcaps can lead to problems%
150 }
151 },
152 allcaps/.code={%
153 \let\trigon@frametitleformat\MakeUppercase%
154 \setbeamerfont{frametitle}{shape=\normalfont}
155 \PackageWarning{beamerthemetrigon}{%
156 Be aware that titleformat frame=allcaps can lead to problems%
157 }
158 },
159 }
160 % \end{macrocode}
161 % \end{macro}
162 %
163 % \begin{macro}{titleformat aliases}
164 % Allows |titleformat title| et al. to be used in the |\usetheme|
165 % declaration, where \LaTeX{} automatically removes all spaces.
166 % \begin{macrocode}
167 \pgfkeys{
168 /trigon/font/.cd,
169 titleformattitle/.code=\pgfkeysalso{titleformat title=#1},
170 titleformatsubtitle/.code=\pgfkeysalso{titleformat subtitle=#1},
171 titleformatsection/.code=\pgfkeysalso{titleformat section=#1},
172 titleformatframe/.code=\pgfkeysalso{titleformat frame=#1},
173 }
174 % \end{macrocode}
175 % \end{macro}
176 %
177 % \begin{macro}{\trigon@font@setdefaults}
178 % Sets default values for font theme options.
179 % \begin{macrocode}
180 \newcommand{\trigon@font@setdefaults}{
181 \pgfkeys{/trigon/font/.cd,
182 titleformat title=regular,
183 titleformat subtitle=regular,
184 titleformat section=regular,
185 titleformat frame=regular,
186 }
187 }
188 % \end{macrocode}
189 % \end{macro}
190 %
191 % We first define hooks to change the case format of the titles.
192 %
193 % \begin{macrocode}
194 \def\trigon@titleformat#1{#1}
195 \def\trigon@subtitleformat#1{#1}
196 \def\trigon@sectiontitleformat#1{#1}
197 \def\trigon@frametitleformat#1{#1}
198 % \end{macrocode}
199 %
200 % To make the uppercase and lowercase macros work in the title, subtitle, etc.,
201 % we have to patch the appropriate |beamer| commands that set their values.
202 % This solution was suggested by Enrico Gregorio in an answer to
203 % \href{http://tex.stackexchange.com/questions/112526/}{this StackExchange
204 % question}.
205 % \begin{macrocode}
206 \patchcmd{\beamer@title}%
207 {\def\inserttitle{#2}}%
208 {\def\inserttitle{\trigon@titleformat{#2}}}%
209 {}%
210 {\PackageError{beamerfontthemetrigon}{Patching title failed}\@ehc}
211 \patchcmd{\beamer@subtitle}%
212 {\def\insertsubtitle{#2}}%
213 {\def\insertsubtitle{\trigon@subtitleformat{#2}}}%
214 {}%
215 {\PackageError{beamerfontthemetrigon}{Patching subtitle failed}\@ehc}
216 \patchcmd{\sectionentry}
217 {\def\insertsectionhead{#2}}
218 {\def\insertsectionhead{\trigon@sectiontitleformat{#2}}}
219 {}
220 {\PackageError{beamerfontthemetrigon}{Patching section title failed}\@ehc}
221 \@tempswafalse
222 \patchcmd{\beamer@section}
223 {\edef\insertsectionhead{\noexpand\hyperlink{Navigation\the\c@page}{\unexpanded{#1}}}}
224 {\edef\insertsectionhead{\noexpand\hyperlink{Navigation\the\c@page}{%
225 \noexpand\trigon@sectiontitleformat{\unexpanded{#1}}}}}
226 {\@tempswatrue}
227 {}
228 \patchcmd{\beamer@section}
229 {\def\insertsectionhead{\hyperlink{Navigation\the\c@page}{#1}}}
230 {\def\insertsectionhead{\hyperlink{Navigation\the\c@page}{%
231 \trigon@sectiontitleformat{#1}}}}
232 {\@tempswatrue}
233 {}
234 \patchcmd{\beamer@section}
235 {\protected@edef\insertsectionhead{\noexpand\hyperlink{Navigation\the\c@page}{#1}}}
236 {\protected@edef\insertsectionhead{\noexpand\hyperlink{Navigation\the\c@page}{%
237 \noexpand\trigon@sectiontitleformat{#1}}}}
238 {\@tempswatrue}
239 {}
240 \if@tempswa\else
241 \PackageError{beamerfontthemetrigon}{Patching section title failed}\@ehc
242 \fi
243 \@tempswafalse
244 \patchcmd{\beamer@subsection}
245 {\edef\insertsubsectionhead{\noexpand\hyperlink{Navigation\the\c@page}{\unexpanded{#1}}}}
246 {\edef\insertsubsectionhead{\noexpand\hyperlink{Navigation\the\c@page}{%
247 \noexpand\trigon@sectiontitleformat{\unexpanded{#1}}}}}
248 {\@tempswatrue}
249 {}
250 \patchcmd{\beamer@subsection}
251 {\def\insertsubsectionhead{\hyperlink{Navigation\the\c@page}{#1}}}
252 {\def\insertsubsectionhead{\hyperlink{Navigation\the\c@page}{%
253 \trigon@sectiontitleformat{#1}}}}
254 {\@tempswatrue}
255 {}
256 \patchcmd{\beamer@subsection}
257 {\protected@edef\insertsubsectionhead{\noexpand\hyperlink{Navigation\the\c@page}{#1}}}
258 {\protected@edef\insertsubsectionhead{\noexpand\hyperlink{Navigation\the\c@page}{%
259 \noexpand\trigon@sectiontitleformat{#1}}}}
260 {\@tempswatrue}
261 {}
262 \if@tempswa\else
263 \PackageError{beamerfontthemetrigon}{Patching section title failed}\@ehc
264 \fi
265 % \end{macrocode}
266 %
267 % Similarly, to make the |\MakeLowercase| and |\MakeUppercase| macros work in
268 % the frame title we have to patch |\beamer@@frametitle|.
269 %
270 % \begin{macrocode}
271 \providecommand{\beamer@insertframetitlecontinuation}{
272 \usebeamertemplate*{frametitle continuation}
273 }
274 \patchcmd{\beamer@@frametitle}
275 {\gdef\insertframetitle{{%
276 #2%
277 \ifnum\beamer@autobreakcount>0
278 \relax{}\space%
279 \beamer@insertframetitlecontinuation%
280 \fi%
281 }}%
282 }
283 {\gdef\insertframetitle{{%
284 \trigon@frametitleformat{#2}%
285 \ifnum\beamer@autobreakcount>0
286 \relax{}\space%
287 \beamer@insertframetitlecontinuation%
288 \fi%
289 }}%
290 }
291 {}
292 {\PackageWarning{beamerfontthemetrigon}{Patching frame title failed}\@ehc}
293 % \end{macrocode}
294 %
295 % \subsubsection{General font definitions}
296 %
297 % \begin{macrocode}
298 \setbeamerfont{author} {size=\normalsize}
299 \setbeamerfont{title} {size=\LARGE,series=\bfseries}
300 \setbeamerfont{section title}{size=\LARGE,series=\mdseries}
301 \setbeamerfont{date} {size=\small}
302 \setbeamerfont*{subtitle} {size=\Large}
303 \setbeamerfont{frametitle} {size=\LARGE}
304 \setbeamerfont{framesubtitle}{size=\large}
305
306 \setbeamerfont{alerted text} {size=\normalsize,series=\bfseries}
307 \setbeamerfont{block title}{size=\normalsize,series=\bfseries}
308 \setbeamerfont{block title alerted}{size=\normalsize,series=\bfseries}
309
310 \setbeamerfont{section in toc}{size=\Large}
311 \setbeamerfont{subsection in toc}{size=\large}
312 \setbeamerfont{page number in head/foot}{size=\scriptsize}
313
314 \setbeamerfont{description item}{series=\bfseries}
315 \setbeamerfont{caption}{size=\small}
316 \setbeamerfont{caption name}{series=\bfseries}
317 % \end{macrocode}
318 %
319 % \subsubsection{Process package options}
320 %
321 % \begin{macrocode}
322 \trigon@font@setdefaults
323 \ProcessPgfPackageOptions{/trigon/font}
324 % \end{macrocode}
325 %
326 % \iffalse
327 %</package>
328 % \fi
329 % \Finale
330 \endinput