Debian Codegraph @

texmf-dist/source/latex/caption/caption-beamer.dtx

raw
1 % \iffalse meta-comment
2 %
3 % This is file `caption-beamer.dtx'.
4 %
5 % Copyright (C) 2007-2023 Axel Sommerfeldt ([email protected])
6 %
7 % --------------------------------------------------------------------------
8 %
9 % This work may be distributed and/or modified under the
10 % conditions of the LaTeX Project Public License, either version 1.3
11 % of this license or (at your option) any later version.
12 % The latest version of this license is in
13 % http://www.latex-project.org/lppl.txt
14 % and version 1.3 or later is part of all distributions of LaTeX
15 % version 2003/12/01 or later.
16 %
17 % This work has the LPPL maintenance status "maintained".
18 %
19 % This Current Maintainer of this work is Axel Sommerfeldt.
20 %
21 % This work consists of the files
22 % caption.ins, caption.dtx, caption-light.dtx, caption2.dtx, caption3.dtx,
23 % caption-ams-smf.dtx, caption-beamer.dtx, caption-elsarticle.dtx,
24 % caption-koma.dtx, caption-memoir.dtx, caption-ntg.dtx,
25 % caption-thesis.dtx, bicaption.dtx, ltcaption.dtx, subcaption.dtx,
26 % the derived files
27 % caption.sty, caption-light.sty, caption2.sty, caption3.sty,
28 % caption-ams-smf.sto, caption-beamer.sto, caption-elsarticle.sto,
29 % caption-koma.sto, caption-memoir.sto, caption-ntg.sto,
30 % caption-thesis.sto, bicaption.sty, ltcaption.sty, subcaption.sty.
31 %
32 % \fi
33 %
34 % \CheckSum{113}
35 %
36 % \iffalse
37 %<*driver>
38 \NeedsTeXFormat{LaTeX2e}[1994/12/01]
39 \ProvidesFile{caption-beamer.drv}[2023/07/10 v2.0 Implementation of the caption-beamer package]
40 %\errorcontextlines=3
41 %
42 \documentclass{captiondoc}
43 \hypersetup{pdfkeywords={LaTeX, package, caption-beamer}}
44 %
45 \begin{document}
46 \DocInput{caption-beamer.dtx}
47 \end{document}
48 %</driver>
49 % \fi
50 %
51 % \GetFileInfo{caption-beamer.drv}
52 % \let\docdate\filedate
53 % \let\docversion\fileversion
54 % \GetFileInfo{caption-beamer.sto}
55 %
56 % \title{\texorpdfstring
57 % {The adaption of the \pkg{caption} package to the \cls{beamer} document class\thanks{%^^A
58 % This adaption has version number \docversion.}}%^^A
59 % {The adaption of the caption package to the beamer document class}}
60 % \author{Axel Sommerfeldt\\
61 % \url{https://gitlab.com/axelsommerfeldt/caption}}
62 % \date{\docdate}
63 % \maketitle
64 %
65 % \begin{abstract}
66 % This package adapts the \pkg{caption} package to the \cls{beamer} document class.
67 % \end{abstract}
68 %
69 % \section*{User manual}
70 %
71 % This document is describing the code implementation only. The user
72 % documentation can be found in
73 % \nopagebreak\begin{quote}
74 % \begin{tabular}{ll}
75 % \href{http://mirror.ctan.org/macros/latex/contrib/caption/caption.pdf}%
76 % {\texttt{caption.pdf}} & The caption package documentation \\
77 % \end{tabular}
78 % \end{quote}
79 %
80 % \StopEventually{}
81 % \iffalse
82 % \clearpage
83 % \tableofcontents
84 % \fi
85 %
86 % \iffalse
87 % --------------------------------------------------------------------------- %
88 % \fi
89 %
90 % \DoNotIndex{\\,\_,\ ,\@@par}
91 % \DoNotIndex{\@bsphack}
92 % \DoNotIndex{\@car,\@cdr,\@classoptionslist,\@cons,\@currext,\@currname}
93 % \DoNotIndex{\@ehc,\@ehd,\@empty,\@esphack,\@expandtwoargs}
94 % \DoNotIndex{\@for,\@firstofone,\@firstoftwo}
95 % \DoNotIndex{\@gobble,\@gobblefour,\@gobbletwo,\@hangfrom}
96 % \DoNotIndex{\if@minipage,\@ifnextchar,\@ifpackagelater,\@ifpackageloaded}
97 % \DoNotIndex{\@ifstar,\@ifundefined,\@latex@error,\@minipagefalse,\@minipagetrue}
98 % \DoNotIndex{\@namedef,\@nameuse}
99 % \DoNotIndex{\@onlypreamble,\@parboxrestore,\@plus,\@ptionlist}
100 % \DoNotIndex{\@removeelement,\@restorepar,\@secondoftwo,\@setminipage,\@setpar}
101 % \DoNotIndex{\@tempa,\@tempboxa,\@tempdima,\@tempdimb,\@tempdimc,\@tempb,\@tempc}
102 % \DoNotIndex{\@testopt}
103 % \DoNotIndex{\@undefined,\@unprocessedoptions,\@unusedoptionlist}
104 % \DoNotIndex{\p@,\z@}
105 % \DoNotIndex{\active,\addtocounter,\addtolength,\advance,\aftergroup}
106 % \DoNotIndex{\baselineskip,\begin,\begingroup,\bfseries,\box}
107 % \DoNotIndex{\catcode,\centering,\changes,\csname,\def,\divide,\do,\downarrow}
108 % \DoNotIndex{\edef,\else,\empty,\end,\endcsname,\endgraf,\endgroup,\expandafter}
109 % \DoNotIndex{\fi,\footnotesize,\global}
110 % \DoNotIndex{\hangindent,\hbox,\hfil,\hsize,\hskip,\hspace,\hss}
111 % \DoNotIndex{\ifcase,\ifdim,\ifnum,\ifodd,\ifvoid,\ifvmode}
112 % \DoNotIndex{\ifx,\ignorespaces,\itshape}
113 % \DoNotIndex{\kernel@ifnextchar}
114 % \DoNotIndex{\Large,\large,\leavevmode,\leftmargini,\leftskip,\let,\linewidth}
115 % \DoNotIndex{\llap,\long,\m@ne,\margin,\mdseries,\message}
116 % \DoNotIndex{\newcommand,\newdimen,\newlength,\newline,\newif,\newsavebox}
117 % \DoNotIndex{\next,\nobreak,\nobreakspace,\noexpand,\noindent,\numberline}
118 % \DoNotIndex{\normalcolor,\normalfont,\normalsize,\or,\par,\parbox,\parfillskip}
119 % \DoNotIndex{\parindent,\parskip,\prevdepth,\protect,\protected@edef,\protected@write}
120 % \DoNotIndex{\providecommand,\quad}
121 % \DoNotIndex{\raggedleft,\raggedright,\relax,\renewcommand,\RequirePackage}
122 % \DoNotIndex{\rightskip,\rmfamily}
123 % \DoNotIndex{\sbox,\scriptsize,\scshape,\setbox,\setlength,\sffamily,\slshape}
124 % \DoNotIndex{\small,\string,\space,\strut}
125 % \DoNotIndex{\textheight,\the,\toks@,\typeout,\ttfamily}
126 % \DoNotIndex{\unvbox,\uparrow,\upshape,\usebox,\usepackage}
127 % \DoNotIndex{\value,\vbox,\vsize,\vskip,\wd,\width,\z@skip}
128 % \DoNotIndex{\AtBeginDocument,\AtEndOfPackage,\CurrentOption,\DeclareOption}
129 % \DoNotIndex{\ExecuteOptions,\GenericWarning,\IfFileExists,\InputIfFileExists}
130 % \DoNotIndex{\NeedsTeXFormat,\MessageBreak}
131 % \DoNotIndex{\PackageError,\PackageInfo,\PackageWarning,\PackageWarningNoLine}
132 % \DoNotIndex{\PassOptionsToPackage,\ProcessOptions,\ProvidesPackage}
133 %
134 % \iffalse
135 % --------------------------------------------------------------------------- %
136 % \fi
137 %
138 % \setlength{\parskip}{0pt plus 1pt}
139 % \newcommand*\Note[2][Note]{\par{\small\emph{#1:} #2}\par}
140 %
141 % \changes{v1.1}{2007/03/10}{\cls{beamer} class support added}
142 % \changes{v1.3}{2011/08/06}{\cls{beamer} class support revised}
143 % \changes{v1.5}{2013/04/27}{The \cls{beamer} template \texttt{caption label separator} will be used now}
144 % \changes{v1.7}{2016/05/22}{Re-definition of label format \texttt{simpleMagyar} added to \cls{beamer} class support}
145 % \changes{v1.7}{2018/04/15}{Re-definition of label format \texttt{simpleMagyar} revised}
146 % \changes{v1.7}{2018/05/01}{Definition of \cls{beamer} default label font revised}
147 % \changes{v2.0}{2020/07/27}{\cls{beamer} class support adapted to \pkg{caption3}~\version{2.0}}
148 %
149 % \iffalse
150 % --------------------------------------------------------------------------- %
151 % \fi
152 %
153 % \clearpage
154 %
155 % \iffalse
156 %<*package>
157 % \fi
158 %
159 % \section{Identification}
160 %
161 % \begin{macrocode}
162 \NeedsTeXFormat{LaTeX2e}[1994/12/01]
163 \ProvidesFile{caption-beamer.sto}[2022/01/06 v2.0c Adaption of the caption package to the beamer document classes (AR)]
164 % \end{macrocode}
165 %
166 % \section{Helper macros}
167 %
168 % \begin{macro}{\caption@ifbeamertemplate}
169 % |\caption@ifbeamertemplate|\marg{caption template name}\marg{yes-code}\marg{no-code}\\
170 % tests if the given beamer caption template was selected by the user (or not).
171 % \begin{macrocode}
172 \newcommand*\caption@ifbeamertemplate[1]{%
173 \begingroup
174 \let\beamer@@tmpl@caption@ORI\beamer@@tmpl@caption
175 \@nameuse{beamer@@tmpop@caption@#1}%
176 \ifx\beamer@@tmpl@caption@ORI\beamer@@tmpl@caption
177 \endgroup\expandafter\@firstoftwo
178 \else
179 \endgroup\expandafter\@secondoftwo
180 \fi}
181 % \end{macrocode}
182 % \end{macro}
183 %
184 % \section{Single-line-check}
185 %
186 % The `default' single-line-check maps to the beamer template setting `caption name own line'.
187 % \begin{macrocode}
188 \DeclareCaptionSinglelinecheck{default}{%
189 \caption@ifbeamertemplate{caption name own line}%
190 \@secondoftwo % \@secondoftwo -> singlelinecheck=off
191 \@firstoftwo} % \@firstoftwo -> singlelinecheck=on
192 % \end{macrocode}
193 %
194 % \begin{macro}{\footnote}
195 % \changes{v1.12b}{2020/07/20}{Special adaption to \cls{beamer} added}
196 % The patch of \cs{footnote} provided by the \pkg{caption3} package assumes
197 % that the optional arguments of \cs{footnote} and \cs{footnotemark} match.
198 % Since this is not the case in \cls{beamer} based documents,
199 % and since \cls{beamer} extents the syntax of \cs{footnote} in a special way,
200 % we need a special patch here.\par
201 % \emph{Note:} For this patch we assume that \cs{footnote} will always end with the usage of
202 % \cs{beamer@footnotetext}. (Unfortunately \cs{footnote} is defined too monolithic
203 % in \cls{beamer} to offer a less dirty patch.)
204 % \begin{macrocode}
205 \providecommand*\AtCaptionSingleLineCheck{\g@addto@macro\caption@prepareslc} % for caption v3.5
206 \let\caption@footnote@ORI\footnote
207 \AtCaptionSingleLineCheck{%
208 \def\footnote{%
209 \begingroup
210 \let\stepcounter\caption@l@stepcounter
211 \renewcommand<>\beamer@framefootnotetext[1]{%
212 \endgroup}%
213 \let\@footnotetext\beamer@framefootnotetext
214 \caption@footnote@ORI}}
215 % \end{macrocode}
216 % \end{macro}
217 %
218 % \section{Label formats}
219 %
220 % The `default' caption label format maps to either `simple' (if the `numbered' beamer template is set) or `unnumbered' (otherwise).
221 % \begin{macrocode}
222 \DeclareCaptionLabelFormat{default}{%
223 \caption@ifbeamertemplate{numbered}%
224 \caption@labelformat@simple
225 \caption@labelformat@unnumbered
226 {#1}{#2}}
227 % \end{macrocode}
228 %
229 % The \pkg{magyar} babel package redefines the current label format to a one called |simple|\-|Magyar|,
230 % defined within |\@@magyar@caption|\-|fix| which will be executed |\At|\-|Begin|\-|Document|:
231 % \begin{quote}
232 % |\DeclareCaptionLabelFormat{simpleMagyar}%|\\
233 % | {#2.\bothIfSecond{\nobreakspace}{#1}}|
234 % \end{quote}
235 % When used with beamer, we need to patch it so no numbering will be used if the `numbered` template isn't selected.
236 % \begin{macrocode}
237 \DeclareCaptionLabelFormat{simpleMagyar}{%
238 \caption@ifbeamertemplate{numbered}%
239 {#2.\bothIfSecond{\nobreakspace}{#1}}%
240 {\caption@labelformat@unnumbered{#1}{#2}}}
241 % \end{macrocode}
242 % \begin{macro}{\@@magyar@captionfix}
243 % Prevent \pkg{magyar} from defining this caption label format on its own.
244 % \begin{macrocode}
245 \let\@@magyar@captionfix\relax
246 \AtBeginDocument{\let\@@magyar@captionfix\relax}
247 % \end{macrocode}
248 % \end{macro}
249 %
250 % \section{Label separator}
251 %
252 % The `default' caption label separator maps to the beamer templates
253 % `caption name own line' and `caption label separator'.
254 %
255 % If the beamer template `caption name own line' is set, this code equals to
256 % \begin{quote}
257 % |\DeclareCaptionLabelSeparator*{default}{\\}|
258 % \end{quote}
259 % otherwise this code equals to
260 % \begin{quote}
261 % |\DeclareCaptionLabelSeparator{default}%|\\
262 % | {\usebeamertemplate{caption label separator}}|
263 % \end{quote}
264 % \begin{macrocode}
265 \DeclareCaptionLabelSeparator**{default}%
266 {\caption@ifbeamertemplate{caption name own line}}%
267 {\caption@ifbeamertemplate{caption name own line}%
268 {\\}%
269 {\usebeamertemplate{caption label separator}}}
270 % \end{macrocode}
271 %
272 % \section{Fonts}
273 %
274 % The `default' caption font maps to the beamer settings for `caption' or `caption name'.
275 % \begin{macrocode}
276 \DeclareCaptionFont{beamer@font}{%
277 \usebeamerfont*{caption}%
278 \usebeamercolor[fg]{caption}}
279 \SetCaptionDefault{font}{beamer@font}
280 % \end{macrocode}
281 % \begin{macrocode}
282 \DeclareCaptionFont{beamer@labelfont}{%
283 \setbeamercolor*{caption}{}% avoid setting "caption" color additionally
284 \usebeamercolor[fg]{caption name}%
285 \setbeamerfont*{caption}{}% avoid setting "caption" font additionally
286 \usebeamerfont{caption name}}
287 \SetCaptionDefault{labelfont}{beamer@labelfont}
288 % \end{macrocode}
289 % \begin{macrocode}
290 \DeclareCaptionFont{beamer@textfont}{}
291 \SetCaptionDefault{textfont}{beamer@textfont}
292 % \end{macrocode}
293 %
294 % \section{Justification}
295 %
296 % The `default' caption justification is `raggedright'.
297 % \begin{macrocode}
298 \SetCaptionDefault{justification}{raggedright}
299 % \end{macrocode}
300 %
301 % \section{Lists}
302 %
303 % Since the beamer class do not offer a `List of figures' we switch it off.
304 % \begin{macrocode}
305 \captionsetup{list=off}
306 % \end{macrocode}
307 %
308 % \section{Adaption of figure and table environment}
309 %
310 % \begin{macrocode}
311 \AfterCaptionPackage{%
312 % \end{macrocode}
313 %
314 % \begin{macro}{\figure}
315 % \changes{v1.1f}{2007/12/17}{This re-definition for \cls{beamer} document class added}
316 % \changes{v1.8d}{2019/09/01}{This re-definition for \cls{beamer} document class revised}
317 % We re-define |figure| so our type-specific options will be used etc.
318 % \begin{macrocode}
319 \expandafter\let\expandafter\caption@beamer@figure
320 \csname\string\figure\endcsname
321 \@namedef{\string\figure}[#1]{%
322 \caption@beamer@figure[#1]% use original beamer code first
323 \caption@settype{figure}} % set "type=figure" afterwards
324 % \end{macrocode}
325 % \end{macro}
326 %
327 % \begin{macro}{\table}
328 % \changes{v1.1f}{2007/12/17}{This re-definition for \cls{beamer} document class added}
329 % \changes{v1.8d}{2019/09/01}{This re-definition for \cls{beamer} document class revised}
330 % \changes{v1.8e}{2019/10/18}{Bug fixed which was introduced in previous revision}
331 % We re-define |table| as well so our type-specific options will be used etc.
332 % \begin{macrocode}
333 \expandafter\let\expandafter\caption@beamer@table
334 \csname\string\table\endcsname
335 \@namedef{\string\table}[#1]{%
336 \caption@beamer@table[#1]% use original beamer code first
337 \caption@settype{table}} % set "type=table" afterwards
338 % \end{macrocode}
339 % \end{macro}
340 %
341 % \begin{macro}{\caption@nobreak}
342 % \changes{v2.0c}{2022/01/06}{This re-definition for \cls{beamer} document class added}
343 % We re-define |\caption@nobreak| to activate the usage of |\nobreak| inside |\caption|.
344 % |\caption@nobreak| is only available since \version{3.6} of the \pkg{caption}
345 % package, for this reason we use |\def| instead of |\renewcommand|.
346 % \begin{macrocode}
347 \def\caption@nobreak{\nobreak}
348 % \end{macrocode}
349 % \end{macro}
350 %
351 % \begin{macrocode}
352 }
353 % \end{macrocode}
354 %
355 % \iffalse
356 %</package>
357 % \fi
358 %
359 % \iffalse
360 % --------------------------------------------------------------------------- %
361 % \fi
362 %
363 % \clearpage
364 % \Finale
365 %
366 \endinput
367