% \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
