Debian Codegraph @

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

raw
1 % \iffalse meta-comment
2 %
3 % This is file `bicaption.dtx'.
4 %
5 % Copyright (C) 2010-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{642}
35 %
36 % \iffalse
37 %<*driver>
38 \NeedsTeXFormat{LaTeX2e}[1994/12/01]
39 \ProvidesFile{bicaption.drv}[2023/07/10 v1.6 Adds a bilingual caption feature to the caption package]
40 %\errorcontextlines=3
41 %
42 \documentclass[german,english]{captiondoc}
43 \hypersetup{pdfkeywords={LaTeX, package, bicaption}}
44 %
45 \usepackage[T1]{fontenc}
46 \usepackage[german,english]{babel}
47 %\usepackage{selinput}\SelectInputMappings{adieresis={ä},germandbls={ß}}
48 \usepackage[utf8]{inputenc}
49 %
50 \usepackage{bicaption}[2023/02/19]
51 \usepackage{subcaption}[2023/02/19]
52 %
53 \begin{document}
54 \DocInput{bicaption.dtx}
55 \end{document}
56 %</driver>
57 % \fi
58 %
59 % \def\thispackage{the \pkg{bicaption} package}
60 % \def\Thispackage{The \pkg{bicaption} package}
61 %
62 % \GetFileInfo{bicaption.drv}
63 % \let\docdate\filedate
64 % \let\docversion\fileversion
65 % \GetFileInfo{bicaption.sty}
66 %
67 % \title{\texorpdfstring{\Thispackage\thanks{%^^A
68 % This package has version number \docversion.}}%^^A
69 % {The bicaption package}}
70 % \author{Axel Sommerfeldt\\
71 % \url{https://gitlab.com/axelsommerfeldt/caption}}
72 % \date{\docdate}
73 % \maketitle
74 %
75 % \begin{abstract}
76 % This package supports the typesetting of bilangual captions.
77 % \end{abstract}
78 %
79 % \setcounter{tocdepth}{2}
80 % \tableofcontents
81 %
82 % \clearpage
83 % \section{Loading the package}
84 % \label{sec:loading}
85 %
86 % This package will be loaded by
87 % \begin{quote}
88 % |\usepackage|\oarg{options}|{bicaption}|\quad.
89 % \end{quote}
90 % The options for \thispackage\ are the same ones as for the \pkg{caption}
91 % package and specify settings which are used for the second language \emph{additionally}.
92 % In fact
93 % \begin{quote}
94 % |\usepackage|\oarg{options}|{bicaption}|
95 % \end{quote}
96 % is identical to
97 % \begin{quote}
98 % |\usepackage{bicaption}|\\
99 % |\bicaptionsetup{}|\marg{options}\quad.
100 % \end{quote}
101 %
102 % When used with the \pkg{babel} or \pkg{polyglossia} package, the
103 % \pkg{bicaption} package should be loaded \emph{after} it, so the main
104 % language will be set automatically. See \autoref{sec:babel} for details.
105 %
106 % \pagebreak[3]
107 % \section{Setting options}
108 % \label{sec:options}
109 %
110 % \DescribeMacro\bicaptionsetup
111 % \NEWfeature*{v1.6}
112 % The |\bicaptionsetup| command sets options specifically for bilingual captions.
113 %
114 % \begin{quote}
115 % |\bicaptionsetup|\marg{options for 1st language}\marg{options for 2nd language}
116 % \end{quote}
117 % sets options which will be used for the first or second heading
118 % of the bilingual captions \emph{additionally} to the ones which are setup for the
119 % specific floating environment.
120 %
121 % \medskip
122 %
123 % To limit bilingual options to specific environments one can use
124 % an optional argument for |\bi|\-|caption|\-|setup|, e.g.:
125 % \begin{quote}
126 % |\bicaptionsetup[figure]{|\ldots|}{|\ldots|}|
127 % \end{quote}
128 % will limit the settings to the bilingual headings of |figure| environments only.
129 %
130 % \bigskip
131 %
132 % Options specified with |\use|\-|package[|\ldots|]{bi|\-|cap|\-|tion}| and
133 % |\bi|\-|cap|\-|tion|\-|setup{|\ldots|}{|\ldots|}| will override the ones specified by
134 % |\cap|\-|tion|\-|setup{|\ldots|}| and |\cap|\-|tion|\-|setup[fig|\-|ure]{|\ldots|}|
135 % (same for `table'). So finally we have the following order how
136 % settings for bilingual captions are applied:
137 % \begin{enumerate}
138 % \item Global settings
139 % {\small(|\usepackage[|\ldots|]{caption}| and |\captionsetup{|\ldots|}|)}
140 % \item Environmental settings
141 % {\small(|\captionsetup[figure|\emph{ -or- }|table]{|\ldots|}|)}
142 % \item Local settings
143 % {\small(|\captionsetup{|\ldots|}| inside |figure| or |table| environment)}
144 % \item Custom bilingual settings
145 % {\small(|\usepackage[|\ldots|]{bicaption}| and |\bicaptionsetup{|\ldots|}{|\ldots|}|)}
146 % \item Environmental bilingual settings
147 % {\small(|\bicaptionsetup[figure|\emph{ -or- }|table]{|\ldots|}{|\ldots|}|)}
148 % \end{enumerate}
149 % \pagebreak[3]
150 % An example:
151 % \begin{quote}
152 % |\usepackage[labelsep=quad,indention=10pt]{caption}|\\
153 % |\usepackage[labelfont=bf]{bicaption}|\\
154 % |\captionsetup[table]{labelfont=it,position=top}|
155 % \end{quote}
156 % causes the second heading of the bilingual caption inside |table| environments
157 % to be typeset with the settings
158 % \begin{quote}
159 % |labelsep=quad,indention=10pt,position=top,labelfont=bf|~.
160 % \end{quote}
161 %
162 % \begin{background}
163 % Internally the |\bi|\-|caption|\-|setup| uses the |\caption|\-|setup| command, i.e.
164 % \begin{quote}
165 % |\bicaptionsetup|\marg{options for 1st language}\marg{options for 2nd language}
166 % \end{quote}
167 % is identical to
168 % \begin{quote}
169 % |\captionsetup[bi-first]|\marg{options for 1st language}\\
170 % |\captionsetup[bi-second]|\marg{options for 2nd language}
171 % \end{quote}
172 % and
173 % \begin{quote}
174 % |\bicaptionsetup[figure]{|\ldots|}{|\ldots|}|
175 % \end{quote}
176 % is identical to
177 % \begin{quote}
178 % |\captionsetup[figure][bi-first]{|\ldots|}|\\
179 % |\captionsetup[figure][bi-second]{|\ldots|}| \quad .
180 % \end{quote}
181 % Prior to \version{1.6} of this package this was the way options had to be specified.
182 % This still works (and will continue to work in the future), but is not recommended,
183 % |\bi|\-|caption|\-|setup| should be used instead.
184 % \end{background}
185 %
186 % \section{Additional options}
187 % \label{sec:additional-options}
188 %
189 % These options are available additional to the ones offered by the
190 % \pkg{caption} package:
191 %
192 % \begin{Options}{language=}
193 % \item[lang=]
194 % Sets the language of the caption, e.g.
195 % \begin{quote}|\use|\-|package|\-|[lang=eng|\-|lish]{bi|\-|caption}|\end{quote}
196 % will typeset the second caption of bilingual captions in English.
197 % (The language will be set with |\select|\-|caption|\-|language| internally,
198 % see \autoref{sec:babel} for details.)
199 %
200 % \item[bi-lang=]
201 % Causes a selection of the headings of bilingual captions.
202 % \begin{quote}|\captionsetup{bi-lang=both}|\end{quote}
203 % will cause that both caption headings are being typeset.\\
204 % (This is the default.)
205 % \begin{quote}|\captionsetup{bi-lang=first}|\end{quote}
206 % will cause that only the \emph{first} heading is being typeset, and
207 % \begin{quote}|\captionsetup{bi-lang=second}|\end{quote}
208 % will cause that only the \emph{second} heading is being typeset.
209 %
210 % \item[bi-slc=]
211 % \begin{quote}|\captionsetup{bi-slc=|\meta{bool}|}|\end{quote}
212 % switches the common single-line-check |on| or |off|, i.e.~when switched on
213 % only a single check will be done for both captions, and the result will affect
214 % both captions afterwards. So if only one caption is longer than a single line,
215 % both captions will be treated as if they are longer than a single line, even if
216 % the second one isn't. (The default is |on|.)
217 %
218 % \item[bi-swap=]
219 % \begin{quote}|\captionsetup{bi-swap}|\end{quote}
220 % will swap the primary and secondary language,
221 % making the first language the second one and vice versa. (The default is |false|.)
222 %
223 % \item[bi-separator=]
224 % \NEWfeature{v1.3}
225 % The vertical distance between the first and second bilingual caption is usually
226 % determined by the \TeX\ skips set by |\normal|\-|size| which is applied right
227 % before both captions get typesetted.
228 % (This behaviour is inherited from the original \LaTeX\ code for |\caption| which
229 % applies |\normal|\-|size| right before |\@make|\-|caption|, too.)
230 % \begin{quote}|\captionsetup{bi-separator=|\meta{name}|}|\end{quote}
231 % will select an additional separator between first and second bilingual caption.
232 % You could choose one of the following: `none' (which is the default one
233 % and could also be addressed as `default'), `smallskip', `medskip',
234 % `largeskip', or a self-defined one using
235 % \DescribeMacro{\DeclareBiCaption-\\Separator}
236 % \begin{quote}|\DeclareBiCaptionSeparator|\marg{name}\marg{code}\end{quote}
237 % Examples:
238 % \begin{quote}
239 % |\captionsetup{bi-separator=smallskip}|
240 % \end{quote}
241 % will put a |\smallskip| between the two bilingual captions.
242 % \begin{quote}
243 % |\DeclareBiCaptionSeparator{hrule}{\hrule}|\\
244 % |\captionsetup{bi-separator=hrule}|
245 % \end{quote}
246 % will draw a horizontal line between the two bilingual captions.
247 % \begin{quote}
248 % |\DeclareBiCaptionSeparator{3pt}{\vspace{3pt}}|\\
249 % |\captionsetup{bi-separator=3pt}|
250 % \end{quote}
251 % will place |3pt| extra vertical space between the two bilingual captions.
252 % \par\medskip
253 % \textit{Note:} In contrast to the original \LaTeX\ code for |\caption| the
254 % \pkg{caption} package does not apply |\normal|\-|size| directly
255 % but will apply the caption font definition |normal|\-|size| instead
256 % (which is usually defined as |\normal|\-|size|).
257 % Therefore the vertical space between both captions
258 % could also be influenced by redefining it, e.g.:
259 % |\Declare|\-|Caption|\-|Font{normal|\-|size}{|\ldots|}|
260 % \end{Options}
261 %
262 % \emph{Important:}
263 % All options starting with `bi-' must be applied using |\caption|\-|setup| and
264 % \emph{NOT} using |\bi|\-|caption|\-|setup|.
265 % This is because they do not alter the setting of the caption for the 1st or 2nd language specifically,
266 % but instead alter the behaviour how bilingual captions are set in general.
267 %
268 % \section{The \cs{bicaption} commands}
269 % \label{sec:bicaption}
270 %
271 % \DescribeMacro\bicaption
272 % Bilingual captions will be typeset by
273 % \begin{quote}
274 % |\bicaption|\oarg{list entry \#1}\marg{heading \#1}\\
275 % | |\oarg{list entry \#2}\marg{heading \#2}\\
276 % |\bicaption*|\marg{heading \#1}\marg{heading \#2}
277 % \end{quote}
278 % The |\label| should be placed either after this command, or inside the first heading.
279 %
280 % \medskip
281 %
282 % Just like in |\caption| an empty \meta{list entry} will suppress the entry in the list of figures or tables, for example
283 % \begin{quote}
284 % |\bicaption[]|\marg{heading \#1}|[]|\marg{heading \#2}
285 % \end{quote}
286 % suppresses both entries.
287 %
288 % \medskip
289 %
290 % \DescribeMacro\bicaptionbox
291 % Bilingual caption boxes will be typeset by
292 % \begin{quote}
293 % |\bicaptionbox|\oarg{list entry \#1}\marg{heading \#1}\\
294 % | |\oarg{list entry \#2}\marg{heading \#2}\\
295 % | |\oarg{width}\oarg{inner-pos}\marg{contents}\\
296 % |\bicaptionbox*|\marg{heading \#1}\marg{heading \#2}\\
297 % | |\oarg{width}\oarg{inner-pos}\marg{contents}
298 % \end{quote}
299 % The |\label| should be placed inside the first heading.
300 %
301 % \begingroup\small
302 % (For a description of the optional parameters \meta{width} and \meta{inner-pos}
303 % please take a look at the \pkg{caption} package documentation,
304 % \cs{captionbox}.)
305 % \endgroup
306 %
307 % \pagebreak[3]
308 % \section{Customising lists}
309 % \label{sec:lists}
310 %
311 % \DescribeMacro{list=}
312 % As default both caption texts will be insert into the List of Figures or List of Tables.
313 % To suppress the second entry just pass the option |list=off| to the \pkg{bicaption}
314 % package, e.g.:
315 % \begin{quote}
316 % |\usepackage[lang=english,|\ldots|,list=off]{bicaption}|
317 % \end{quote}
318 % or
319 % \begin{quote}
320 % |\usepackage[|\ldots|]{bicaption}|\\
321 % \ldots\\
322 % |\bicaptionsetup{}{list=off}|
323 % \end{quote}
324 %
325 % \pagebreak[3]
326 % \DescribeMacro{listtype+=}
327 % Another option is separating the lists. For that purpose the option
328 % \begin{quote}
329 % |listtype+=|\meta{list type extension}
330 % \end{quote}
331 % can be used to tell the \pkg{bicaption} package to use a different list
332 % for the second caption text.
333 % The given value will be appended to the current environment type;
334 % for example with |listtype+=X| the list entries will be put into the list
335 % responsible for the types
336 % |figureX| ($=$ |figure| $+$ |X|), |tableX| ($=$ |table| $+$ |X|) etc.
337 %
338 % Such a \meta{list type} can be defined using |\Declare|\-|Floating|\-|Environment|
339 % offered by the \pkg{newfloat} package, but some document classes
340 % or other packages offer macros for defining new floating environment types
341 % (and their corresponding lists) as well.
342 %
343 % \pagebreak[3]
344 % A sample document:
345 % \begin{quote}
346 % |\documentclass[a4paper]{article}|\\
347 % ||\\
348 % |% Use "ngerman" as 1st language, "english" as 2nd one|\\
349 % |\usepackage[english,ngerman]{babel}|\\
350 % ||\\
351 % |% Load the bicaption package with 2nd language set to|\\
352 % |% "english", and list type "figureEnglish" or "tableEnglish"|\\
353 % |\usepackage[lang=english,listtype+=English]{bicaption}|\\
354 % ||\\
355 % |\usepackage{newfloat}|\\
356 % |% Define type "figureEnglish" and \listoffigureEnglish|\\
357 % |\DeclareFloatingEnvironment[fileext=lof2]{figureEnglish}|\\
358 % | [Figure][List of Figures]|\\
359 % |% Define type "tableEnglish" and \listoftableEnglish|\\
360 % |\DeclareFloatingEnvironment[fileext=lot2]{tableEnglish}|\\
361 % | [Table][List of Tables]|\\
362 % ||\\
363 % |\begin{document}|\\
364 % ||\\
365 % |\listoffigures % typeset "Abbildungsverzeichnis"|\\
366 % |\listoffigureEnglish % typeset "List of Figures"|\\
367 % ||\\
368 % |\begin{figure}|\\
369 % | \centering|\\
370 % | A placeholder for an image or whatever|\\
371 % | \bicaption{Deutscher Text}{English text}|\\
372 % |\end{figure}|\\
373 % ||\\
374 % |\end{document}|
375 % \end{quote}
376 %
377 % \pagebreak[3]
378 % A different approach is using one list for both languages, but with different formatting.
379 % Since the \pkg{caption} package does not offer options and commands for
380 % customising the format of the lists, one need an additional package for this purpose,
381 % for example the \pkg{titletoc} package:
382 %
383 % \begin{quote}
384 % |\documentclass[a4paper]{article}|\\
385 % ||\\
386 % |% Use "ngerman" as 1st language, "english" as 2nd one|\\
387 % |\usepackage[english,ngerman]{babel}|\\
388 % ||\\
389 % |% Load the bicaption package with 2nd language set to|\\
390 % |% "english", and list type "figure2" or "table2"|\\
391 % |\usepackage[lang=english,listtype+=2]{bicaption}|\\
392 % ||\\
393 % |% We load the titletoc package for customising lists|\\
394 % |% Note: Loading titletoc should be done prior|\\
395 % |% defining additional floating environments with|\\
396 % |% \DeclareFloatingEnvironment|\\
397 % |\usepackage{titletoc}|\\
398 % ||\\
399 % |\usepackage{newfloat}|\\
400 % |% Define the new floating environment type "figure2"|\\
401 % |% Use the same file extension as for "figure" (.lof) here|\\
402 % |\DeclareFloatingEnvironment[fileext=lof]{figure2}|\\
403 % |% Define the new floating environment type "table2"|\\
404 % |% Use the same file extension as for "table" (.lot) here|\\
405 % |\DeclareFloatingEnvironment[fileext=lot]{table2}|\\
406 % ||\\
407 % |% We use the titletoc package for customising "figure2"|\\
408 % |% which is appropriate for the second language captions|\\
409 % \iffalse
410 % |\contentsuse{figure2}{lof}|\\
411 % \fi
412 % |\titlecontents{figure2}[3.8em]|\\
413 % | {} % no above code|\\
414 % | {} % empty numbered entry format|\\
415 % | {} % empty numberless entry format|\\
416 % | {} % empty filler page format|\\
417 % ||\\
418 % |\begin{document}|\\
419 % ||\\
420 % |\renewcommand\listfigurename|\\
421 % | {Abbildungsverzeichnis / List of Figures}|\\
422 % |\listoffigures|\\
423 % ||\\
424 % |\begin{figure}|\\
425 % | \centering|\\
426 % | A placeholder for an image or whatever|\\
427 % | \bicaption{Deutscher Text}{English text}|\\
428 % |\end{figure}|\\
429 % ||\\
430 % |\end{document}|
431 % \end{quote}
432 %
433 % \section{Language Selection}
434 % \label{sec:babel}
435 %
436 % For language selection \thispackage\ uses two macros internally:
437 %
438 % \medskip
439 %
440 % \DescribeMacro\captionmainlanguage
441 % |\caption|\-|main|\-|lan|\-|guage| contains the main language, for example
442 % `french' or `german'.
443 % If not set manually, \thispackage\ will try to obtain this setting from
444 % the \pkg{babel} or \pkg{polyglossia} package after the preamble of
445 % the document, i.e.~at |\begin{doc|\-|u|\-|ment}|.
446 %
447 % So if you are using either \pkg{babel} or \pkg{polyglossia}, and want to inherit
448 % the main language setting from it, then simply forget about the
449 % |\caption|\-|main|\-|lan|\-|guage| stuff and skip the rest of the section.
450 %
451 % \pagebreak[3]
452 % Otherwise one can define |\caption|\-|main|\-|lan|\-|guage| manually, e.g.:
453 % \begin{quote}
454 % |\newcommand\captionmainlanguage{french}|\\
455 % |\usepackage[lang=english]{bicaption}|
456 % \end{quote}
457 %
458 % \pagebreak[3]
459 % Note: Prior to \version{1.5} |\caption|\-|main|\-|language| needed to be defined
460 % \emph{before} loading \thispackage. Since \version{1.5} is could be defined either
461 % before or after loading \thispackage.
462 %
463 % \medskip
464 %
465 % \DescribeMacro\selectcaptionlanguage
466 % \NEWfeature*{v1.1}
467 % |\select|\-|caption|\-|lan|\-|guage| will be used internally to select the language:
468 % \begin{quote}
469 % |\selectcaptionlanguage|\marg{font-or-list-entry}\marg{language}
470 % \end{quote}
471 % For setting the language of the caption \meta{font-or-list-entry} will be |\@first|\-|of|\-|two|,
472 % for setting the language of the list entry \meta{font-or-list-entry} will be
473 % |\@second|\-|of|\-|two|.~\footnote{\cs{@firstoftwo} and \cs{@secondoftwo} are defined
474 % in the \LaTeX\ kernel and simply pick either the 1st or 2nd argument.}
475 % It defaults to |\select@lan|\-|guage| (caption) or |\select|\-|lan|\-|guage| (list entry)
476 % offered by the \pkg{babel} and \pkg{polyglossia} package:
477 % \begin{quote}
478 % |\providecommand*\selectcaptionlanguage[2]{%|\\
479 % | #1{\select@language}{\selectlanguage}{#2}}|
480 % \end{quote}
481 % If you need to alter this, just either define |\select|\-|caption|\-|lan|\-|guage| prior
482 % loading \thispackage, or redefine it afterwards.
483 %
484 % \pagebreak[3]
485 % Example document using \pkg{babel}:
486 % \begin{quote}
487 % |\documentclass[a4paper]{article}|\\
488 % ||\\
489 % |% Use "ngerman" as 1st language, "english" as 2nd one|\\
490 % |\usepackage[english,ngerman]{babel}|\\
491 % ||\\
492 % |% Add custom translations to babel|\\
493 % |\addto\captionsgerman{%|\\
494 % |% \renewcommand\whatevername{Wasauchimmer}%|\\
495 % |% |\ldots\\
496 % |}|\\
497 % |\addto\captionsenglish{%|\\
498 % |% \renewcommand\whatevername{Whatever}%|\\
499 % |% |\ldots\\
500 % |}|\\
501 % ||\\
502 % |% Load the bicaption package with 2nd language set to|\\
503 % |% "english"|\\
504 % |\usepackage[lang=english]{bicaption}|\\
505 % ||\\
506 % |\begin{document}|\\
507 % ||\\
508 % |\begin{figure}|\\
509 % | \centering|\\
510 % | A placeholder for an image or whatever|\\
511 % | \bicaption{Deutscher Text}{English text}|\\
512 % |\end{figure}|\\
513 % ||\\
514 % |\end{document}|
515 % \end{quote}
516 %
517 % \pagebreak[3]
518 % The same example document but using a custom implementation of
519 % |\caption|\-|main|\-|language| and |\select|\-|caption|\-|language|
520 % instead of \pkg{babel}:
521 % \begin{quote}
522 % |\documentclass[a4paper]{article}|\\
523 % ||\\
524 % |% Load the bicaption package with 2nd language set to|\\
525 % |% "english"|\\
526 % |\usepackage[lang=english]{bicaption}|\\
527 % ||\\
528 % |% Set "german" as main bi-caption language|\\
529 % |\newcommand\captionmainlanguage{german}|\\
530 % ||\\
531 % |% Declare an own language switching mechanism|\\
532 % |% for bi-captions (instead of using babel)|\\
533 % |\renewcommand\selectcaptionlanguage[2]{%|\\
534 % | \csname captions#2\endcsname}|\\
535 % |\newcommand\captionsgerman{%|\\
536 % | \renewcommand\figurename{Abbildung}%|\\
537 % | \renewcommand\tablename{Tabelle}%|\\
538 % |% \renewcommand\whatevername{Wasauchimmer}%|\\
539 % |% |\ldots\\
540 % |}|\\
541 % |\newcommand\captionsenglish{%|\\
542 % | \renewcommand\figurename{Figure}%|\\
543 % | \renewcommand\tablename{Table}%|\\
544 % |% \renewcommand\whatevername{Whatever}%|\\
545 % |% |\ldots\\
546 % |}|\\
547 % ||\\
548 % |\begin{document}|\\
549 % ||\\
550 % |\begin{figure}|\\
551 % | \centering|\\
552 % | A placeholder for an image or whatever|\\
553 % | \bicaption{Deutscher Text}{English text}|\\
554 % |\end{figure}|\\
555 % ||\\
556 % |\end{document}|
557 % \end{quote}
558 %
559 % \pagebreak[3]
560 % \NEWfeature{v1.5}
561 % Since \version{1.5} a warning is issued if the main language could neither be
562 % detected automatically nor was it set explicitly by the user.
563 % If you really don't want to set languages for bi-captions but are annoyed by
564 % the warning you could trick the \pkg{bicaption} by defining a custom
565 % dummy language-selection mechanism, e.g.:
566 % \begin{quote}
567 % |\newcommand\captionmainlanguage{dummy}|\\
568 % |\renewcommand\selectcaptionlanguage[2]{}|\\
569 % \end{quote}
570 %
571 % \medskip
572 %
573 % \pagebreak[3]
574 % \DescribeMacro{\DeclareCaption-\\LangOption}
575 % \NEWfeature*{v1.2}
576 % For internal implementation reasons the selection of language will be done delayed,
577 % i.e.~not done immediately at |lang=|\meta{language}. So if you do
578 % \begin{quote}
579 % |\bicaptionsetup{}{lang=ngerman,labelsep=quad}|
580 % \end{quote}
581 % the language |ngerman| will only be stored internally, and the label separator will
582 % be set to |quad| afterwards. Some time later, right before the caption is actually
583 % typeset, the language will be set to |ngerman|.
584 %
585 % \pagebreak[3]
586 % Usually this is no problem, but think of options which will be overwritten by the
587 % language selection, or options which act on the language currently set, for example
588 % \begin{quote}
589 % |\bicaptionsetup{}{lang=ngerman,name=Bild}|\quad.
590 % \end{quote}
591 % |lang=ngerman| changes the environment name to ``Abbildung'', and |name=Bild|
592 % changes the environment name to ``Bild''. One would expect that the name is
593 % finally ``Bild'', but because of the delayed nature of |lang=ngerman| it will
594 % be ``Abbildung'' instead, at least if we don't take action about this.
595 %
596 % \pagebreak[3]
597 % For that reason the command
598 % \begin{quote}
599 % |\DeclareCaptionLangOption|\marg{caption option name}
600 % \end{quote}
601 % is offered. Options handled this way will be applied twice if used after the |lang=|
602 % option, when the option is actually used, and right after the language is selected.
603 %
604 % \begin{quote}
605 % |\DeclareCaptionLangOption{name}|
606 % \end{quote}
607 % will be done by \thispackage\ automatically, since the environment name will usually
608 % be overwritten by a language selection. So actually
609 % \begin{quote}
610 % |\bicaptionsetup{}{lang=ngerman,name=Bild}|
611 % \end{quote}
612 % will give the expected result, i.e. the environment name is typeset as ``Bild''.
613 %
614 % \section{Required packages}
615 % \label{sec:caption}
616 %
617 % \NEWfeature{v1.4}
618 % Starting with version $1.4$ the \pkg{bicaption} package requires at least version $3.2$
619 % of the \pkg{caption} package and loads it automatically.
620 % (Older versions of the \pkg{bicaption} package have required exactly the version of the
621 % \pkg{caption} package which was released with it.)
622 %
623 % \pagebreak[3]
624 % If you need to use a specific version of the \pkg{caption} package you need to load it
625 % \emph{before} the \pkg{bicaption} package, e.g.:
626 % \begin{quote}
627 % |\usepackage[| \ldots |]{caption}[=v3.5]|\\
628 % |\usepackage[| \ldots |]{bicaption}|
629 % \end{quote}
630 %
631 % \pagebreak[3]
632 % Note that there are limitations if an older version of the \pkg{caption} package
633 % is used:
634 % \begin{itemize}
635 % \item Full support of list entries of the \env{lstlisting} environment
636 % (offered by the \pkg{listings} package) needs at least \pkg{caption} \version{3.6}.
637 % \end{itemize}
638 %
639 % \section{Supported packages}
640 % \label{sec:packages}
641 %
642 % The \pkg{bicaption} package was adapted to the following packages which deals with captions, too:
643 % \pkg{listings}~\cite{listings}, \pkg{longtable}~\cite{longtable}, and \pkg{subcaption}~\cite{subcaption}.
644 %
645 % \subsection{Support of the listings package}
646 % \label{sec:listings}
647 %
648 % \NEWfeature{v1.5}
649 % If the \pkg{listings} package~\cite{listings} is loaded, the \pkg{listings} options \opt{caption1}
650 % and \opt{caption2} are available additionally, where option \opt{caption1} specifies the
651 % caption of the first language and \opt{caption2} of the second one.
652 %
653 % \pagebreak[3]
654 % Example document, using distinctive lists for each language:
655 % \begin{quote}
656 % |\documentclass[a4paper]{article}|\\
657 % |\usepackage{graphicx}|\\
658 % ||\\
659 % |% Use "ngerman" as 1st language, "english" as 2nd one|\\
660 % |\usepackage[english,ngerman]{babel}|\\
661 % ||\\
662 % |% Load the bicaption package with 2nd language set to|\\
663 % |% "english", and list type "figureEnglish" or "tableEnglish"|\\
664 % |\usepackage[lang=english,listtype+=English,font=it]{bicaption}|\\
665 % |\captionsetup{slc=off} % do not center short captions|\\
666 % ||\\
667 % |\usepackage{listings}|\\
668 % ||\\
669 % |% Set German names|\\
670 % |\addto\captionsgerman{%|\\
671 % | \renewcommand\lstlistingname{Quelltext}%|\\
672 % | \renewcommand\lstlistlistingname{Quelltextverzeichnis}%|\\
673 % |}|\\
674 % |\AtBeginDocument{\captionsgerman}% or load listings before babel|\\
675 % ||\\
676 % |% Set English names|\\
677 % |\addto\captionsenglish{%|\\
678 % | \renewcommand\lstlistingname{Listing}%|\\
679 % | \renewcommand\lstlistlistingname{List of Listings}%|\\
680 % |}|\\
681 % ||\\
682 % |\usepackage{newfloat}|\\
683 % |% Define the new floating environment type "lstlistingEnglish"|\\
684 % |% (just to get an extra list for English listing captions)|\\
685 % |\DeclareFloatingEnvironment[fileext=lol2]{lstlistingEnglish}|\\
686 % | [Listing][List of Listings]|\\
687 % ||\\
688 % |\begin{document}|\\
689 % ||\\
690 % |\lstlistoflistings % German|\\
691 % |\listoflstlistingEnglish % English|\\
692 % ||\\
693 % |\clearpage|\\
694 % ||\\
695 % |\begin{lstlisting}|\\
696 % | [language=C,|\\
697 % | caption1=Deutscher Titel,|\\
698 % | caption2=English Title]|\\
699 % | int main()|\\
700 % | {|\\
701 % | printf( "Hello world!\n" );|\\
702 % | return 0;|\\
703 % | }|\\
704 % |\end{lstlisting}|\\
705 % ||\\
706 % |\end{document}|
707 % \end{quote}
708 %
709 % \subsection{Support of the longtable package}
710 % \label{sec:longtable}
711 %
712 % If the \pkg{longtable} package~\cite{longtable} is loaded, |\bicaption| is available
713 % in the \env{longtable} environment as well, e.g.:
714 % \begin{quote}
715 % |\documentclass[a4paper]{article}|\\
716 % ||\\
717 % |% Use "ngerman" as 1st language, "english" as 2nd one|\\
718 % |\usepackage[english,ngerman]{babel}|\\
719 % ||\\
720 % |% Load the bicaption package with 2nd language set to|\\
721 % |% "english"|\\
722 % |\usepackage[lang=english]{bicaption}|\\
723 % ||\\
724 % |\usepackage{longtable}|\\
725 % ||\\
726 % |\begin{document}|\\
727 % ||\\
728 % |\begin{longtable}{ll}|\\
729 % | \bicaption{Deutscher Titel}{English Title}\\|\\
730 % | A & B \\|\\
731 % | C & D \\|\\
732 % | |\ldots\\
733 % |\end{longtable}|\\
734 % ||\\
735 % |\end{document}|
736 % \end{quote}
737 %
738 % \subsection{Support of the subcaption package}
739 % \label{sec:subcaption}
740 %
741 % If the \pkg{subcaption} package~\cite{subcaption} is loaded, these commands are available
742 % additionally:
743 %
744 % \smallskip
745 %
746 % \pagebreak[3]
747 % \DescribeMacro\bisubcaption
748 % Bilingual sub-captions will be typeset by
749 % \begin{quote}
750 % |\bisubcaption|\oarg{list entry \#1}\marg{heading \#1}\\
751 % | |\oarg{list entry \#2}\marg{heading \#2}\\
752 % |\bisubcaption*|\marg{heading \#1}\marg{heading \#2}
753 % \end{quote}
754 % The |\label| should be placed either after this command, or inside the first heading.
755 %
756 % \pagebreak[3]
757 % \DescribeMacro\bisubcaptionbox
758 % Bilingual sub-caption boxes will be typeset by
759 % \begin{quote}
760 % |\bisubcaptionbox|\oarg{list entry \#1}\marg{heading \#1}\\
761 % | |\oarg{list entry \#2}\marg{heading \#2}\\
762 % | |\oarg{width}\oarg{inner-pos}\marg{contents}\\
763 % |\bisubcaptionbox*|\marg{heading \#1}\marg{heading \#2}\\
764 % | |\oarg{width}\oarg{inner-pos}\marg{contents}
765 % \end{quote}
766 % The |\label| should be placed inside the first heading.
767 %
768 % \begingroup\small
769 % (For a description of the optional parameters \meta{width} and \meta{inner-pos}
770 % please take a look at the \pkg{subcaption} package documentation,
771 % \cs{subcaptionbox}.)
772 % \endgroup
773 %
774 % \pagebreak[3]
775 % \subsubsection{A sample document}
776 %
777 % \begin{quote}
778 % |\documentclass[english,ngerman]{article}|\\
779 % |\usepackage{selinput}|\\
780 % |\SelectInputMappings{adieresis={ä},germandbls={ß}}|\\
781 % ||\\
782 % |\usepackage{babel}|\\
783 % |\usepackage[lang=english,font=it]{bicaption}|\\
784 % \iffalse
785 % |\usepackage[format=hang,list=on]{subcaption}|\\
786 % \else
787 % |\usepackage[format=hang]{subcaption}|\\
788 % \fi
789 % ||\\
790 % |\begin{document}|\\
791 % ||\\
792 % \iffalse
793 % |\listoffigures|\\
794 % ||\\
795 % \fi
796 % |\begin{figure}[!htb]|\\
797 % | \centering|\\
798 % | \bisubcaptionbox|\\
799 % | {Teilabbildung A\label{fig:test:A}}|\\
800 % | {Subfigure A}[0.4\textwidth]{IMAGE}%|\\
801 % | \qquad|\\
802 % | \bisubcaptionbox|\\
803 % | {Teilabbildung langer Titel B\label{fig:test:B}}|\\
804 % | {Subfigure long title B}[0.4\textwidth]{IMAGE}%|\\
805 % | \bicaption{Deutscher Titel}{English Title}|\\
806 % | \label{fig:test}|\\
807 % |\end{figure}|\\
808 % ||\\
809 % \iffalse
810 % |\captionsetup{bi-lang=2nd}|\\
811 % ||\\
812 % |\begin{figure}[!htb]|\\
813 % | \centering|\\
814 % | \bisubcaptionbox|\\
815 % | {Teilabbildung A\label{fig:test2:A}}|\\
816 % | {Subfigure A}[0.4\textwidth]{IMAGE}%|\\
817 % | \qquad|\\
818 % | \bisubcaptionbox|\\
819 % | {Teilabbildung langer Titel B\label{fig:test2:B}}|\\
820 % | {Subfigure long title B}[0.4\textwidth]{IMAGE}%|\\
821 % | \bicaption{Deutscher Titel}{English Title}|\\
822 % | \label{fig:test2}|\\
823 % |\end{figure}|\\
824 % ||\\
825 % \fi
826 % |\captionsetup{bi-lang=both}|\\
827 % ||\\
828 % |\begin{figure}[!htb]|\\
829 % | \centering|\\
830 % | \bisubcaptionbox[A]|\\
831 % | {Und eine gaaaanz lange Caption: Teilabbildung A}|\\
832 % | {Subfigure A}[0.4\textwidth]{IMAGE}%|\\
833 % | \qquad|\\
834 % | \bisubcaptionbox[B]|\\
835 % | {Teilabbildung B}|\\
836 % | {Subfigure B}[0.4\textwidth]{IMAGE}%|\\
837 % | \bicaption[Abbildungsverzeichnistitel]|\\
838 % | {Und eine noch viel viel viel|\\
839 % | längere deutsche Beschriftung: Deutscher Titel}|\\
840 % | {Short English heading}|\\
841 % |\end{figure}|\\
842 % ||\\
843 % |\captionsetup{bi-slc=off}|\\
844 % ||\\
845 % |\begin{figure}[!htb]|\\
846 % | \centering|\\
847 % | \bisubcaptionbox[A]|\\
848 % | {Und eine gaaaanz lange Caption: Teilabbildung A}|\\
849 % | {Subfigure A}[0.4\textwidth]{IMAGE}%|\\
850 % | \qquad|\\
851 % | \bisubcaptionbox[B]|\\
852 % | {Teilabbildung B}|\\
853 % | {Subfigure B}[0.4\textwidth]{IMAGE}%|\\
854 % | \bicaption[Abbildungsverzeichnistitel]|\\
855 % | {Und eine noch viel viel viel|\\
856 % | längere deutsche Beschriftung: Deutscher Titel}|\\
857 % | {Short English heading}|\\
858 % |\end{figure}|\\
859 % ||\\
860 % |\captionsetup{slc=off}|\\
861 % ||\\
862 % |\begin{figure}[!htb]|\\
863 % | \centering|\\
864 % | \bisubcaptionbox[A]|\\
865 % | {Und eine gaaaanz lange Caption: Teilabbildung A}|\\
866 % | {Subfigure A}[0.4\textwidth]{IMAGE}%|\\
867 % | \qquad|\\
868 % | \bisubcaptionbox[B]|\\
869 % | {Teilabbildung B}|\\
870 % | {Subfigure B}[0.4\textwidth]{IMAGE}%|\\
871 % | \bicaption[Abbildungsverzeichnistitel]|\\
872 % | {Und eine noch viel viel viel|\\
873 % | längere deutsche Beschriftung: Deutscher Titel}|\\
874 % | {Short English heading}|\\
875 % |\end{figure}|\\
876 % ||\\
877 % |\end{document}|
878 % \end{quote}
879 %
880 % \pagebreak[3]
881 % \bicaptionsetup{lang=german}{lang=english,font=it}
882 % \captionsetup[sub]{format=hang,list=on}
883 %
884 % \iffalse
885 % \listoffigures
886 % \bigskip
887 % \fi
888 %
889 % \begin{minipage}{\linewidth}
890 % \setcaptiontype{figure}
891 % \centering
892 % \bisubcaptionbox
893 % {Teilabbildung A\label{fig:test:A}}
894 % {Subfigure A}[0.4\textwidth]{IMAGE}%
895 % \qquad
896 % \bisubcaptionbox
897 % {Teilabbildung langer Titel B\label{fig:test:B}}
898 % {Subfigure long title B}[0.4\textwidth]{IMAGE}%
899 % \bicaption{Deutscher Titel}{English Title}
900 % \label{fig:test}
901 % \end{minipage}
902 %
903 % \iffalse
904 % \bigskip
905 % \captionsetup{bi-lang=2nd}
906 %
907 % \begin{minipage}{\linewidth}
908 % \setcaptiontype{figure}
909 % \centering
910 % \bisubcaptionbox
911 % {Teilabbildung A\label{fig:test2:A}}
912 % {Subfigure A}[0.4\textwidth]{IMAGE}%
913 % \qquad
914 % \bisubcaptionbox
915 % {Teilabbildung langer Titel B\label{fig:test2:B}}
916 % {Subfigure long title B}[0.4\textwidth]{IMAGE}%
917 % \bicaption{Deutscher Titel}{English Title}
918 % \label{fig:test2}
919 % \end{minipage}
920 % \fi
921 %
922 % \bigskip
923 % \captionsetup{bi-lang=both}
924 %
925 % \begin{minipage}{\linewidth}
926 % \setcaptiontype{figure}
927 % \centering
928 % \bisubcaptionbox[A]
929 % {Und eine gaaaanz lange Caption: Teilabbildung A}
930 % {Subfigure A}[0.4\textwidth]{IMAGE}%
931 % \qquad
932 % \bisubcaptionbox[B]
933 % {Teilabbildung B}
934 % {Subfigure B}[0.4\textwidth]{IMAGE}%
935 % \bicaption[Abbildungsverzeichnistitel]
936 % {Und eine noch viel viel viel
937 % längere deutsche Beschriftung: Deutscher Titel}
938 % {Short English heading}
939 % \end{minipage}
940 %
941 % \bigskip
942 % \captionsetup{bi-slc=off}
943 %
944 % \begin{minipage}{\linewidth}
945 % \setcaptiontype{figure}
946 % \centering
947 % \bisubcaptionbox[A]
948 % {Und eine gaaaanz lange Caption: Teilabbildung A}
949 % {Subfigure A}[0.4\textwidth]{IMAGE}%
950 % \qquad
951 % \bisubcaptionbox[B]
952 % {Teilabbildung B}
953 % {Subfigure B}[0.4\textwidth]{IMAGE}%
954 % \bicaption[Abbildungsverzeichnistitel]
955 % {Und eine noch viel viel viel
956 % längere deutsche Beschriftung: Deutscher Titel}
957 % {Short English heading}
958 % \end{minipage}
959 %
960 % \bigskip
961 % \captionsetup{slc=off}
962 %
963 % \begin{minipage}{\linewidth}
964 % \setcaptiontype{figure}
965 % \centering
966 % \bisubcaptionbox[A]
967 % {Und eine gaaaanz lange Caption: Teilabbildung A}
968 % {Subfigure A}[0.4\textwidth]{IMAGE}%
969 % \qquad
970 % \bisubcaptionbox[B]
971 % {Teilabbildung B}
972 % {Subfigure B}[0.4\textwidth]{IMAGE}%
973 % \bicaption[Abbildungsverzeichnistitel]
974 % {Und eine noch viel viel viel
975 % längere deutsche Beschriftung: Deutscher Titel}
976 % {Short English heading}
977 % \end{minipage}
978 %
979 % \iffalse
980 % --------------------------------------------------------------------------- %
981 % \fi
982 %
983 % \StopEventually{%^^A
984 % \begin{thebibliography}{9}
985 %
986 % \bibitem{caption}
987 % Axel Sommerfeldt:\\
988 % \href{http://www.ctan.org/pkg/caption}%
989 % {\emph{Customising captions of floating environments}},\\
990 % 2022/01/07
991 %
992 % \bibitem{listings}
993 % Carsten Heinz \& Brooks Moses:\\
994 % \href{http://www.ctan.org/pkg/listings}%
995 % {\emph{The Listings Package}},\\
996 % 2007/02/22
997 %
998 % \bibitem{longtable}
999 % David Carlisle:\\
1000 % \href{http://www.ctan.org/pkg/longtable}%
1001 % {\emph{The longtable package}},\\
1002 % 2004/02/01
1003 %
1004 % \bibitem{subcaption}
1005 % Axel Sommerfeldt:\\
1006 % \href{http://www.ctan.org/pkg/subcaption}%
1007 % {\emph{The subcaption package}},\\
1008 % 2022/01/07
1009 %
1010 % \bibitem{TLC2}
1011 % Frank Mittelbach and Michel Goossens:\\
1012 % \newblock {\em The {\LaTeX} Companion (2nd.~Ed.)},\\
1013 % \newblock Addison-Wesley, 2004.
1014 %
1015 % \end{thebibliography}
1016 % }
1017 %
1018 % \iffalse
1019 % --------------------------------------------------------------------------- %
1020 % \fi
1021 %
1022 % \DoNotIndex{\\,\_,\ ,\@@par}
1023 % \DoNotIndex{\@bsphack}
1024 % \DoNotIndex{\@car,\@cdr,\@classoptionslist,\@cons,\@currext,\@currname}
1025 % \DoNotIndex{\@ehc,\@ehd,\@empty,\@esphack,\@expandtwoargs}
1026 % \DoNotIndex{\@for,\@firstofone,\@firstoftwo}
1027 % \DoNotIndex{\@gobble,\@gobblefour,\@gobbletwo,\@hangfrom}
1028 % \DoNotIndex{\if@minipage,\@ifnextchar,\@ifpackagelater,\@ifpackageloaded}
1029 % \DoNotIndex{\@ifstar,\@ifundefined,\@latex@error,\@namedef,\@nameuse}
1030 % \DoNotIndex{\@onlypreamble,\@parboxrestore,\@plus,\@ptionlist}
1031 % \DoNotIndex{\@removeelement,\@restorepar,\@secondoftwo,\@setpar}
1032 % \DoNotIndex{\@tempa,\@tempboxa,\@tempdima,\@tempdimb,\@tempdimc,\@tempb,\@tempc}
1033 % \DoNotIndex{\@testopt}
1034 % \DoNotIndex{\@undefined,\@unprocessedoptions,\@unusedoptionlist}
1035 % \DoNotIndex{\p@,\z@}
1036 % \DoNotIndex{\active,\addtocounter,\addtolength,\advance,\aftergroup}
1037 % \DoNotIndex{\baselineskip,\begin,\begingroup,\bfseries,\box}
1038 % \DoNotIndex{\catcode,\centering,\changes,\csname,\def,\divide,\do,\downarrow}
1039 % \DoNotIndex{\edef,\else,\empty,\end,\endcsname,\endgraf,\endgroup,\expandafter}
1040 % \DoNotIndex{\fi,\footnotesize,\global}
1041 % \DoNotIndex{\hangindent,\hbox,\hfil,\hsize,\hskip,\hspace,\hss}
1042 % \DoNotIndex{\ifcase,\ifdim,\ifnum,\ifodd,\ifvoid,\ifvmode}
1043 % \DoNotIndex{\ifx,\ignorespaces,\itshape}
1044 % \DoNotIndex{\kernel@ifnextchar}
1045 % \DoNotIndex{\Large,\large,\leavevmode,\leftmargini,\leftskip,\let,\linewidth}
1046 % \DoNotIndex{\llap,\long,\m@ne,\margin,\mdseries,\message}
1047 % \DoNotIndex{\newcommand,\newdimen,\newlength,\newline,\newif,\newsavebox}
1048 % \DoNotIndex{\next,\nobreak,\nobreakspace,\noexpand,\noindent,\numberline}
1049 % \DoNotIndex{\normalcolor,\normalfont,\normalsize,\or,\par,\parbox,\parfillskip}
1050 % \DoNotIndex{\parindent,\parskip,\prevdepth,\protect,\protected@edef,\protected@write}
1051 % \DoNotIndex{\providecommand,\quad}
1052 % \DoNotIndex{\raggedleft,\raggedright,\relax,\renewcommand,\RequirePackage}
1053 % \DoNotIndex{\rightskip,\rmfamily}
1054 % \DoNotIndex{\sbox,\scriptsize,\scshape,\setbox,\setlength,\sffamily,\slshape}
1055 % \DoNotIndex{\small,\string,\space,\strut}
1056 % \DoNotIndex{\textheight,\the,\toks@,\typeout,\ttfamily}
1057 % \DoNotIndex{\unvbox,\uparrow,\upshape,\usebox,\usepackage}
1058 % \DoNotIndex{\value,\vbox,\vsize,\vskip,\wd,\width,\z@skip}
1059 % \DoNotIndex{\AtBeginDocument,\AtEndOfPackage,\CurrentOption,\DeclareOption}
1060 % \DoNotIndex{\ExecuteOptions,\GenericWarning,\IfFileExists,\InputIfFileExists}
1061 % \DoNotIndex{\NeedsTeXFormat,\MessageBreak}
1062 % \DoNotIndex{\PackageError,\PackageInfo,\PackageWarning,\PackageWarningNoLine}
1063 % \DoNotIndex{\PassOptionsToPackage,\ProcessOptions,\ProvidesPackage}
1064 %
1065 % \iffalse
1066 % --------------------------------------------------------------------------- %
1067 % \fi
1068 %
1069 % \setlength{\parskip}{0pt plus 1pt}
1070 % \changes{v0.1}{2010/07/13}{Initial version}
1071 % \changes{v0.2}{2010/07/13}{Check for caption package added}
1072 % \changes{v0.3}{2010/07/13}{Usage of \cs{caption@applyfont} added}
1073 % \changes{v0.4}{2010/07/13}{``Singlelinecheck'' fixed}
1074 % \changes{v0.5}{2010/07/13}{Options \opt{bi-first} and \opt{bi-second} added}
1075 % \changes{v0.6}{2010/07/13}{Option \opt{bi-slc} added}
1076 % \changes{v0.7}{2010/07/13}{Option \opt{bi-lang} added}
1077 % \changes{v0.8}{2010/09/04}{Adapted to current version of the caption kernel}
1078 % \changes{v0.9}{2010/09/17}{Option \opt{bi-swap} added}
1079 % \changes{v0.9a}{2011/07/13}{Warning regarding \pkg{babel} package added}
1080 %
1081 % \newcommand*\Note[2][Note]{\par{\small\emph{#1:} #2}}
1082 %
1083 % \iffalse
1084 % --------------------------------------------------------------------------- %
1085 % \fi
1086 %
1087 % \clearpage
1088 % \section{The implementation}
1089 %
1090 % \iffalse
1091 %<*package>
1092 % \fi
1093 %
1094 % \subsection{Identification}
1095 %
1096 % We need at least \LaTeX2e\ version 1994/12/01.
1097 % \begin{macrocode}
1098 \NeedsTeXFormat{LaTeX2e}[1994/12/01]
1099 % \end{macrocode}
1100 %
1101 % Bypass the release declarations in case the \LaTeX\ kernel doesn’t know how to deal with them
1102 % (as suggested by \url{https://www.latex-project.org/publications/2018-FMi-TUB-tb122mitt-version-rollback.pdf}).
1103 % \begin{macrocode}
1104 \providecommand\DeclareRelease[3]{}
1105 \providecommand\DeclareCurrentRelease[2]{}
1106 % \end{macrocode}
1107 %
1108 % Declare all supported releases.
1109 % \begin{macrocode}
1110 \DeclareCurrentRelease{v1}{2011/07/13}
1111 % \end{macrocode}
1112 %
1113 % Identify the current version of the package.
1114 % \begin{macrocode}
1115 \ProvidesPackage{bicaption}[2023/02/19 v1.6 Bilingual Captions (AR)]
1116 % \end{macrocode}
1117 %
1118 % Since we base on the \pkg{caption} package we load it here.
1119 % \begin{macrocode}
1120 \RequirePackage{caption}[2011/11/10] % we need at least v3.2e
1121 % \end{macrocode}
1122 %
1123 % \bigskip
1124 %
1125 % \pagebreak[3]
1126 % \subsection{Initial code}
1127 %
1128 % \begin{macro}{\bicaption@Info}
1129 % |\bicaption@Info|\marg{message}
1130 % \begin{macrocode}
1131 \newcommand*\bicaption@Info[1]{%
1132 \PackageInfo{bicaption}{#1}}
1133 % \end{macrocode}
1134 % \end{macro}
1135 % \begin{macro}{\bicaption@InfoNoLine}
1136 % |\bicaption@InfoNoLine|\marg{message}\par
1137 % \Note{The \cs{@gobble} at the end of the 2nd argument of
1138 % \cs{PackageInfo} suppresses the line number info.
1139 % See TLC2\cite{TLC2}, A.4.7, p885 for details.}
1140 % \begin{macrocode}
1141 \newcommand*\bicaption@InfoNoLine[1]{%
1142 \PackageInfo{bicaption}{#1\@gobble}}
1143 % \end{macrocode}
1144 % \end{macro}
1145 %
1146 % \begin{macro}{\bicaption@Warning}
1147 % |\bicaption@Warning|\marg{message}
1148 % \begin{macrocode}
1149 \newcommand*\bicaption@Warning[1]{%
1150 \bicaption@WarningNoLine{#1\on@line}}
1151 % \end{macrocode}
1152 % \end{macro}
1153 % \begin{macro}{\bicaption@WarningNoLine}
1154 % |\bicaption@WarningNoLine|\marg{message}
1155 % \begin{macrocode}
1156 \newcommand*\bicaption@WarningNoLine[1]{%
1157 \PackageWarning{bicaption}{#1.^^J\bicaption@wh\@gobbletwo}}
1158 % \end{macrocode}
1159 % \begin{macrocode}
1160 \newcommand*\bicaption@wh{%
1161 See the `bicaption' package documentation for explanation.}
1162 % \end{macrocode}
1163 % \end{macro}
1164 %
1165 % \begin{macro}{\bicaption@Error}
1166 % |\bicaption@Error|\marg{message}
1167 % \begin{macrocode}
1168 \newcommand*\bicaption@Error[1]{%
1169 \PackageError{bicaption}{#1}{\caption@@eh{bicaption}}}
1170 % \end{macrocode}
1171 % \begin{macrocode}
1172 \providecommand*\caption@@eh[1]{%
1173 If you do not understand this error, please take a closer look\MessageBreak
1174 at the documentation of the `#1' package, especially the\MessageBreak
1175 section about errors.\MessageBreak\@ehc}
1176 % \end{macrocode}
1177 % \end{macro}
1178 %
1179 % \pagebreak[3]
1180 % \subsection{Declaration of options}
1181 %
1182 % The option |bi-lang| will setup which language(s) will actually be typeset,
1183 % the first one, the second one, or both of them.
1184 % \begin{macrocode}
1185 \newcount\bicaption@lang
1186 \DeclareCaptionOption{bi-lang}{%
1187 \caption@ifinlist{#1}{0,all,both}{%
1188 \bicaption@lang=0\relax
1189 }{\caption@ifinlist{#1}{1,1st,first}{%
1190 \bicaption@lang=1\relax
1191 }{\caption@ifinlist{#1}{2,2nd,second}{%
1192 \bicaption@lang=2\relax
1193 }{%
1194 \bicaption@Error{Undefined bi-lang value `#1'}%
1195 }}}}
1196 % \end{macrocode}
1197 %
1198 % The option |bi-singlelinecheck| will setup if a single check will be used
1199 % for both languages (|=on|),
1200 % or if both languages will be checked individually (|=off|).
1201 % \begin{macrocode}
1202 \DeclareCaptionOption{bi-singlelinecheck}[1]{%
1203 \caption@set@bool\bicaption@ifslc{#1}}
1204 \DeclareCaptionOption{bi-slc}[1]{%
1205 \caption@set@bool\bicaption@ifslc{#1}}
1206 % \end{macrocode}
1207 %
1208 % The option |bi-swap| will swap the primary and secondary language,
1209 % making the first language the second one and vice versa.
1210 % \begin{macrocode}
1211 \DeclareCaptionOption{bi-swap}[1]{%
1212 \caption@set@bool\bicaption@ifswap{#1}}
1213 % \end{macrocode}
1214 %
1215 % The option |bi-separator| will setup the separator between
1216 % the two bi-lingual captions.
1217 % \begin{macrocode}
1218 \DeclareCaptionOption{bi-separator}[1]{%
1219 \caption@set{biseparator}{#1}}
1220 % \end{macrocode}
1221 % \begin{macrocode}
1222 \providecommand*\caption@set[2]{%
1223 \@ifundefined{caption@#1@#2}%
1224 {\caption@Error{Undefined #1 `#2'}}%
1225 {\expandafter\let\csname caption@#1\expandafter\endcsname\csname caption@#1@#2\endcsname}}
1226 % \end{macrocode}
1227 %
1228 % \begin{macro}{\DeclareBiCaptionSeparator}
1229 % \changes{v1.3}{2020/10/25}{This macro added}
1230 % |\DeclareBiCaptionSeparator|\marg{name}\marg{code}
1231 % \begin{macrocode}
1232 \newcommand\DeclareBiCaptionSeparator[2]{%
1233 \caption@decl{biseparator}{#1}{#2}}
1234 \@onlypreamble\DeclareBiCaptionSeparator
1235 % \end{macrocode}
1236 % \begin{macrocode}
1237 \providecommand*\caption@decl[2]{%
1238 \global\long\expandafter\def\csname caption@#1@#2\endcsname}
1239 % \end{macrocode}
1240 % \end{macro}
1241 %
1242 % There are four pre-defined separators, called `none',
1243 % `smallskip', `medskip', and `bigskip'.
1244 % \begin{macrocode}
1245 \DeclareBiCaptionSeparator{none}{}
1246 \DeclareBiCaptionSeparator{smallskip}{\smallskip}
1247 \DeclareBiCaptionSeparator{medskip}{\medskip}
1248 \DeclareBiCaptionSeparator{bigskip}{\bigskip}
1249 % \end{macrocode}
1250 %
1251 % The default separator usually maps to `none'.
1252 % \begin{macrocode}
1253 \caption@ifundefined\SetCaptionDefault
1254 {\def\caption@biseparator@default{\caption@biseparator@none}}
1255 {\SetCaptionDefault{biseparator}{none}}
1256 % \end{macrocode}
1257 %
1258 % The option |lang=|\meta{language} will setup the language of the caption.
1259 % We can't set the language immediately because otherwise we will get in trouble, e.g. when
1260 % using the \pkg{microtype} package via |\usepackage[babel]{microtype}|.
1261 % So we store the selected language to |\bicaption@language| instead and will set it later on.
1262 % But this has a drawback, option settings which will be overwritten by the selection of
1263 % the language do not work correctly anymore. Therefore we will save specific options
1264 % and set them (again) after setting the language.
1265 % \begin{macrocode}
1266 \DeclareCaptionOption{lang}{%
1267 \caption@ifundefined\bicaption@language
1268 \bicaption@language@setupkeys
1269 \relax
1270 \edef\bicaption@language{#1}%
1271 \let\bicaption@language@setoptions\@empty
1272 \global\let\bicaption@language@value\bicaption@language}
1273 % \end{macrocode}
1274 % Map |language=| to |lang=|.
1275 % \begin{macrocode}
1276 \let\KV@caption@language\KV@caption@lang
1277 % \end{macrocode}
1278 %
1279 % \begin{macro}{\DeclareCaptionLangOption}
1280 % \changes{v1.2}{2016/03/27}{This macro added}
1281 % |\DeclareCaptionLangOption|\marg{option key}\par
1282 % Saves the gives \meta{option key} to the list |\bicaption@language@keylist|.
1283 % These options will be stored and set (again) after setting the language.
1284 % \begin{macrocode}
1285 \newcommand*\bicaption@language@keylist{}
1286 % \end{macrocode}
1287 % \begin{macrocode}
1288 \newcommand*\DeclareCaptionLangOption[1]{%
1289 \@ifundefined{KV@caption@#1}%
1290 {\bicaption@Error{Undefined caption option `#1'}}%
1291 {\@cons\bicaption@language@keylist{{#1}}}}
1292 % \end{macrocode}
1293 % \begin{macrocode}
1294 \let\DeclareCaptionLanguageOption\DeclareCaptionLangOption
1295 % \end{macrocode}
1296 % \begin{macrocode}
1297 \newcommand*\bicaption@language@setupkeys{%
1298 \def\@elt##1{%
1299 \expandafter\let\csname KV@bicaption@##1\expandafter\endcsname
1300 \csname KV@caption@##1\endcsname
1301 \@namedef{KV@caption@##1}{\bicaption@KV{##1}}}%
1302 \bicaption@language@keylist
1303 \let\@elt\relax}
1304 % \end{macrocode}
1305 % \begin{macrocode}
1306 \newcommand\bicaption@KV[2]{%
1307 \@bicaption@KV{#1}{#2}%
1308 \l@addto@macro\bicaption@language@setoptions{%
1309 \@bicaption@KV{#1}{#2}}}
1310 % \end{macrocode}
1311 % \begin{macrocode}
1312 \newcommand\@bicaption@KV[1]{%
1313 \@nameuse{KV@bicaption@#1}}
1314 % \end{macrocode}
1315 % \end{macro}
1316 %
1317 % The only option affected I'm aware off is the |name=| option, so this will be saved
1318 % and set later on.
1319 % \begin{macrocode}
1320 \DeclareCaptionLangOption{name}
1321 % \end{macrocode}
1322 %
1323 % \begin{macro}{\bicaption@selectlanguage}
1324 % \changes{v1.0}{2011/08/31}{Starred variant added}
1325 % \changes{v1.1}{2012/04/09}{Support of \cs{selectcaptionlanguage} added}
1326 % \changes{v1.1}{2016/03/25}{Patching of \cs{caption@applyfont} replaced by \cs{caption@beginhook}}
1327 % \changes{v1.1}{2016/03/27}{Usage of \cs{bicaption@language@setoptions} added}
1328 % |\bicaption@selectlanguage|\marg{font-or-list-entry}\par
1329 % Set the language (stored in |\bi|\-|caption@lan|\-|guage|)
1330 % via |\select|\-|bi|\-|caption|\-|lan|\-|guage|.
1331 % \begin{macrocode}
1332 \newcommand*\bicaption@selectlanguage[1]{%
1333 \caption@ifundefined\bicaption@language{}{%
1334 \expandafter\selectcaptionlanguage\expandafter#1\expandafter
1335 {\bicaption@language}%
1336 \bicaption@language@setoptions}}
1337 % \end{macrocode}
1338 % |\caption@beginhook| (of the \pkg{caption} package kernel) will be extended here
1339 % so the language setting will actually take effect.
1340 % \begin{macrocode}
1341 \g@addto@macro\caption@beginhook{%
1342 \bicaption@selectlanguage\@firstoftwo}
1343 % \end{macrocode}
1344 % \end{macro}
1345 %
1346 % \begin{macro}{\selectcaptionlanguage}
1347 % |\selectcaptionlanguage|\marg{font-or-list-entry}\marg{language}
1348 % will finally be used to set up the language.
1349 % \begin{macrocode}
1350 \providecommand*\selectcaptionlanguage[1]{%
1351 #1\select@language\selectlanguage}
1352 % \end{macrocode}
1353 % \end{macro}
1354 %
1355 % \pagebreak[3]
1356 % \subsection{Execution of options}
1357 %
1358 % Setup default values for |bi-lang|, |bi-single|\-|line|\-|check|,
1359 % |bi-swap|, and |bi-separator|.
1360 % \begin{macrocode}
1361 \caption@ExecuteOptions{caption}{bi-lang=0,bi-slc=1,bi-swap=0,bi-separator=default}
1362 % \end{macrocode}
1363 %
1364 % Set the language for the first caption.
1365 % (Since \version{1.5a} we do this |\At|\-|Begin|\-|Document| so
1366 % |\caption|\-|main|\-|language| could be defined \emph{after} loading the
1367 % \pkg{bicaption} package or \pkg{babel} or \pkg{polyglossia}
1368 % could be loaded \emph{after} the \pkg{bicaption} package.)
1369 % \begin{macrocode}
1370 \AtBeginDocument{%
1371 \ifcsname captionmainlanguage\endcsname
1372 \bicaption@InfoNoLine{%
1373 Main language is set to \captionmainlanguage}%
1374 \else
1375 \bicaption@setmainlanguage
1376 \fi
1377 % \end{macrocode}
1378 % \begin{macrocode}
1379 \ifcsname captionmainlanguage\endcsname
1380 \captionsetup*[bi-first]{lang=\captionmainlanguage}%
1381 \else
1382 \ifcsname bicaption@language@value\endcsname % option "lang=" was used
1383 \expandafter\bicaption@Warning
1384 \else
1385 \expandafter\bicaption@Info
1386 \fi
1387 {Main language is not set}%
1388 \fi}
1389 % \end{macrocode}
1390 %
1391 % \begin{macro}{\bicaption@setmainlanguage}
1392 % \changes{v1.5a}{2011/08/31}{This macro added as encapsulation of setting \cs{captionmainlanguage}}
1393 % |\bicaption@setmainlanguage| is used to define
1394 % |\caption|\-|main|\-|language| if not already done.
1395 % \begin{macrocode}
1396 \newcommand*\bicaption@setmainlanguage{%
1397 \ifcsname bbl@main@language\endcsname
1398 \bicaption@InfoNoLine{%
1399 babel found, main language is \bbl@main@language}%
1400 \let\captionmainlanguage\bbl@main@language
1401 \else\ifcsname xpg@main@language\endcsname
1402 \bicaption@InfoNoLine{%
1403 polyglossia found, main language is \xpg@main@language}%
1404 \let\captionmainlanguage\xpg@main@language
1405 \fi\fi}
1406 \@onlypreamble\bicaption@setmainlanguage
1407 % \end{macrocode}
1408 % \end{macro}
1409 %
1410 % We use |\caption@Process|\-|Options| here to add the options to the `|bi-second|' option
1411 % list instead of executing them immediately.
1412 % \begin{macrocode}
1413 \caption@SetupOptions{bicaption}{\captionsetup*[bi-second]{#2}}%
1414 \caption@ProcessOptions*{bicaption}
1415 % \end{macrocode}
1416 %
1417 % \pagebreak[3]
1418 % \subsection{Main code}
1419 %
1420 % \begin{macro}{\caption@addcontentsline}
1421 % \changes{v1.0}{2011/08/31}{Redefinition of \cs{caption@kernel@addcontentsline} added}
1422 % \changes{v1.0b}{2012/01/15}{\cs{caption@kernel@addcontentsline} changed to \cs{caption@addcontentsline}}
1423 % \changes{v1.1}{2016/02/01}{Adaption to \pkg{longtable} package added}
1424 % We patch |\caption@add|\-|contents|\-|line| (of the \pkg{caption} package kernel)
1425 % so |bi|\-|caption@add|\-|contents|\-|line| will be used for bilingual captions instead.
1426 % \begin{macrocode}
1427 \let\bicaption@addcontentsline@ORI\caption@addcontentsline
1428 \renewcommand*\caption@addcontentsline[2]{%
1429 % \end{macrocode}
1430 % \begin{macrocode}
1431 \bicaption@LT@setup
1432 \global\let\bicaption@LT@setup\relax
1433 % \end{macrocode}
1434 % \begin{macrocode}
1435 \caption@ifundefined\bicaption@lentry
1436 {\bicaption@addcontentsline@ORI{#1}{#2}}%
1437 {\expandafter\bicaption@addcontentsline\expandafter
1438 {\bicaption@lentry}{#1}{#2}%
1439 \global\let\bicaption@lentry\@undefined}}
1440 % \end{macrocode}
1441 % \end{macro}
1442 %
1443 % \begin{macro}{\bicaption@addcontentsline}
1444 % \changes{v1.0}{2011/08/31}{This macro added}
1445 % \changes{v1.1}{2013/03/10}{Bugfix: Delayed usage of \cs{caption@addsubcontentslines} added}
1446 % |\bicaption@addcontentsline|\marg{list entry \#2}\marg{type}\marg{list entry \#1}\par
1447 % Typeset both captions using the original version of |\caption@add|\-|contents|\-|line|.
1448 % \begin{macrocode}
1449 \newcommand\bicaption@addcontentsline[3]{%
1450 \begingroup
1451 \let\caption@addsubcontentslines\@gobble
1452 % \end{macrocode}
1453 % Execute the options setup with |\captionsetup[bi]{|\ldots|}|.
1454 % \begin{macrocode}
1455 \caption@setoptions{bi}%
1456 % \end{macrocode}
1457 % Do the first list entry, if requested.
1458 % \begin{macrocode}
1459 \ifnum\bicaption@lang=2\relax \else
1460 \begingroup
1461 \caption@setoptions{bi-first}%
1462 \bicaption@@addcontentsline{#2}{#3}%
1463 \endgroup
1464 \fi
1465 % \end{macrocode}
1466 % Do the second list entry, if requested.
1467 % \begin{macrocode}
1468 \ifnum\bicaption@lang=1\relax \else
1469 \begingroup
1470 \caption@setoptions{bi-second}%
1471 \bicaption@@addcontentsline{#2}{#1}%
1472 \endgroup
1473 \fi
1474 % \end{macrocode}
1475 % \begin{macrocode}
1476 \endgroup
1477 \caption@addsubcontentslines{#2}}
1478 % \end{macrocode}
1479 % \begin{macrocode}
1480 \newcommand*\bicaption@@addcontentsline[2]{%
1481 \caption@ifcontentsline{#2}{%
1482 \bicaption@selectlanguage\@secondoftwo
1483 \bicaption@addcontentsline@ORI{#1}{#2}}}
1484 % \end{macrocode}
1485 % \end{macro}
1486 %
1487 % \begin{macro}{\caption@@make}
1488 % \changes{v1.4}{2020/12/25}{Fallback code of \cs{caption@@make@} added}
1489 % We redefine |\caption@@make| (of the \pkg{caption} package kernel)
1490 % so |\bi|\-|caption@@make| will be used for bilingual captions instead.
1491 % \begin{macrocode}
1492 \caption@ifundefined\caption@@make@
1493 {\let\caption@@make@\caption@@make}
1494 {}
1495 % \end{macrocode}
1496 % \begin{macrocode}
1497 \renewcommand\caption@@make[2]{%
1498 \caption@ifundefined\bicaption@text
1499 {\begingroup
1500 \caption@@make@{#1}{#2}%
1501 \endgroup}%
1502 {\expandafter\bicaption@@make\expandafter
1503 {\bicaption@text}{#1}{#2}%
1504 \global\let\bicaption@text\@undefined}%
1505 % \end{macrocode}
1506 % \begin{macrocode}
1507 \@nameuse{caption@@make@epilogue}}
1508 % \end{macrocode}
1509 % \end{macro}
1510 %
1511 % \begin{macro}{\bicaption@@make}
1512 % \changes{v1.1}{2015/09/16}{\cs{bicaption@label} replaced by \cs{caption@thelabel}}
1513 % \changes{v1.3}{2020/10/25}{Usage of \cs{caption@biseparator} added}
1514 % \changes{v1.4}{2020/12/25}{Definitions of \cs{bicaption@slc} and \cs{caption@setsinglelinecheck} added (fallback)}
1515 % \changes{v1.4a}{2020/12/26}{Clearance of \cs{caption@thelabel} replaced by \cs{bicaption@clrlabel}}
1516 % |\bicaption@@make|\marg{text \#2}\marg{label}\marg{text \#1}\par
1517 % Typeset both captions using the original version of \cs{caption@@make}.
1518 % \begin{macrocode}
1519 \newcommand\bicaption@@make[3]{%
1520 % \end{macrocode}
1521 % Execute the options setup with |\captionsetup[bi]{|\ldots|}|.
1522 % \begin{macrocode}
1523 \caption@setoptions{bi}%
1524 % \end{macrocode}
1525 % Perform the common single-line-check for both captions, if requested.
1526 % \begin{macrocode}
1527 \ifnum\bicaption@lang=0\relax
1528 \bicaption@ifslc
1529 {\bicaption@slc{#2}{#3}{}{\caption@setsinglelinecheck0}%
1530 \bicaption@slc{#2}{#1}{}{\caption@setsinglelinecheck0}}%
1531 {}%
1532 \fi
1533 % \end{macrocode}
1534 % Typeset the first caption, if requested.
1535 % (Otherwise we only apply the label of it.)
1536 % \begin{macrocode}
1537 \ifnum\bicaption@lang=2\relax
1538 \caption@thelabel
1539 \let\bicaption@tempa\relax
1540 \else
1541 \begingroup
1542 \caption@setoptions{bi-first}%
1543 \caption@@make@{#2}{#3}%
1544 \endgroup
1545 \def\bicaption@tempa{\bicaption@separator\caption@biseparator}%
1546 \fi
1547 % \end{macrocode}
1548 % Typeset the second caption, if requested.
1549 % \begin{macrocode}
1550 \ifnum\bicaption@lang=1\relax
1551 \else
1552 \bicaption@tempa
1553 \begingroup
1554 \caption@setoptions{bi-second}%
1555 \caption@@make@{#2}{#1}%
1556 \endgroup
1557 \fi
1558 % \end{macrocode}
1559 % \begin{macrocode}
1560 \global\bicaption@clrlabel}
1561 % \end{macrocode}
1562 % \begin{macrocode}
1563 \newcommand*\bicaption@separator{\par}
1564 % \end{macrocode}
1565 % \begin{macrocode}
1566 \caption@ifundefined\caption@@slc
1567 {\newcommand\bicaption@slc{\caption@slc}}
1568 {\newcommand\bicaption@slc[2]{\caption@@slc{#1}{#2}{\captionwidth}}}
1569 % \end{macrocode}
1570 % \begin{macrocode}
1571 \providecommand*\caption@setsinglelinecheck{%
1572 \caption@set@bool\caption@ifslc}
1573 % \end{macrocode}
1574 % \end{macro}
1575 %
1576 % \pagebreak[3]
1577 % \subsubsection{The \cs{bicaption} commands}
1578 %
1579 % \begin{macro}{\bicaptionsetup}
1580 % \changes{v1.6}{2022/04/18}{This macro added}
1581 % |\bicaptionsetup*|\oarg{type}\marg{keyval-list of options 1}\marg{keyval-list of options 2}\\
1582 % applies the given list of options.
1583 % \begin{macrocode}
1584 \newcommand*\bicaptionsetup{%
1585 \caption@teststar\@bicaptionsetup*{}}
1586 % \end{macrocode}
1587 % \begin{macrocode}
1588 \newcommand*\@bicaptionsetup[1]{%
1589 \kernel@ifnextchar[%]
1590 {\bicaption@setup@options{#1}}%
1591 {\bicaption@setup*}}
1592 % \end{macrocode}
1593 % \begin{macrocode}
1594 \def\bicaption@setup@options#1[#2]{%
1595 \bicaption@setup{#1[{#2}]}}
1596 % \end{macrocode}
1597 % \begin{macrocode}
1598 \newcommand*\bicaption@setup[2]{%
1599 \captionsetup#1[bi-first]{#2}%
1600 \captionsetup#1[bi-second]}
1601 % \end{macrocode}
1602 % \end{macro}
1603 %
1604 % \begin{macro}{\bicaption}
1605 % |\bicaption*|\oarg{list entry \#1}\marg{text \#1}\oarg{list entry \#2}\marg{text \#2}
1606 % \begin{macrocode}
1607 \newcommand\bicaption{\@bicaption\caption}
1608 % \end{macrocode}
1609 % \end{macro}
1610 %
1611 % \begin{macro}{\bicaptionbox}
1612 % \changes{v1.0}{2011/08/31}{This macro added}
1613 % |\bicaptionbox*|\oarg{entry \#1}\marg{text \#1}\oarg{entry \#2}\marg{text \#2}%
1614 % \oarg{\ldots}\marg{\ldots}
1615 % \begin{macrocode}
1616 \newcommand\bicaptionbox{\@bicaption\captionbox}
1617 % \end{macrocode}
1618 % \end{macro}
1619 %
1620 % \begin{macro}{\bisubcaption}
1621 % |\bisubcaption*|\oarg{list entry \#1}\marg{text \#1}\oarg{list entry \#2}\marg{text \#2}
1622 % \begin{macrocode}
1623 \newcommand\bisubcaption{\@bicaption\subcaption}
1624 \let\subbicaption\bisubcaption
1625 % \end{macrocode}
1626 % \end{macro}
1627 %
1628 % \begin{macro}{\bisubcaptionbox}
1629 % |\bisubcaptionbox*|\oarg{entry \#1}\marg{text \#1}\oarg{entry \#2}\marg{text \#2}%
1630 % \oarg{\ldots}\marg{\ldots}
1631 % \begin{macrocode}
1632 \newcommand\bisubcaptionbox{\@bicaption\subcaptionbox}
1633 \let\subbicaptionbox\bisubcaptionbox
1634 % \end{macrocode}
1635 % \end{macro}
1636 %
1637 % \begin{macro}{\@bicaption}
1638 % \changes{v1.0}{2011/08/31}{Optional parameter \meta{list entry \#2} added}
1639 % \changes{v1.1}{2015/09/16}{\cs{bicaption@getlabel} replaced by \cs{caption@getlabel}}
1640 % \changes{v1.4}{2020/12/25}{Usage of \cs{caption@getlabel} replaced by \cs{bicaption@getlabel}}
1641 % |\@bicaption|\marg{cmd}*\oarg{entry \#1}\marg{text \#1}\oarg{entry \#2}\marg{text \#2}\ldots
1642 % \begin{macrocode}
1643 \newcommand*\@bicaption[1]{%
1644 \@ifstar
1645 {\def\bicaption@cmd{\bicaption@star{#1}}%
1646 \@@bicaption}%
1647 {\def\bicaption@cmd{#1}%
1648 \caption@dblarg\@@@bicaption}}
1649 % \end{macrocode}
1650 % \begin{macrocode}
1651 \newcommand\@@bicaption[1]{%
1652 \@@@@bicaption{}{#1}[]}
1653 % \end{macrocode}
1654 % \begin{macrocode}
1655 \long\def\@@@bicaption[#1]#2{%
1656 \caption@dblarg{\@@@@bicaption{#1}{#2}}}
1657 % \end{macrocode}
1658 % \begin{macrocode}
1659 \long\def\@@@@bicaption#1#2[#3]#4{%
1660 \bicaption@getlabel{#2}%
1661 \bicaption@ifswap
1662 {\bicaption@set{#1}{#2}%
1663 \bicaption@cmd[{#3}]{#4}}%
1664 {\bicaption@set{#3}{#4}%
1665 \bicaption@cmd[{#1}]{#2}}}
1666 % \end{macrocode}
1667 % \begin{macrocode}
1668 \long\def\bicaption@star#1[#2]{#1*}
1669 % \end{macrocode}
1670 % \end{macro}
1671 %
1672 % \begin{macro}{\bicaption@getlabel}
1673 % \changes{v1.0}{2011/09/03}{\cs{label} can have optional arguments now}
1674 % \changes{v1.4}{2020/12/25}{This macro re-added}
1675 % |\bicaption@getlabel|\marg{text}\\
1676 % gets the label command out of the given caption text and stores it to |\caption@the|\-|label|.
1677 % It uses |\caption@get|\-|label| for this purpose which interface unfortunately has changed over time.
1678 % (Changing the interface was a bad idea in the first place but now it is as it is).
1679 % \begin{macrocode}
1680 \@ifundefined{caption@getlabel}{%
1681 % \end{macrocode}
1682 % \begin{macrocode}
1683 \newcommand\bicaption@getlabel[1]{% caption3 < v1.7
1684 \bicaption@@getlabel#1\label{}\@nil}
1685 % \end{macrocode}
1686 % \begin{macrocode}
1687 \long\def\bicaption@@getlabel#1\label#2#3\@nil{%
1688 \def\@tempa{#2}%
1689 \ifx\@tempa\@empty
1690 \let\caption@thelabel\relax
1691 \else
1692 \def\@tempb{*}%
1693 \ifx\@tempa\@tempb
1694 \def\caption@thelabel{\label*}%
1695 \bicaption@@@getlabel#3\@nil
1696 \else
1697 \def\caption@thelabel{\label}%
1698 \bicaption@@@getlabel{#2}#3\@nil
1699 \fi
1700 \fi}
1701 % \end{macrocode}
1702 % \begin{macrocode}
1703 \long\def\bicaption@@@getlabel#1#2\@nil{%
1704 \def\@tempa{#1}%
1705 \def\@tempb{[}%
1706 \ifx\@tempa\@tempb
1707 \bicaption@@@@getlabel#1#2\@nil
1708 \else
1709 \l@addto@macro\caption@thelabel{{#1}}%
1710 \fi}
1711 % \end{macrocode}
1712 % \begin{macrocode}
1713 \long\def\bicaption@@@@getlabel[#1]#2\@nil{%
1714 \l@addto@macro\caption@thelabel{[{#1}]}%
1715 \bicaption@@@getlabel#2\@nil}
1716 % \end{macrocode}
1717 % \begin{macrocode}
1718 }{\@ifundefined{caption@@@@getlabel}{%
1719 % \end{macrocode}
1720 % \begin{macrocode}
1721 \newcommand\bicaption@getlabel[1]{% caption3 >= v1.7
1722 \caption@getlabel#1\label{}\@nil}
1723 % \end{macrocode}
1724 % \begin{macrocode}
1725 }{%
1726 % \end{macrocode}
1727 % \begin{macrocode}
1728 \newcommand*\bicaption@getlabel{% caption3 >= v2.0
1729 \caption@getlabel}
1730 % \end{macrocode}
1731 % \begin{macrocode}
1732 }}
1733 % \end{macrocode}
1734 % \end{macro}
1735 %
1736 % \begin{macro}{\bicaption@clrlabel}
1737 % \changes{v1.4a}{2020/12/26}{This macro added}
1738 % |\bicaption@clrlabel|\\
1739 % resets |\caption@the|\-|label| to |\relax|.
1740 % \begin{macrocode}
1741 \@ifundefined{caption@clrlabel}{%
1742 % \end{macrocode}
1743 % \begin{macrocode}
1744 \newcommand*\bicaption@clrlabel{\let\caption@thelabel\relax} % caption3 < v2.3
1745 % \end{macrocode}
1746 % \begin{macrocode}
1747 }{%
1748 % \end{macrocode}
1749 % \begin{macrocode}
1750 \newcommand*\bicaption@clrlabel{\caption@clrlabel} % caption3 >= v2.3
1751 % \end{macrocode}
1752 % \begin{macrocode}
1753 }
1754 % \end{macrocode}
1755 % \end{macro}
1756 %
1757 % \begin{macro}{\bicaption@set}
1758 % \changes{v1.6}{2022/04/18}{This macro renamed from \cs{bicaption@setup} to \cs{bicaption@set}}
1759 % |\bicaption@set|\marg{list-entry}\marg{text}\\
1760 % initiates the bilingual caption typesetting by storing the extra texts into
1761 % |\bi|\-|caption@l|\-|entry| and |\bi|\-|caption@text|.
1762 % \begin{macrocode}
1763 \newcommand\bicaption@set[2]{%
1764 \def\bicaption@lentry{#1}%
1765 \def\bicaption@text{\ignorespaces #2}}
1766 % \end{macrocode}
1767 % \end{macro}
1768 %
1769 % \begin{macro}{\bicaption@clear}
1770 % |\bicaption@clear|\\
1771 % clears the stuff stored by |\bicaption@set|.
1772 % \begin{macrocode}
1773 \newcommand*\bicaption@clear{%
1774 \let\bicaption@lentry\@undefined
1775 \let\bicaption@text\@undefined}
1776 % \end{macrocode}
1777 % \end{macro}
1778 %
1779 % \begin{macro}{\caption@freeze}
1780 % \changes{v1.0}{2011/08/31}{Redefinition of \cs{caption@freeze} added}
1781 % \changes{v1.5c}{2022/04/18}{\cs{@ifnextchar} replaced by \cs{kernel@ifnextchar}}
1782 % To make |\bicaption| work inside |SCfigure| and |FPfigure| environments we need to add
1783 % |\bi|\-|caption| to |\caption@freeze|.
1784 % \begin{macrocode}
1785 \AtBeginDocument{%
1786 \ifx\caption@freeze\@undefined \else
1787 \g@addto@macro\caption@freeze{%
1788 \let\caption@frozen@bicaption\bicaption
1789 \def\bicaption{%
1790 \caption@withoptargs\caption@SC@bicaption}%
1791 \long\def\caption@SC@bicaption#1#2{%
1792 \kernel@ifnextchar[%]
1793 {\caption@SC@bi@caption{#1}{#2}}%
1794 {\caption@SC@bi@caption@{#1}{#2}}}%
1795 \long\def\caption@SC@bi@caption#1#2[#3]#4{%
1796 \caption@@freeze{\bicaption#1{#2}[{#3}]{#4}}%
1797 \ignorespaces}%
1798 \long\def\caption@SC@bi@caption@#1#2#3{%
1799 \caption@@freeze{\bicaption#1{#2}{#3}}%
1800 \ignorespaces}%
1801 \l@addto@macro\caption@warmup{%
1802 \let\bicaption\caption@frozen@bicaption}}%
1803 \fi}
1804 % \end{macrocode}
1805 % \end{macro}
1806 %
1807 % \changes{v1.1}{2013/05/02}{Definition of \cs{bicaption@listof} removed}
1808 %
1809 % \subsection{Support of the listings package}
1810 % \changes{v1.5}{2021/01/04}{Support of the \pkg{listings} package added}
1811 %
1812 % \begin{macrocode}
1813 \caption@IfPackageLoaded{listings}[2004/02/13 v1.2]{%
1814 % \end{macrocode}
1815 %
1816 % If the \pkg{listings} package is loaded, we define the new options `caption1' and `caption2'.
1817 % \begin{macrocode}
1818 \lst@Key{caption1}\relax{%
1819 \lstKV@OptArg[{#1}]{#1}{%
1820 \bicaption@ifswap
1821 {\bicaption@set{##1}{##2}}%
1822 {\def\lst@@caption{##1}\def\lst@caption{##2}}}%
1823 \let\lst@title\@empty}%
1824 % \end{macrocode}
1825 % \begin{macrocode}
1826 \lst@Key{caption2}\relax{%
1827 \lstKV@OptArg[{#1}]{#1}{%
1828 \bicaption@ifswap
1829 {\def\lst@@caption{##1}\def\lst@caption{##2}}%
1830 {\bicaption@set{##1}{##2}}}%
1831 \let\lst@title\@empty}%
1832 % \end{macrocode}
1833 % \begin{macrocode}
1834 \lst@AddToHookExe{TextStyle}{%
1835 \bicaption@clear}%
1836 % \end{macrocode}
1837 %
1838 % \begin{macrocode}
1839 }{}
1840 % \end{macrocode}
1841 %
1842 % \subsection{Support of the longtable package}
1843 %
1844 % \begin{macro}{\LT@bicaption}
1845 % \changes{v1.1}{2016/01/31}{Adaption to \pkg{longtable} package added}
1846 % Same as |\@bicaption| but for |longtable| (offered by the \pkg{longtable} package).
1847 % |\bi|\-|caption@LT|\-|setup| will be executed later on, inside |\LT@make|\-|caption|
1848 % offered by the \pkg{caption} package.
1849 % \begin{macrocode}
1850 \newcommand\LT@bicaption{%
1851 \noalign\bgroup
1852 \@ifstar
1853 {\gdef\bicaption@cmd{\LT@c@ption\@gobble}%
1854 \LT@@bicaption}%
1855 {\gdef\bicaption@cmd{\LT@c@ption\@firstofone}%
1856 \caption@dblarg\LT@@@bicaption}}
1857 \newcommand\LT@@bicaption[1]{%
1858 \LT@@@@bicaption{}{#1}[]}
1859 % \end{macrocode}
1860 % \begin{macrocode}
1861 \long\def\LT@@@bicaption[#1]#2{%
1862 \caption@dblarg{\LT@@@@bicaption{#1}{#2}}}
1863 % \end{macrocode}
1864 % \begin{macrocode}
1865 \long\def\LT@@@@bicaption#1#2[#3]#4{%
1866 \gdef\bicaption@LTsetup{%
1867 \bicaption@getlabel{#2}%
1868 \bicaption@LT@setup}%
1869 \gdef\bicaption@LT@setup{%
1870 \bicaption@ifswap
1871 {\bicaption@set{#1}{#2}}%
1872 {\bicaption@set{#3}{#4}}}%
1873 \bicaption@ifswap
1874 {\egroup\bicaption@cmd[{#3}]{#4}}%
1875 {\egroup\bicaption@cmd[{#1}]{#2}}}
1876 % \end{macrocode}
1877 % \begin{macrocode}
1878 \let\bicaption@LTsetup\relax
1879 \let\bicaption@LT@setup\relax
1880 % \end{macrocode}
1881 % \end{macro}
1882 %
1883 % \begin{macro}{\caption@LT@setup}
1884 % \changes{v1.1}{2016/01/31}{Adaption to \pkg{longtable} package added}
1885 % \changes{v1.4}{2020/12/25}{Fallback code for \pkg{caption} package \version{3.2} added}
1886 % Execute the stuff defined by \cs{LT@bicaption} to prepare the typesetting
1887 % of the \pkg{longtable} bilingual caption.
1888 % \begin{macrocode}
1889 \caption@ifundefined\caption@LT@setup{%
1890 % Fallback code for caption v3.2
1891 \captionsetup*[longtable]{bicaption-lt-setup}
1892 \DeclareCaptionOptionNoValue{bicaption-lt-setup}{%
1893 \bicaption@LTsetup
1894 \global\let\bicaption@LTsetup\relax}
1895 }{%
1896 \g@addto@macro\caption@LT@setup{%
1897 \bicaption@LTsetup
1898 \global\let\bicaption@LTsetup\relax}
1899 }
1900 % \end{macrocode}
1901 % \end{macro}
1902 %
1903 % \iffalse
1904 %</package>
1905 % \fi
1906 %
1907 % \iffalse
1908 % --------------------------------------------------------------------------- %
1909 % \fi
1910 %
1911 % \Finale
1912 %
1913 \endinput
1914