summaryrefslogtreecommitdiff
path: root/macros/latex/contrib/caption/ltcaption.dtx
blob: 5d06fb0845c5438b0cecacba3326d554b31367f8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
% \iffalse meta-comment
% 
% This is file `ltcaption.dtx'.
% 
% Copyright (C) 2007-2020 Axel Sommerfeldt (axel.sommerfeldt@f-m.fm)
% 
% --------------------------------------------------------------------------
% 
% This work may be distributed and/or modified under the
% conditions of the LaTeX Project Public License, either version 1.3
% of this license or (at your option) any later version.
% The latest version of this license is in
%   http://www.latex-project.org/lppl.txt
% and version 1.3 or later is part of all distributions of LaTeX
% version 2003/12/01 or later.
% 
% This work has the LPPL maintenance status "maintained".
% 
% This Current Maintainer of this work is Axel Sommerfeldt.
% 
% This work consists of the files
%   caption.ins, caption.dtx, caption-light.dtx, caption2.dtx, caption3.dtx,
%   caption-ams-smf.dtx, caption-beamer.dtx, caption-elsarticle.dtx,
%   caption-koma.dtx, caption-memoir.dtx, caption-ntg.dtx,
%   caption-thesis.dtx, bicaption.dtx, ltcaption.dtx, subcaption.dtx,
% the derived files
%   caption.sty, caption-light.sty, caption2.sty, caption3.sty,
%   caption-ams-smf.sto, caption-beamer.sto, caption-elsarticle.sto,
%   caption-koma.sto, caption-memoir.sto, caption-ntg.sto,
%   caption-thesis.sto, bicaption.sty, ltcaption.sty, subcaption.sty.
% 
% \fi
%
% \CheckSum{388}
%
% \iffalse
%<*driver>
\NeedsTeXFormat{LaTeX2e}[1994/12/01]
\ProvidesFile{ltcaption.drv}[2013/06/01 v1.4 This package fixes caption problems with other-than-centered aligned longtables]
\hbadness=9999 \newcount\hbadness \hfuzz=48pt % Make TeX shut up.
%
\documentclass{ltxdoc}
\setlength\parindent{0pt}
\setlength\parskip{\smallskipamount}
%
\usepackage{ifpdf}
\ifpdf
  \usepackage{mathptmx,courier}
  \usepackage[scaled=0.90]{helvet}
% \addtolength\marginparwidth{15pt}
\fi
%
\usepackage[bottom]{footmisc}
\usepackage{longtable}
\makeatletter\let\LT@makecaption@ORI\LT@makecaption\makeatother
%
\usepackage{hypdoc}
\ifpdf\usepackage{hypdestopt}\fi
\hypersetup{pdfkeywords={LaTeX, package, ltcaption},pdfstartpage={},pdfstartview={}}
%
\usepackage{ltcaption}[2007/09/01]
%\usepackage[LTcapwidthtotable]{fr-longtable}
%
\DeclareRobustCommand{\KOMAScript}{\textsf{K\kern.05em O\kern.05em%
    M\kern.05em A\kern.1em-\kern.1em Script}}
%
\begin{document}
  \DocInput{ltcaption.dtx}
\end{document}
%</driver>
% \fi
%
% \newcommand*\purerm[1]{{\upshape\mdseries\rmfamily #1}}
% \newcommand*\puresf[1]{{\upshape\mdseries\sffamily #1}}
% \newcommand*\purett[1]{{\upshape\mdseries\ttfamily #1}}
% \let\class\puresf \let\package\puresf
% \let\env\purett \let\opt\purett
%
% \def\thispackage{the \package{ltcaption} package}
% \def\Thispackage{The \package{ltcaption} package}
% \newcommand*\version[2][]{v$#2$}
% 
% \GetFileInfo{ltcaption.drv}
% \let\docdate\filedate
% \let\docversion\fileversion
% \GetFileInfo{ltcaption.sty}
%
% \title{\texorpdfstring{\Thispackage\thanks{%^^A
%          This package has version number \docversion.}}%^^A
%        {The ltcaption package}}
% \author{Axel Sommerfeldt\\
%         \url{https://gitlab.com/axelsommerfeldt/caption}}
% \date{\docdate}
% \maketitle
% 
% \begin{abstract}
% \centering
% \mbox{This package fixes caption problems with other-than-centered aligned longtables.}\\
% (solves \href{http://www.latex-project.org/cgi-bin/ltxbugs2html?pr=tools/3387}%^^A
%  {\LaTeX\ PR \texttt{tools/3387}})
% \end{abstract}
% 
% \tableofcontents
%
% \clearpage
% \section{The user interface}
%
% The content of \cs{caption} in longtables is usually centered to the content of the
% longtable itself.
% This is sufficient for centered longtables, but for left or right aligned longtables
% this results in captions moved into the left or right page margin.
%
% To solve this problem just include this package \emph{after} the \package{longtable}
% package\cite{longtable}, e.g.:
% \begin{quote}
%   |\usepackage{longtable,ltcaption}|
% \end{quote}
% Afterwards the captions of all longtables should be aligned as expected,
% even for not-centered longtables.
%
% \subsection{Further justification}
%
% \DescribeMacro{\LTcapskip}
% This length is controlling the skip between the caption and the contents
% below the caption (which is usually the longtable contents if you place
% the caption above the longtable), and it can be altered with
% |\setlength\LTcapskip{|\ldots|}|.
% When \thispackage\ is loaded it will be set to |\abovecaptionskip| which
% usually represents the skip between caption and contents in floating
% environments.
% (Without this package, the \package{longtable} package uses |\baselineskip| here.)
%
% \DescribeMacro{\LTcapleft}
% \DescribeMacro{\LTcapright}
% You can alter the centering of the caption box (of width |\LTcapwidth|)
% by setting the lengths |\LTcapleft| \& |\LTcapright| to appropriate values.
% These are set to |\fill| by default, just like the values |\LTleft| \& |\LTright|.
%
% \DescribeMacro{\LTcapmarginsfalse}
% Another option is the usage of the command |\LTcapmarginsfalse| which makes
% \thispackage\ using the values |\LTleft| \& |\LTright| instead of
% |\LTcapleft| \& |\LTcapright|.
%
% \emph{Note:}
% If \thispackage\ will be used with one of the \package{NTG} document
% classes\cite{NTGclasses}, |\CaptionLabelFont| \& |\CaptionTextFont| will
% not only be used for |figure| \& |table| captions, but for |longtable|
% captions as well.
%
% \emph{Note:}
% These lengths \& commands do not work when \thispackage\ is used with one
% of the \KOMAScript\ document classes \class{scrartcl}, \class{scrreprt}, or \class{scrbook}~\cite{KOMAScript},
% or used with the \class{memoir} document class~\cite{memoir}.
% The \KOMAScript\ resp.~\class{memoir} settings for captions are used instead.
% Same with the \package{caption} package which also uses its own options
% and settings.
%
% \subsection{Bonus features}
%
% \DescribeMacro{\LTcaptype}
% As a bonus feature this package patches the \package{longtable} package
% so |\LTcaptype| will be used internally instead of the fixed caption type
% `table'. So for example this code snipped:
% \begin{quote}
%   |\renewcommand\LTcaptype{figure}|\\
%   |\begin{longtable}{ll}|\\
%   |\caption{An example longtable}\\|\\
%   |  A & B \\|\\
%   |\end{longtable}|
% \end{quote}
% \pagebreak[3]
% will result in a longtable like this:
% \pagebreak[3]
% \setcounter{figure}{6}
% \begingroup
%   \renewcommand\LTcaptype{figure}
%   \begin{longtable}{l}
%   \caption{An example longtable}\\
%     \ldots \\
%   \end{longtable}
% \endgroup
%
% \DescribeEnv{longtable*}
% Another bonus feature is the addition of the environment |longtable*| which
% does not increment the |table| counter. (As a consequence, |\caption| is not
% available for such longtables, but |\caption*| still is.)
%
% \pagebreak[3]
% \section{Spot the difference}
%
% \begin{minipage}{\linewidth}
% Without \thispackage:
% \makeatletter
% \let\LT@makecaption\LT@makecaption@ORI
% \makeatother
%
% \iffalse show textwidth \fi
% \noindent\rule{\textwidth}{1pt}
%
% \begin{longtable}[l]{l}
% \caption{Left aligned longtable left aligned longtable left aligned
%   longtable}\\
% This is only a test\\
% \end{longtable}
% 
% \begin{longtable}[r]{l}
% \caption{Right aligned longtable right aligned longtable right aligned
%   longtable}\\
% This is only a test\\
% \end{longtable}
% 
% \begin{longtable}[c]{l}
% \caption{Centered longtable centered longtable centered longtable
%   centered longtable}\\
% This is only a test\\
% \end{longtable}
%
% \noindent\rule{\textwidth}{1pt}
% \end{minipage}
%
% \bigskip
%
% \begin{minipage}{\linewidth}
% With \thispackage\ (and the default value of |\LTcapwidth|):
%
% \noindent\rule{\textwidth}{1pt}
%
% \begin{longtable}[l]{l}
% \caption{Left aligned longtable left aligned longtable left aligned
%   longtable}\\
% This is only a test\\
% \end{longtable}
% 
% \begin{longtable}[r]{l}
% \caption{Right aligned longtable right aligned longtable right aligned
%   longtable}\\
% This is only a test\\
% \end{longtable}
% 
% \begin{longtable}[c]{l}
% \caption{Centered longtable centered longtable centered longtable
%   centered longtable}\\
% This is only a test\\
% \end{longtable}
%
% \noindent\rule{\textwidth}{1pt}
% \end{minipage}
%
% \bigskip
%
% \begin{minipage}{\linewidth}
% With \thispackage\ and |\LTcapwidth=\linewidth|:
% \LTcapwidth=\linewidth
%
% \noindent\rule{\textwidth}{1pt}
%
% \begin{longtable}[l]{l}
% \caption{Left aligned longtable left aligned longtable
%   left aligned longtable left aligned longtable}\\
% This is only a test\\
% \end{longtable}
% 
% \begin{longtable}[r]{l}
% \caption{Right aligned longtable right aligned longtable
%   right aligned longtable right aligned longtable}\\
% This is only a test\\
% \end{longtable}
% 
% \begin{longtable}[c]{l}
% \caption{Centered longtable centered longtable centered longtable
%   centered longtable}\\
% This is only a test\\
% \end{longtable}
%
% \noindent\rule{\textwidth}{1pt}
% \end{minipage}
%
% \bigskip
%
% \begin{minipage}{\linewidth}
% With \thispackage\ and |\LTcapleft=0pt|
% resp. |\LTcapright=0pt|:
%
% \noindent\rule{\textwidth}{1pt}
%
% \LTcapleft=0pt\relax
% \LTcapright=\fill
% \begin{longtable}[l]{l}
% \caption{Left aligned longtable left aligned longtable left aligned
%   longtable}\\
% This is only a test\\
% \end{longtable}
%
% \LTcapleft=\fill
% \LTcapright=0pt\relax
% \begin{longtable}[r]{l}
% \caption{Right aligned longtable right aligned longtable right aligned
%   longtable}\\
% This is only a test\\
% \end{longtable}
%
% \noindent\rule{\textwidth}{1pt}
% \end{minipage}
%
% \bigskip
%
% \begin{minipage}{\linewidth}
% With \thispackage\ and |\LTcapleft=\tabcolsep|\\
% resp. |\LTcapright=\tabcolsep|:
%
% \noindent\rule{\textwidth}{1pt}
%
% \LTcapleft=\tabcolsep
% \LTcapright=\tabcolsep plus 1fill
% \begin{longtable}[l]{l}
% \caption{Left aligned longtable left aligned longtable left aligned
%   longtable}\\
% This is only a test\\
% \end{longtable}
%
% \LTcapleft=\tabcolsep plus 1fill
% \LTcapright=\tabcolsep
% \begin{longtable}[r]{l}
% \caption{Right aligned longtable right aligned longtable right aligned
%   longtable}\\
% This is only a test\\
% \end{longtable}
%
% \noindent\rule{\textwidth}{1pt}
% \end{minipage}
%
% \bigskip
%
% \begin{minipage}{\linewidth}
% With \thispackage\ and |\LTcapmarginsfalse|:
% \LTcapmarginsfalse
%
% \noindent\rule{\textwidth}{1pt}
%
% \begin{longtable}[l]{l}
% \caption{Left aligned longtable left aligned longtable left aligned
%   longtable}\\
% This is only a test\\
% \end{longtable}
%
% \begin{longtable}[r]{l}
% \caption{Right aligned longtable right aligned longtable right aligned
%   longtable}\\
% This is only a test\\
% \end{longtable}
%
% \begin{longtable}[c]{l}
% \caption{Centered longtable centered longtable centered longtable
%   centered longtable}\\
% This is only a test\\
% \end{longtable}
%
% \noindent\rule{\textwidth}{1pt}
% \end{minipage}
%
% \iffalse
% --------------------------------------------------------------------------- %
% \fi
%
% \StopEventually{%^^A
% \pagebreak[3]
% \begin{thebibliography}{9}
%   \bibitem{longtable}
%   David Carlisle:
%   \href{http://www.ctan.org/pkg/longtable}%
%        {\emph{The longtable package}},
%   2004/02/01
%
%   \bibitem{NTGclasses}
%   Victor Eijkhout:
%   \href{http://www.ctan.org/pkg/ntgclass}%
%        {\emph{An introduction to the Dutch \LaTeX\ document classes}},
%   \mbox{3~September~1989}
%
%   \bibitem{KOMAScript}
%   Markus Kohm \& Jens-Uwe-Morawski:
%   \href{http://www.ctan.org/pkg/koma-script}%
%        {\emph{KOMA-Script -- a versatile \LaTeXe\ bundle}},
%   2012-07-22
%
%   \bibitem{memoir}
%   Peter Wilson, maintained by Lars Madsen:
%   \href{http://www.ctan.org/pkg/koma-script}%
%        {\emph{The Memoir Class for Configurable Typesetting}},
%   2013-05-30
%
%   \bibitem{floatrow}
%   Olga Lapko:
%   \href{http://www.ctan.org/pkg/floatrow}%
%        {\emph{The floatrow package documentation}},
%   2007/08/24
% \end{thebibliography}
% }
%
% \iffalse
% --------------------------------------------------------------------------- %
% \fi
%
% \DoNotIndex{\\,\_,\ ,\@@par}
% \DoNotIndex{\@bsphack}
% \DoNotIndex{\@car,\@cdr,\@classoptionslist,\@cons,\@currext,\@currname}
% \DoNotIndex{\@ehc,\@ehd,\@empty,\@esphack,\@expandtwoargs}
% \DoNotIndex{\@for,\@firstofone,\@firstoftwo}
% \DoNotIndex{\@gobble,\@gobblefour,\@gobbletwo,\@hangfrom}
% \DoNotIndex{\if@minipage,\@ifnextchar,\@ifpackagelater,\@ifpackageloaded}
% \DoNotIndex{\@ifstar,\@ifundefined,\@latex@error,\@namedef,\@nameuse}
% \DoNotIndex{\@onlypreamble,\@parboxrestore,\@plus,\@ptionlist}
% \DoNotIndex{\@removeelement,\@restorepar,\@secondoftwo,\@setpar}
% \DoNotIndex{\@tempa,\@tempboxa,\@tempdima,\@tempdimb,\@tempdimc,\@tempb,\@tempc}
% \DoNotIndex{\@testopt}
% \DoNotIndex{\@undefined,\@unprocessedoptions,\@unusedoptionlist}
% \DoNotIndex{\p@,\z@}
% \DoNotIndex{\active,\addtocounter,\addtolength,\advance,\aftergroup}
% \DoNotIndex{\baselineskip,\begin,\begingroup,\bfseries,\box}
% \DoNotIndex{\catcode,\centering,\changes,\csname,\def,\divide,\do,\downarrow}
% \DoNotIndex{\edef,\else,\empty,\end,\endcsname,\endgraf,\endgroup,\expandafter}
% \DoNotIndex{\fi,\footnotesize,\global}
% \DoNotIndex{\hangindent,\hbox,\hfil,\hsize,\hskip,\hspace,\hss}
% \DoNotIndex{\ifcase,\ifdim,\ifnum,\ifodd,\ifvoid,\ifvmode}
% \DoNotIndex{\ifx,\ignorespaces,\itshape}
% \DoNotIndex{\kernel@ifnextchar}
% \DoNotIndex{\Large,\large,\leavevmode,\leftmargini,\leftskip,\let,\linewidth}
% \DoNotIndex{\llap,\long,\m@ne,\margin,\mdseries,\message}
% \DoNotIndex{\newcommand,\newdimen,\newlength,\newline,\newif,\newsavebox}
% \DoNotIndex{\next,\nobreak,\nobreakspace,\noexpand,\noindent,\numberline}
% \DoNotIndex{\normalcolor,\normalfont,\normalsize,\or,\par,\parbox,\parfillskip}
% \DoNotIndex{\parindent,\parskip,\prevdepth,\protect,\protected@edef,\protected@write}
% \DoNotIndex{\providecommand,\quad}
% \DoNotIndex{\raggedleft,\raggedright,\relax,\renewcommand,\RequirePackage}
% \DoNotIndex{\rightskip,\rmfamily}
% \DoNotIndex{\sbox,\scriptsize,\scshape,\setbox,\setlength,\sffamily,\slshape}
% \DoNotIndex{\small,\string,\space,\strut}
% \DoNotIndex{\textheight,\the,\toks@,\typeout,\ttfamily}
% \DoNotIndex{\unvbox,\uparrow,\upshape,\usebox,\usepackage}
% \DoNotIndex{\value,\vbox,\vsize,\vskip,\wd,\width,\z@skip}
% \DoNotIndex{\AtBeginDocument,\AtEndOfPackage,\CurrentOption,\DeclareOption}
% \DoNotIndex{\ExecuteOptions,\GenericWarning,\IfFileExists,\InputIfFileExists}
% \DoNotIndex{\NeedsTeXFormat,\MessageBreak}
% \DoNotIndex{\PackageError,\PackageInfo,\PackageWarning,\PackageWarningNoLine}
% \DoNotIndex{\PassOptionsToPackage,\ProcessOptions,\ProvidesPackage}
%
% \iffalse
% --------------------------------------------------------------------------- %
% \fi
%
% \setlength{\parskip}{0pt plus 1pt}
% \changes{v1.0}{2007/04/15}{First release}
% \changes{v1.1}{2007/07/06}{Support of \cs{LTcaptype} added}
%
% \iffalse
% --------------------------------------------------------------------------- %
% \fi
%
% \clearpage
% \section{The Implementation}
% \iffalse
%<*package>
% \fi
%
% \subsection{Identification}
%
% We need at least \LaTeX2e\ version 1994/12/01.
%    \begin{macrocode}
\NeedsTeXFormat{LaTeX2e}[1994/12/01]
%    \end{macrocode}
%
% Bypass the release declarations in case the \LaTeX\ kernel doesn’t know how to deal with them
% (as suggested by \url{https://www.latex-project.org/publications/2018-FMi-TUB-tb122mitt-version-rollback.pdf}).
%    \begin{macrocode}
\providecommand\DeclareRelease[3]{}
\providecommand\DeclareCurrentRelease[2]{}
%    \end{macrocode}
%
% Declare all supported releases.
%    \begin{macrocode}
\DeclareCurrentRelease{v1}{2007-04-15}
%    \end{macrocode}
%
% Identify the current version of the package.
%    \begin{macrocode}
\ProvidesPackage{ltcaption}[2021/01/08 v1.4c longtable captions (AR)]
%    \end{macrocode}
%
%    \begin{macrocode}
\@ifpackageloaded{longtable}{}{%
  \PackageError{ltcaption}{longtable package not loaded, aborting}{RTFM}}
%    \end{macrocode}
%
% \subsection{User interface}
%
% \begin{macro}{\LTcaptype}
%  |\LTcaptype| is preset to |table|.
%    \begin{macrocode}
\providecommand*\LTcaptype{table}
\providecommand*\ext@table{lot}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\ext@lstlisting}
% Since the \package{listings} package do not define |\ext@lstlisting|,
% but we needed it when |\renewcommand\LTcaptype{lstlisting}| was done
% by the end user, we define it here.
%    \begin{macrocode}
\@ifundefined{caption@AtBeginDocument}\AtBeginDocument\caption@AtBeginDocument{%
  \@ifpackageloaded{listings}{%
    \providecommand*\ext@lstlisting{lol}}{}}
%    \end{macrocode}
% \end{macro}
%
% To save \TeX\ memory some stuff will not be defined if the
% \package{caption} package is loaded.
%
%    \begin{macrocode}
\@ifpackageloaded{caption}{}{%
%    \end{macrocode}
%
% \changes{v1.1}{2007/04/20}{The skips will not be defined if the
%        \package{caption} package is loaded}
%
% \begin{macro}{\LTcapskip}
% \changes{v1.2}{2007/03/28}{This skip added}
%    \begin{macrocode}
  \newskip\LTcapskip \LTcapskip=\abovecaptionskip
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\LTcapleft}
% \begin{macro}{\LTcapright}
% \begin{macro}{\ifLTcapmargins}
%  Our skips and the flag belonging to them.\\
%  (Default: Use these skips (and not |\LTleft| \& |\LTright|.)\par
%    \begin{macrocode}
  \newskip\LTcapleft \LTcapleft=\fill
  \newskip\LTcapright \LTcapright=\fill
  \newif\ifLTcapmargins \LTcapmarginstrue
%    \end{macrocode}
% \end{macro}
% \end{macro}
% \end{macro}
%
% \changes{v1.1}{2007/05/05}{Usage of \cs{CaptionLabelFont} \&
%        \cs{CaptionTextFont} added}
%
% \begin{macro}{\CaptionLabelFont}
% \begin{macro}{\CaptionTextFont}
%  These commands are provided by the \package{NTG} document classes.
%  To make this package work with other document classes as well,
%  we need to define |\Caption|\-|Label|\-|Font| \& |\Caption|\-|Text|\-|Font| here.
%    \begin{macrocode}
  \providecommand*\CaptionLabelFont{}
  \providecommand*\CaptionTextFont{}
%    \end{macrocode}
% \end{macro}
% \end{macro}
% \begin{macro}{\CaptionLabelSeparator}
% \changes{v1.3}{2011/09/12}{This macro added}
%  Additionally, we define |\Caption|\-|Label|\-|Separator| which is predefined as colon.
%    \begin{macrocode}
  \providecommand*\CaptionLabelSeparator{:}
%    \end{macrocode}
% \end{macro}
%
%    \begin{macrocode}
}
%    \end{macrocode}
%
% \subsection{The longtable patch}
%
% \begin{macro}{\LT@array}
% \changes{v1.1a}{2008/03/21}{Improved redefinition of \cs{refstepcounter} etc.}
% \changes{v1.4b}{2020/05/30}{Re-definition of \cs{captionnewline} added}
%  We insert our stuff into the definition of |\LT@array| here.
%  Since the \package{hyperref} package patches |\LT@array| as well
%  and since this only works with the original definition of |\LT@array|,
%  we have to do this after the \package{hyperref} package,
%  i.e. |\AtBeginDocument|.
%    \begin{macrocode}
\@ifundefined{caption@AtBeginDocument}\AtBeginDocument\caption@AtBeginDocument{%
  \let\ltcaption@ORI@LT@array\LT@array
  \renewcommand*\LT@array{%
%    \end{macrocode}
%  We modify |\ref|\-|step|\-|counter| resp.~|\H@ref|\-|step|\-|counter| and
%  |\hyper@make|\-|current|, so |\LT|\-|cap|\-|type| is used instead of |table|.
%    \begin{macrocode}
    \let\caption@LT@refstepcounter\refstepcounter
    \def\refstepcounter{%
      \caption@LTtype\caption@LT@refstepcounter}%
    \let\caption@LT@Hrefstepcounter\H@refstepcounter
    \def\H@refstepcounter{%
      \caption@LTtype\caption@LT@Hrefstepcounter}%
    \let\caption@LT@makecurrent\hyper@makecurrent
    \def\hyper@makecurrent{%
      \caption@LTtype\caption@LT@makecurrent}%
%    \end{macrocode}
%  We redefine |\lst@@caption| so |\thelstlisting| will
%  printout its counter, too.
%    \begin{macrocode}
    \def\lst@@caption{\relax}%
%    \end{macrocode}
%  Re-define |\caption|\-|newline| so |\par| will be used inside longtables instead of |\\|.
%    \begin{macrocode}
    \def\captionnewline{\par}%
%    \end{macrocode}
%    \begin{macrocode}
    \ltcaption@ORI@LT@array}}
%    \end{macrocode}
%    \begin{macrocode}
\newcommand*\caption@LTtype[2]{%
  \edef\caption@LT@tempa{#2}%
  \ifx\caption@LT@tempa\caption@LT@table
    \caption@LT@type#1%
  \else
    #1{#2}%
  \fi}%
%    \end{macrocode}
%    \begin{macrocode}
\newcommand*\caption@LT@type[1]{%
  \expandafter#1\expandafter{\LTcaptype}}
%    \end{macrocode}
%    \begin{macrocode}
\newcommand*\caption@LT@table{table}%
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\LT@c@ption}
% \changes{v1.1a}{2008/01/22}{Bugfix: Made it \cs{long}}
% \changes{v1.2a}{2011/01/01}{Bugfix: \cs{ignorespaces} added}
%  The original implementation:
%  \begin{verbatim}
%  \def\LT@c@ption#1[#2]#3{%
%    \LT@makecaption#1\fnum@table{#3}%
%    \def\@tempa{#2}%
%    \ifx\@tempa\@empty\else
%       {\let\\\space
%       \addcontentsline{lot}{table}{\protect\numberline{\thetable}{#2}}}%
%    \fi}
%  \end{verbatim}%^^A
%  Our implementation simply uses |\LTcaptype| instead of |{table}|:
%    \begin{macrocode}
\long\def\LT@c@ption#1[#2]#3{%
  \LT@makecaption#1{\csname fnum@\LTcaptype\endcsname}{#3}%
  \LT@listentry\LTcaptype{#2}}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\LT@makecaption}
% \changes{v1.1}{2007/04/20}{\cs{LT@@makecaption} added}
% \changes{v1.1}{2007/06/27}{Adapted to the \package{floatrow} package by Olga Lapko}
% \changes{v1.2}{2007/03/28}{Uses \cs{LTcapskip} instead of \cs{baselineskip} now}
% \changes{v1.3}{2011/09/12}{Usage of \cs{CaptionLabelSeparator} added}
%  |\LT@makecaption|\marg{cmd}\marg{label}\marg{text}\par
% \smallskip
%  Original code:
%  \begin{verbatim}
%  \def\LT@makecaption#1#2#3{%
%    \LT@mcol\LT@cols c{\hbox to\z@{\hss\parbox[t]\LTcapwidth{%
%      % Based on article class "\@makecaption", "#1" is "\@gobble" in star
%      % form, and "\@firstofone" otherwise.
%      \sbox\@tempboxa{#1{#2: }#3}%
%      \ifdim\wd\@tempboxa>\hsize
%        #1{#2: }#3%
%      \else
%        \hbox to\hsize{\hfil\box\@tempboxa\hfil}%
%      \fi
%      \endgraf\vskip\baselineskip}%
%    \hss}}}
%  \end{verbatim}%^^A
%  Our code:\footnote{Adapted to the \package{floatrow} package by Olga Lapko}
%    \begin{macrocode}
\renewcommand\LT@makecaption[3]{%
  \LT@@makecaption{%
    \sbox\@tempboxa{%
      #1{{\CaptionLabelFont#2\CaptionLabelSeparator} }\CaptionTextFont#3}%
    \ifdim\wd\@tempboxa>\hsize
      #1{{\CaptionLabelFont#2\CaptionLabelSeparator} }\CaptionTextFont#3%
    \else
      \hbox to\hsize{\hfil\box\@tempboxa\hfil}%
    \fi
    \endgraf\vskip\LTcapskip}}
%    \end{macrocode}
%    \begin{macrocode}
\newcommand\LT@@makecaption[1]{%
  \caption@LT@make{\hb@xt@\hsize{%
    \ifLTcapmargins
      \hspace\LTcapleft
      \FBifLTcapwidth{\advance\LTcapwidth-\LTcapleft}%
    \else
      \hspace\LTleft
      \FBifLTcapwidth{\advance\LTcapwidth-\LTleft}%
    \fi
    \FBifLTcapwidth{\advance\LTcapwidth-%
       \ifLTcapmargins\LTcapright\else\LTright\fi}%
    \parbox[t]\LTcapwidth{#1}%
    \ifLTcapmargins
      \hskip\LTcapright
    \else
      \hskip\LTright
    \fi}}}
%    \end{macrocode}
% This one will be usually defined by the \package{fr-longtable} package,
% which is part of the \package{floatrow} package\cite{floatrow}:
%    \begin{macrocode}
\AtBeginDocument{\providecommand*\FBifLTcapwidth[1]{}}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\caption@LT@make}
%  Typesets the caption as |\multicolumn|\ldots
%    \begin{macrocode}
\newcommand\caption@LT@make[1]{%
  \noalign{\caption@LT@config}%
%    \end{macrocode}
% Note: If used with the \package{array} package |\caption@LTfmt| needs
% to be expanded, therefore we need some |\expandafter| here.
%    \begin{macrocode}
  \expandafter\LT@mcol\expandafter\LT@cols\expandafter{\caption@LTfmt}{%
    \hb@xt@\z@{%
      \hspace\caption@LTleft
      \parbox[t]\linewidth{#1}%
      \hspace\caption@LTright}}}%
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\caption@LT@config}
% |\caption@LT@config| analyses |\LTleft| \& |\LTright|
% and set |\caption@LTleft| \& |\caption@LTright| accordingly
% to the `opposite' values, e.g., |\LTleft=1cm| will result to
% |\caption@LTleft=-1cm| and |\LTleft=0pt plus 1fill|
% will result to |\caption@LTleft=0pt minus 1fill|.
% Furthermore |\caption@LTfmt| is set to the according
% multicolumn format; this is far away from being bulletproof
% (e.g., a stretch or shrink will always be treated as `fill')
% but will hopefully cover all `real' cases.
%    \begin{macrocode}
\newcommand*\caption@LT@config{%
%    \end{macrocode}
%    \begin{macrocode}
  \caption@LT@parse\LTleft\caption@LTleft\caption@ifLTleft
  \caption@LT@parse\LTright\caption@LTright\caption@ifLTright
%    \end{macrocode}
%    \begin{macrocode}
  \xdef\caption@LTfmt{%
    @{}\caption@ifLTleft{\caption@ifLTright{c}{r}}{l}@{}}}
%    \end{macrocode}
% \end{macro}
%
%    \iffalse
% \def\@defplusminus#1 #2 #3 #4 #5\@nil{%
%   \def\@plus{#2}\def\@minus{#4}}
% \@tempskipa=1pt plus 1pt minus 1pt\relax
% \expandafter\@defplusminus\the\@tempskipa\@nil
%    \fi
%
% \begin{macro}{\caption@LT@parse}
% Parsing of the skip, we collect a |\@fixpart|, a |@pluspart|,
% and a |\@minuspart| and make our definitions based on that.
%    \begin{macrocode}
\newcommand*\caption@LT@parse[3]{%
%    \end{macrocode}
%    \begin{macrocode}
  \let\@pluspart\@undefined
  \let\@minuspart\@undefined
  \expandafter\caption@LT@parse@\expandafter\@fixpart\the#1 x %
%    \end{macrocode}
%    \begin{macrocode}
  \xdef#2{-\@fixpart
    \ifx\@minuspart\@undefined\else
      \space\@plus\space\@minuspart
    \fi
    \ifx\@pluspart\@undefined\else
      \space\@minus\space\@pluspart
    \fi}%
%    \end{macrocode}
% \changes{v1.1}{2007/04/17}{Made it 5 token shorter}
%    \begin{macrocode}
  \let#3\@firstoftwo
  \ifx\@pluspart\@undefined
    \ifx\@minuspart\@undefined
      \let#3\@secondoftwo
    \fi
  \fi}
%    \end{macrocode}
%    \begin{macrocode}
\def\caption@LT@parse@#1#2 {%
%    \end{macrocode}
%  Note: |\def\@tempa{#2}\ifx\@tempa\@plus|\ldots would not work here
%  because of different catcodes.
%    \begin{macrocode}
  \edef\@tempa{\@car#2\@nil}%
  \if p\@tempa
    \def\next{\caption@LT@parse@\@pluspart}%
  \else\if m\@tempa
    \def\next{\caption@LT@parse@\@minuspart}%
  \else\if x\@tempa
    \let\next\relax
  \else
    \def#1{#2}%
    \def\next{\caption@LT@parse@ @}%
  \fi\fi\fi
  \next}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\LT@listentry}
% \changes{v1.4}{2018/08/26}{This macro added}
%    \begin{macrocode}
\newcommand*\LT@listentry[2]{%
  \def\@tempa{#2}%
  \ifx\@tempa\@empty\else
     {\let\\\space
     \addcontentsline{\csname ext@#1\endcsname}{#1}%
       {\protect\numberline{\csname the#1\endcsname}{#2}}}%
  \fi
  \ignorespaces}
%    \end{macrocode}
% \end{macro}
%
% \subsection{The \texttt{longtable*} environment}
% \changes{v1.1}{2007/09/01}{Environment \env{longtable*} added}
%
% \begin{environment}{longtable*}
% \changes{v1.1a}{2008/03/21}{Improved redefinition of \cs{refstepcounter} etc.}
% \changes{v1.4c}{2021/01/08}{Improved error message if \cs{caption} is used}
% A |longtable| environment without reference counter and hyperlink anchors.
%    \begin{macrocode}
\newenvironment{longtable*}{%
%    \end{macrocode}
%  We simply supress anything which has to do with reference counters here.
%    \begin{macrocode}
  \let\caption@LT@type\@gobble
%    \end{macrocode}
%  Unfortunately this is not so easy with |\Hy@raisedlink| (which actually sets
%  the hyperlink anchor), so we assume that we have to supress the first usage.
%    \begin{macrocode}
   \let\caption@LT@raisedlink\Hy@raisedlink
   \def\Hy@raisedlink{%
     \let\Hy@raisedlink\caption@LT@raisedlink
     \@gobble}%
%    \end{macrocode}
%  Finally we are redefining |\caption| so the non-starred variant
%  issues an error.
%    \begin{macrocode}
   \let\ltcaption@ORI@LT@c@ption\LT@c@ption
   \def\LT@c@ption##1[##2]##3{%
     \ifx##1\@firstofone
       \PackageError{ltcaption}%
         {\noexpand\caption is not available in longtable* environment}%
         {If you do not understand this error, please take a closer
          look\MessageBreak at the documentation of the `ltcaption'
          package.\MessageBreak \@ehc}%
     \else
       \ltcaption@ORI@LT@c@ption{##1}[{##2}]{##3}%
     \fi}%
%    \end{macrocode}
%    \begin{macrocode}
  \longtable}%
 {\endlongtable}
%    \end{macrocode}
% \end{environment}
%
% \subsection{Adaption for \texorpdfstring{\KOMAScript}{KOMA Script}}
%
%    \begin{macrocode}
\@ifundefined{@komalongtablefalse}{}{%
  \if@komalongtable
%    \end{macrocode}
%    \begin{macrocode}
    \renewcommand\LT@makecaption[3]{%
      \noalign{%
        \if@captionabove
          \vskip\belowcaptionskip
        \else
          \vskip\abovecaptionskip
        \fi
      }%
      \caption@LT@make{%
        \@@makecaption{#1}{#2}{#3}%
        \endgraf
        \if@captionabove
          \vskip\abovecaptionskip
        \else
          \vskip\belowcaptionskip
        \fi
      }%
    }%
%    \end{macrocode}
%    \begin{macrocode}
    \let\LT@@makecaption\@undefined
%    \end{macrocode}
%    \begin{macrocode}
  \fi}
%    \end{macrocode}
%
% \subsection{Adaption for \texorpdfstring{Memoir}{Memoir}}
%
%    \begin{macrocode}
\@ifclassloaded{memoir}{%
  \@ifundefined{@@makecaption}{}{%
    \renewcommand\LT@makecaption[3]{%
%     \noalign{\vskip\abovecaptionskip}%
      \caption@LT@make{%
        \let\@memtempa\relax
        % starred form -> #1 = \@gobble
        \ifx#1\@gobble
          \let\@contnfont\@empty
          \let\@contdelim\@empty
          \@@makecaption{}{#3}%
        \else
          \@@makecaption{#2}{#3}%
        \fi
        \endgraf\vskip\belowcaptionskip}}%
%    \end{macrocode}
%    \begin{macrocode}
    \let\LT@@makecaption\@undefined
%    \end{macrocode}
%    \begin{macrocode}
  }}{}
%    \end{macrocode}
%
% \iffalse
%</package>
% \fi
%
% \iffalse
% --------------------------------------------------------------------------- %
% \fi
%
% \Finale
%
\endinput