From e0c6872cf40896c7be36b11dcc744620f10adf1d Mon Sep 17 00:00:00 2001
From: Norbert Preining <norbert@preining.info>
Date: Mon, 2 Sep 2019 13:46:59 +0900
Subject: Initial commit

---
 macros/latex/contrib/longfigure/longfigure.dtx | 851 +++++++++++++++++++++++++
 1 file changed, 851 insertions(+)
 create mode 100644 macros/latex/contrib/longfigure/longfigure.dtx

(limited to 'macros/latex/contrib/longfigure/longfigure.dtx')

diff --git a/macros/latex/contrib/longfigure/longfigure.dtx b/macros/latex/contrib/longfigure/longfigure.dtx
new file mode 100644
index 0000000000..60d4b1dae0
--- /dev/null
+++ b/macros/latex/contrib/longfigure/longfigure.dtx
@@ -0,0 +1,851 @@
+% \iffalse meta-comment
+%<*internal>
+\iffalse
+%</internal>
+%<*readme>
+----------------------------------------------------------------
+longfigure --- A LaTeX package providing a table-like environment
+               that can display a stream of subfigures as a single
+               figure that can be broken by \TeX's
+               standard page-breaking algorithm.
+
+               Nearly identical to David Carlisle's |longtable| package,
+               but with some obvious changes to use figures instead of
+               tables. All credit goes to David Carlisle; this package
+               represents small changes to his code and logic.
+               I am responsible for the changes.
+
+E-mail: tim.arnold@sas.com
+Released under the LaTeX Project Public License v1.3c or later
+See http://www.latex-project.org/lppl.txt
+----------------------------------------------------------------
+
+This work consists of the file longfigure.dtx
+and the derived files:
+   README (this file)
+   longfigure.ins
+   longfigure.pdf
+   longfigure.sty
+%</readme>
+%<*internal>
+\fi
+\def\nameofplainTeX{plain}
+\ifx\fmtname\nameofplainTeX\else
+  \expandafter\begingroup
+\fi
+%</internal>
+%<*install>
+\input docstrip.tex
+\keepsilent
+\askforoverwritefalse
+\preamble
+----------------------------------------------------------------
+longfigure --- A LaTeX package providing a table-like environment
+               that can display a stream of subfigures as a single
+               figure that can be broken by \TeX's
+               standard page-breaking algorithm.
+
+E-mail: tim.arnold@sas.com
+----------------------------------------------------------------
+\endpreamble
+\postamble
+Copyright (C) 2014 by SAS Institute Inc. <tim.arnold@sas.com>
+
+This work may be distributed and/or modified under the
+conditions of the LaTeX Project Public License (LPPL), either
+version 1.3c of this license or any later version.
+The latest version of this license is in the file:
+http://www.latex-project.org/lppl.txt
+
+This work is "maintained" (as per LPPL maintenance status) by
+Tim Arnold.
+
+This work consists of the file longfigure.dtx
+and the derived files:
+   README (this file)
+   longfigure.ins
+   longfigure.pdf
+   longfigure.sty
+\endpostamble
+\generate{\file{longfigure.sty}{\from{longfigure.dtx}{longfigure}}}
+%</install>
+%<install>\endbatchfile
+%<*internal>
+\generate{\file{longfigure.ins}{\from{longfigure.dtx}{install}}}
+\nopreamble\nopostamble
+\generate{\file{README}{\from{longfigure.dtx}{readme}}}
+\ifx\fmtname\nameofplainTeX
+  \expandafter\endbatchfile
+\else
+  \expandafter\endgroup
+\fi
+%</internal>
+%<*longfigure>
+\NeedsTeXFormat{LaTeX2e}
+\ProvidesPackage{longfigure}[2014/1/06 v1.0]
+%</longfigure>
+%<*driver>
+\documentclass{ltxdoc}
+\usepackage[T1]{fontenc}
+\usepackage{lmodern}
+\usepackage{\jobname}
+\usepackage[numbered]{hypdoc}
+\EnableCrossrefs
+\CodelineIndex
+\RecordChanges
+\begin{document}
+  \DocInput{\jobname.dtx}
+\end{document}
+%</driver>
+% \fi
+%\GetFileInfo{\jobname.sty}
+% \def\fileversion{v1.0}
+%
+%\title{^^A
+%  The \textsf{longfigure} Package\thanks{^^A
+%    This file describes version \fileversion, last revised \filedate.^^A
+%  }^^A
+%}
+%\author{^^A
+%  Tim Arnold\thanks{E-mail: tim.arnold@sas.com}^^A
+%}
+%\date{Released \filedate}
+%
+%\maketitle
+%
+%\changes{v1.0}{2014/1/06}{First public release}
+%    \section{Usage}
+%    \label{longfigure}
+%    \index{longfigure package|usage}
+%
+%    The |longfigure| package uses and relabels components of the
+%    well-known |longtable| package, written by David Carlisle, to
+%    provide a table-like environment that can display a stream
+%    of subfigures as a single figure that can break across pages.
+%
+%    The |longtable| package defines a |longtable| environment,
+%    which produces tables that can be broken by \TeX's standard page-breaking algorithm.
+%    Similarly, the |longfigure| package defines a |longfigure| environment, which produces
+%    figures that can be broken by \TeX's standard page-breaking algorithm.
+%    The internal structure of a long figure is similar to a long table.
+%    Rows might contain (for example) tables or graphics. Page breaks
+%    can occur only between rows.
+%
+%     The |longfigure| package differs from the |longtable| package in the following ways:
+%    \begin{itemize}
+%      \item The |longfigure| package supports two additional key-value options:
+%      \begin{itemize}
+%        \item The |figname=| option specifies the counter for numbering |longfigure| environments.
+%              You can specify any string; the default is |figure|.
+%              When you specify a |figname=| value for which no counter already exists, the
+%              |longfigure| package loads the |tocloft| package and creates the counter.
+%              \index{figname option|usage}
+%
+%       \item The |resetby=| option specifies a counter (for example, |resetby=chapter|) such
+%             that output numbering is reset each time the counter value changes.
+%             If a counter is specified that does not exist, the |tocloft| package is
+%             loaded to create the new counter.
+%             \index{tocloft package|usage}%
+%             For information about how the lists are typeset,
+%             \index{list of outputs, creating|usage}%
+%             see the |tocloft| package documentation.
+%      \end{itemize}
+%      \item The counters and macros that start with \cs{LT} in the |longtable| package
+%            are renamed to start with \cs{LF} in the |longfigure| pacakge to avoid
+%            namespace conflicts when the two packages are used together.
+%            The generic macros that are defined in the |longtable| package
+%            (\cs{endfirsthead}, \cs{endhead}, \cs{endfoot}, and \cs{endlastfoot}) are
+%            also renamed with \cs{LF} as a prefix in the |longfigure| package.
+%
+%      \item The \cs{LF@name} macro is based on the \cs{fnum@table} macro from
+%            the |longtable| package. The  \cs{LF@name} macro returns the capitalized
+%            counter name and value. For example, if the counter is |figure| and the
+%            macro is processing the second |longfigure|, the \cs{LF@name} macro
+%            would contain the value ``Figure 2.''
+%
+%  \end{itemize}
+%    You can use the |longfigure| package defaults to produce a \emph{List of Figures}
+%    by inserting the following tag in your document at the point where you want
+%    the list to appear:
+% \iffalse
+%<*example>
+% \fi
+\begin{verbatim}
+   \listoffigures
+\end{verbatim}
+% \iffalse
+%</example>
+% \fi
+%
+%    The default counter used to display figures is the |figure| counter,
+%    but you can specify a different counter. For example, if you want your
+%    figures to be labeled as ``Display,'' specify |figname=display| when you
+%    load the |longfigure| package; to display a \emph{List of Displays}, insert the following
+%    command in your document at the point where you want the list to appear:
+% \iffalse
+%<*example>
+% \fi
+\begin{verbatim}
+   \listofdisplay
+\end{verbatim}
+% \iffalse
+%</example>
+% \fi
+%    \textbf{Note:}  If you specify a counter that does not exist,
+%    an auxiliary file with extension |.lft| is created to contain the information
+%    needed to create the list.
+%
+%    If you want to use more advanced features of the |tocloft| package,
+%    load it before you load the |longfigure| package so that the |longfigure|
+%    package sees that the counters specified by the |figname=| and |resetby=|
+%    options are already defined and does not attempt to create them.
+%
+%
+%\subsection{Example}
+% The following lines produce a single figure that contains three images and
+% one tabular environment. Each element is a row of the |longfigure| environment.
+% Page breaks can occur between rows.
+%
+%\begin{verbatim}
+%\documentclass{book}
+%\usepackage{graphicx}
+%\usepackage{longfigure}
+%
+%\begin{document}
+%  \begin{longfigure}{c}
+%    \caption{My Long Figure}\label{mlfig}\\
+%    \includegraphics[width=3in]{myfig1}\\
+%    \includegraphics[width=3in]{myfig2}\\
+%    \includegraphics[width=3in]{myfig3}\\
+%    \begin{tabular}{ll}
+%      one & two \\
+%      three & four\\
+%    \end{tabular}
+%  \end{longfigure}
+%\end{document}
+%\end{verbatim}
+%
+%  In this example, the |{c}| argument in the |\begin{longfigure}| command
+%  specifies only a single centered column. You can also specify multiple columns and,
+%  if needed, use the \cs{multicolumn} command for more flexibility.
+%
+% The following lines display another example that specifies a 'continued' heading
+% when the figure breaks over a page. It also displays a double horizontal line at the
+% end of the figure.
+%\begin{verbatim}
+%\documentclass{book}
+%\usepackage{graphicx}
+%\usepackage{longfigure}
+%
+%\begin{document}
+%  \begin{longfigure}{c}
+%    \caption{My Long Figure}\label{mlfig2}\\
+%    \hline\endLFfirsthead
+%    \caption{continued}\\
+%    \hline\endLFhead
+%    \hline\endLFfoot
+%    \hline\hline\endLFlastfoot
+%    \includegraphics[width=3in]{myfig1}\\
+%    \includegraphics[width=3in]{myfig2}\\
+%    \includegraphics[width=3in]{myfig3}\\
+%    \begin{tabular}{ll}
+%      one & two \\
+%      three & four\\
+%    \end{tabular}
+%  \end{longfigure}
+%\end{document}
+%\end{verbatim}
+%
+%    \section{Implementation}
+%
+%    This section describes the implementation of the |longfigure| package.
+%    The comments describe only the changes from the |longtable| package code.
+%    For complete details about the logic and usage of the |longtable| environment,
+%    see Carlisle (2004).
+%\iffalse
+%<*longfigure>
+%\fi
+%    \begin{macrocode}
+\ProvidesPackage{longfigure}[2014/01/06 longfigure]
+%    \end{macrocode}
+%    The following statement loads the |xkeyval| package for declaring
+%    and processing package options:
+%    \begin{macrocode}
+\RequirePackage{xkeyval}
+%    \end{macrocode}
+%    The following statement defines a new command, \cs{LFcounter}, to
+%    contain the string |figure|.
+%    Later code tests whether a counter with that name exists.
+%    \begin{macrocode}
+\newcommand*{\LFcounter}{figure}
+%    \end{macrocode}
+%
+%    The following statement defines a new command, \cs{LFreset}, to contain
+%    the name of the counter within which the |longfigure| number should reset.
+%    If no value is specified, the long figures are numbered consecutively
+%    through the document.
+%    \begin{macrocode}
+\newcommand*{\LFreset}{\@empty}
+%    \end{macrocode}
+% \subsection{Options}
+%    The \cs{LFcounter} and \cs{LFreset} commands support the
+%    package options |figname=| and |resetby=| as follows:
+%    \begin{macrocode}
+\DeclareOptionX{figname}[figure]{\renewcommand*{\LFcounter}{#1}}
+\DeclareOptionX{resetby}{\renewcommand*{\LFreset}{#1}}
+%    \end{macrocode}
+%    The following statements further define the options
+%    that the |longtable| package defines:
+%    \begin{macrocode}
+\DeclareOptionX{set}{}
+\DeclareOptionX{final}{}
+\DeclareOptionX{errorshow}{\def\LF@warn{\PackageInfo{longfigure}}}
+\DeclareOptionX{pausing}{\def\LF@warn#1{\LF@err{#1}{This is not really an error}}}
+\ProcessOptionsX
+%    \end{macrocode}
+%    The following statements process the options:
+%    \begin{macrocode}
+\def\LFProcessOptions#1{
+  \@ifundefined{c@#1}{%
+      \RequirePackage{tocloft}
+      \def\LFuc##1##2{\MakeUppercase{##1}{##2}}
+      \expandafter\def\csname list#1name\endcsname{List of \LFuc#1s}
+      \ifx\@empty\LFreset%
+        \newlistof{#1}{lft}{\csname list#1name\endcsname}
+      \else
+        \newlistof[\LFreset]{#1}{lft}{\csname list#1name\endcsname}
+      \fi
+  }{}%
+}
+\expandafter\LFProcessOptions\expandafter{\LFcounter}
+%    \end{macrocode}
+%    If a counter is specified that does not exist, its name (\cs{c@}\textit{countername})
+%    is undefined and the |longfigure| package loads the |tocloft| package in order to
+%    use its commands to create the new counters and list.
+%
+%    Thus, the |tocloft| package is required only when a new counter
+%    is specified,
+%    \index{tocloft package|usage}%
+%    and this automatic loading takes place only if the counter that is  specified
+%    in the package options is not defined.
+%
+%    You can load the |tocloft| package before loading the |longfigure| package
+%    and retain all of the flexibility that the |tocloft| package offers.
+%    However, you must define the new counters yourself by using the
+%    \cs{newlistof} command in the |tocloft| package,
+%    and you must define the new list to use an auxiliary |lft| file where
+%    its auxiliary information is written.
+%    \index{tocloft package|usage}%
+%
+% \subsection{Utilities}
+% \DescribeMacro{\strcfstr}
+%  The following macro, \cs{strcfstr}, checks whether two strings, which are
+%  provided as arguments, are equal (Wilson, 2001).
+%  A new boolean \cs{ifLF@same} contains the result of the test.
+%    \begin{macrocode}
+\newif\ifLF@same
+\newcommand{\strcfstr}[2]{%
+  \LF@samefalse
+  \begingroup\def\2{#2}
+    \ifx\2#1\endgroup\LF@sametrue
+    \else\endgroup
+    \fi
+}
+%    \end{macrocode}
+%  \DescribeMacro{\LFupcase}
+%    The following macro, \cs{LFupcase}, uppercases the first letter of
+%    a string (Lazarides, 2010):
+%    \begin{macrocode}
+\def\LFupcase#1{%
+  \def\x##1##2{%
+    \MakeUppercase{##1}{##2}}\x#1%
+}
+%    \end{macrocode}
+%    The following macro, \cs{LF@name}, creates a string to provide a label and number for
+%    an output. Analogous to the \cs{fnum@table} macro in the |longtable| package,
+%    it contains the capitalized version of the counter name and the counter
+%    number (for example, |Figure~3|).
+%    \begin{macrocode}
+\def\LF@name{\expandafter\LFupcase%
+             \expandafter{\LFcounter}~%
+             \expandafter\csname the\LFcounter\endcsname}%
+%    \end{macrocode}
+%    The remainder of this package follows the |longtable| package
+%    almost identically, except that macros, skips, counters, and so on
+%    use an \cs{LF} prefix instead of the \cs{LT} prefix that the |longtable| package uses.
+%
+%    \begin{macrocode}
+\def\LF@err{\PackageError{longfigure}}
+\def\LF@warn{\PackageWarning{longfigure}}
+\def\LF@final@warn{%
+  \AtEndDocument{%
+    \LF@warn{\LFcounter \@width s have changed. Rerun \LaTeX\.\@gobbletwo}}%
+  \global\let\LF@final@warn\relax}
+%
+\newskip\LFleft       \LFleft=\fill
+\newskip\LFright      \LFright=\fill
+\newskip\LFpre        \LFpre=\bigskipamount
+\newskip\LFpost       \LFpost=\bigskipamount
+\newcount\LFchunksize \LFchunksize=20
+\let\c@LFchunksize\LFchunksize
+\newdimen\LFcapwidth  \LFcapwidth=4in
+\newbox\LF@head
+\newbox\LF@firsthead
+\newbox\LF@foot
+\newbox\LF@lastfoot
+\newcount\LF@cols
+\newcount\LF@rows
+\newcounter{LF@tables}
+\newcounter{LF@chunks}[LF@tables]
+%
+\newtoks\LF@p@ftn
+\mathchardef\LF@end@pen=30000
+\def\longfigure{%
+  \par
+  \ifx\multicols\@undefined
+  \else
+     \ifnum\col@number>\@ne
+       \@twocolumntrue
+     \fi
+  \fi
+  \if@twocolumn
+    \LF@err{longfigure not in 1-column mode}\@ehc
+  \fi
+  \begingroup
+  \@ifnextchar[\LF@array{\LF@array[x]}}
+\def\LF@array[#1]#2{%
+  \refstepcounter{\LFcounter}\stepcounter{LF@tables}%
+  \if l#1%
+    \LFleft\z@ \LFright\fill
+  \else\if r#1%
+    \LFleft\fill \LFright\z@
+  \else\if c#1%
+    \LFleft\fill \LFright\fill
+  \fi\fi\fi
+  \let\LF@mcol\multicolumn
+  \let\LF@@tabarray\@tabarray
+  \let\LF@@hl\hline
+  \def\@tabarray{%
+    \let\hline\LF@@hl
+    \LF@@tabarray}%
+  \let\\\LF@tabularcr\let\tabularnewline\\%
+  \def\newpage{\noalign{\break}}%
+  \def\pagebreak{\noalign{\ifnum`}=0\fi\@testopt{\LF@no@pgbk-}4}%
+  \def\nopagebreak{\noalign{\ifnum`}=0\fi\@testopt\LF@no@pgbk4}%
+  \let\hline\LF@hline \let\kill\LF@kill\let\caption\LF@caption
+  \@tempdima\ht\strutbox
+  \let\@endpbox\LF@endpbox
+  \ifx\extrarowheight\@undefined
+    \let\@acol\@tabacol
+    \let\@classz\@tabclassz \let\@classiv\@tabclassiv
+    \def\@startpbox{\vtop\LF@startpbox}%
+    \let\@@startpbox\@startpbox
+    \let\@@endpbox\@endpbox
+    \let\LF@LL@FM@cr\@tabularcr
+  \else
+    \advance\@tempdima\extrarowheight
+    \col@sep\tabcolsep
+    \let\@startpbox\LF@startpbox\let\LF@LL@FM@cr\@arraycr
+  \fi
+  \setbox\@arstrutbox\hbox{\vrule
+    \@height \arraystretch \@tempdima
+    \@depth \arraystretch \dp \strutbox
+    \@width \z@}%
+  \let\@sharp##\let\protect\relax
+   \begingroup
+    \@mkpream{#2}%
+    \xdef\LF@bchunk{%
+       \global\advance\c@LF@chunks\@ne
+       \global\LF@rows\z@\setbox\z@\vbox\bgroup
+       \LF@setprevdepth
+       \tabskip\LFleft \noexpand\halign to\hsize\bgroup
+      \tabskip\z@ \@arstrut \@preamble \tabskip\LFright \cr}%
+  \endgroup
+  \expandafter\LF@nofcols\LF@bchunk&\LF@nofcols
+  \LF@make@row
+  \m@th\let\par\@empty
+  \everycr{}\lineskip\z@\baselineskip\z@
+  \LF@bchunk}
+\def\LF@no@pgbk#1[#2]{\penalty #1\@getpen{#2}\ifnum`{=0\fi}}
+\def\LF@start{%
+  \let\LF@start\endgraf
+  \endgraf\penalty\z@\vskip\LFpre
+  \dimen@\pagetotal
+  \advance\dimen@ \ht\ifvoid\LF@firsthead\LF@head\else\LF@firsthead\fi
+  \advance\dimen@ \dp\ifvoid\LF@firsthead\LF@head\else\LF@firsthead\fi
+  \advance\dimen@ \ht\LF@foot
+  \dimen@ii\vfuzz
+  \vfuzz\maxdimen
+    \setbox\tw@\copy\z@
+    \setbox\tw@\vsplit\tw@ to \ht\@arstrutbox
+    \setbox\tw@\vbox{\unvbox\tw@}%
+  \vfuzz\dimen@ii
+  \advance\dimen@ \ht
+        \ifdim\ht\@arstrutbox>\ht\tw@\@arstrutbox\else\tw@\fi
+  \advance\dimen@\dp
+        \ifdim\dp\@arstrutbox>\dp\tw@\@arstrutbox\else\tw@\fi
+  \advance\dimen@ -\pagegoal
+  \ifdim \dimen@>\z@\vfil\break\fi
+      \global\@colroom\@colht
+  \ifvoid\LF@foot\else
+    \advance\vsize-\ht\LF@foot
+    \global\advance\@colroom-\ht\LF@foot
+    \dimen@\pagegoal\advance\dimen@-\ht\LF@foot\pagegoal\dimen@
+    \maxdepth\z@
+  \fi
+  \ifvoid\LF@firsthead\copy\LF@head\else\box\LF@firsthead\fi\nobreak
+  \output{\LF@output}}
+\def\endlongfigure{%
+  \crcr
+  \noalign{%
+    \let\LF@entry\LF@entry@chop
+    \xdef\LF@save@row{\LF@save@row}}%
+  \LF@echunk
+  \LF@start
+  \unvbox\z@
+  \LF@get@widths
+  \if@filesw
+    {\let\LF@entry\LF@entry@write\immediate\write\@auxout{%
+      \gdef\expandafter\noexpand
+        \csname LF@\romannumeral\c@LF@tables\endcsname
+          {\LF@save@row}}}%
+  \fi
+  \ifx\LF@save@row\LF@@save@row
+  \else
+    \LF@warn{Column \@width s have changed\MessageBreak
+             in table \thetable}%
+    \LF@final@warn
+  \fi
+  \endgraf\penalty -\LF@end@pen
+  \endgroup
+  \global\@mparbottom\z@
+  \pagegoal\vsize
+  \endgraf\penalty\z@\addvspace\LFpost
+  \ifvoid\footins\else\insert\footins{}\fi}
+\def\LF@nofcols#1&{%
+  \futurelet\@let@token\LF@n@fcols}
+\def\LF@n@fcols{%
+  \advance\LF@cols\@ne
+  \ifx\@let@token\LF@nofcols
+    \expandafter\@gobble
+  \else
+    \expandafter\LF@nofcols
+  \fi}
+\def\LF@tabularcr{%
+  \relax\iffalse{\fi\ifnum0=`}\fi
+  \@ifstar
+    {\def\crcr{\LF@crcr\noalign{\nobreak}}\let\cr\crcr
+     \LF@t@bularcr}%
+    {\LF@t@bularcr}}
+\let\LF@crcr\crcr
+\let\LF@setprevdepth\relax
+\def\LF@t@bularcr{%
+  \global\advance\LF@rows\@ne
+  \ifnum\LF@rows=\LFchunksize
+    \gdef\LF@setprevdepth{%
+      \prevdepth\z@\global
+      \global\let\LF@setprevdepth\relax}%
+    \expandafter\LF@xtabularcr
+  \else
+    \ifnum0=`{}\fi
+    \expandafter\LF@LL@FM@cr
+  \fi}
+\def\LF@xtabularcr{%
+  \@ifnextchar[\LF@argtabularcr\LF@ntabularcr}
+\def\LF@ntabularcr{%
+  \ifnum0=`{}\fi
+  \LF@echunk
+  \LF@start
+  \unvbox\z@
+  \LF@get@widths
+  \LF@bchunk}
+\def\LF@argtabularcr[#1]{%
+  \ifnum0=`{}\fi
+  \ifdim #1>\z@
+    \unskip\@xargarraycr{#1}%
+  \else
+    \@yargarraycr{#1}%
+  \fi
+  \LF@echunk
+  \LF@start
+  \unvbox\z@
+  \LF@get@widths
+  \LF@bchunk}
+\def\LF@echunk{%
+  \crcr\LF@save@row\cr\egroup
+  \global\setbox\@ne\lastbox
+    \unskip
+  \egroup}
+\def\LF@entry#1#2{%
+  \ifhmode\@firstofone{&}\fi\omit
+  \ifnum#1=\c@LF@chunks
+  \else
+    \kern#2\relax
+  \fi}
+\def\LF@entry@chop#1#2{%
+  \noexpand\LF@entry
+    {\ifnum#1>\c@LF@chunks
+       1}{0pt%
+     \else
+       #1}{#2%
+     \fi}}
+\def\LF@entry@write{%
+  \noexpand\LF@entry^^J%
+  \@spaces}
+\def\LF@kill{%
+  \LF@echunk
+  \LF@get@widths
+  \expandafter\LF@rebox\LF@bchunk}
+\def\LF@rebox#1\bgroup{%
+  #1\bgroup
+  \unvbox\z@
+  \unskip
+  \setbox\z@\lastbox}
+\def\LF@blank@row{%
+  \xdef\LF@save@row{\expandafter\LF@build@blank
+    \romannumeral\number\LF@cols 001 }}
+\def\LF@build@blank#1{%
+  \if#1m%
+    \noexpand\LF@entry{1}{0pt}%
+    \expandafter\LF@build@blank
+  \fi}
+\def\LF@make@row{%
+  \global\expandafter\let\expandafter\LF@save@row
+    \csname LF@\romannumeral\c@LF@tables\endcsname
+  \ifx\LF@save@row\relax
+    \LF@blank@row
+  \else
+    {\let\LF@entry\or
+     \if!%
+         \ifcase\expandafter\expandafter\expandafter\LF@cols
+         \expandafter\@gobble\LF@save@row
+         \or
+         \else
+           \relax
+         \fi
+        !%
+     \else
+       \aftergroup\LF@blank@row
+     \fi}%
+  \fi}
+\let\setlongfigures\relax
+\def\LF@get@widths{%
+  \setbox\tw@\hbox{%
+    \unhbox\@ne
+    \let\LF@old@row\LF@save@row
+    \global\let\LF@save@row\@empty
+    \count@\LF@cols
+    \loop
+      \unskip
+      \setbox\tw@\lastbox
+    \ifhbox\tw@
+      \LF@def@row
+      \advance\count@\m@ne
+    \repeat}%
+  \ifx\LF@@save@row\@undefined
+    \let\LF@@save@row\LF@save@row
+  \fi}
+\def\LF@def@row{%
+  \let\LF@entry\or
+  \edef\@tempa{%
+    \ifcase\expandafter\count@\LF@old@row
+    \else
+      {1}{0pt}%
+    \fi}%
+  \let\LF@entry\relax
+  \xdef\LF@save@row{%
+    \LF@entry
+    \expandafter\LF@max@sel\@tempa
+    \LF@save@row}}
+\def\LF@max@sel#1#2{%
+  {\ifdim#2=\wd\tw@
+     #1%
+   \else
+     \number\c@LF@chunks
+   \fi}%
+  {\the\wd\tw@}}
+\def\LF@hline{%
+  \noalign{\ifnum0=`}\fi
+    \penalty\@M
+    \futurelet\@let@token\LF@@hline}
+\def\LF@@hline{%
+  \ifx\@let@token\hline
+    \global\let\@gtempa\@gobble
+    \gdef\LF@sep{\penalty-\@medpenalty\vskip\doublerulesep}%
+  \else
+    \global\let\@gtempa\@empty
+    \gdef\LF@sep{\penalty-\@lowpenalty\vskip-\arrayrulewidth}%
+  \fi
+  \ifnum0=`{\fi}%
+  \multispan\LF@cols
+     \unskip\leaders\hrule\@height\arrayrulewidth\hfill\cr
+  \noalign{\LF@sep}%
+  \multispan\LF@cols
+     \unskip\leaders\hrule\@height\arrayrulewidth\hfill\cr
+  \noalign{\penalty\@M}%
+  \@gtempa}
+%    \end{macrocode}
+% \subsection{Captioning}
+%    You can easily change how a long figure is captioned by
+%    redefining the \cs{LF@makecaption} macro after loading the |longfigure| package.
+%    The following statements show the default definition of the
+%    \cs{LF@makecaption}:
+%
+%    \begin{macrocode}
+\def\LF@caption{%
+  \noalign\bgroup
+    \@ifnextchar[{\egroup\LF@c@ption\@firstofone}\LF@capti@n}
+%    \end{macrocode}
+%    The \cs{LF@caption} command begins the process.
+%    If it includes an optional argument, it calls \cs{LF@c@ption}; otherwise
+%    it calls \cs{LF@capti@n}, which then calls \cs{LF@c@ption}.
+%    \begin{macrocode}
+\def\LF@c@ption#1[#2]#3{%
+  \LF@makecaption#1\LF@name{#3}%
+  \def\@tempa{#2}%
+  \ifx\@tempa\@empty\else
+%    \end{macrocode}
+%    If a list of long figures is requested, the following code uses the
+%    previously defined \cs{strcfstr} macro and  \cs{ifLF@same} boolean
+%    to determine the name of the counter and set the  output file to
+%    contain the |longfigure| information.
+%
+%    The code writes to one of the following files.
+%    \begin{itemize}
+%     \item If the counter is |figure|, write to the |lof| file.
+%     \item If the counter is |table|, write to the |lot| file.
+%     \item Otherwise, write to |lft|, a file created here for this purpose.
+%    \end{itemize}
+%
+%    \begin{macrocode}
+     {\let\\\space
+     \strcfstr{\LFcounter}{figure}
+       \ifLF@same\def\LFoutfile{lof}\else
+         \strcfstr{\LFcounter}{table}
+           \ifLF@same\def\LFoutfile{lot}\else
+             \def\LFoutfile{lft}\fi\fi
+     \addcontentsline{\LFoutfile}{\LFcounter}
+     {\expandafter\protect\expandafter\numberline\expandafter%
+  {\expandafter\csname the\LFcounter\endcsname}{#2}}}%
+  \fi
+}
+%    \end{macrocode}
+%    The \cs{LF@c@ption} macro ends the process when it calls the
+%    \cs{LF@makecaption} macro, which typesets the caption.
+%    \begin{macrocode}
+\def\LF@capti@n{%
+  \@ifstar
+    {\egroup\LF@c@ption\@gobble[]}%
+    {\egroup\@xdblarg{\LF@c@ption\@firstofone}}}
+%    \end{macrocode}
+%
+%    If you want to redefine how the |longfigure| is captioned,
+%    you need to override the following macro.
+%    The first argument is the name of the counter
+%    (for example, |Figure|), the second argument is the number of the counter, and the
+%    third argument is the caption itself.
+%    \begin{macrocode}
+\def\LF@makecaption#1#2#3{%
+  \LF@mcol\LF@cols c{\hbox to\z@{\hss\parbox[t]\LFcapwidth{%
+    \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}}}
+\def\LF@output{%
+  \ifnum\outputpenalty <-\@Mi
+    \ifnum\outputpenalty > -\LF@end@pen
+      \LF@err{floats and marginpars not allowed in a longfigure}\@ehc
+    \else
+      \setbox\z@\vbox{\unvbox\@cclv}%
+      \ifdim \ht\LF@lastfoot>\ht\LF@foot
+        \dimen@\pagegoal
+        \advance\dimen@-\ht\LF@lastfoot
+        \ifdim\dimen@<\ht\z@
+          \setbox\@cclv\vbox{\unvbox\z@\copy\LF@foot\vss}%
+          \@makecol
+          \@outputpage
+          \setbox\z@\vbox{\box\LF@head}%
+        \fi
+      \fi
+      \global\@colroom\@colht
+      \global\vsize\@colht
+      \vbox
+        {\unvbox\z@\box\ifvoid\LF@lastfoot\LF@foot\else
+         \LF@lastfoot\fi}%
+    \fi
+  \else
+    \setbox\@cclv\vbox{\unvbox\@cclv\copy\LF@foot\vss}%
+    \@makecol
+    \@outputpage
+      \global\vsize\@colroom
+    \copy\LF@head\nobreak
+  \fi}
+\def\LF@end@hd@ft#1{%
+  \LF@echunk
+  \ifx\LF@start\endgraf
+    \LF@err
+     {Longfigure head or foot not at start of table}%
+     {Increase LFchunksize}%
+  \fi
+  \setbox#1\box\z@
+  \LF@get@widths
+  \LF@bchunk}
+%    \end{macrocode}
+%    The following four macros do not have an \cs{LT} prefix in the |longtable| package,
+%    but they must be redefined to have an \cs{LF} prefix in order to avoid a namespace clash;
+%    \begin{macrocode}
+\def\endLFfirsthead{\LF@end@hd@ft\LF@firsthead}
+\def\endLFhead{\LF@end@hd@ft\LF@head}
+\def\endLFfoot{\LF@end@hd@ft\LF@foot}
+\def\endLFlastfoot{\LF@end@hd@ft\LF@lastfoot}
+ %
+\def\LF@startpbox#1{%
+  \bgroup
+    \let\@footnotetext\LF@p@ftntext
+    \setlength\hsize{#1}%
+    \@arrayparboxrestore
+    \vrule \@height \ht\@arstrutbox \@width \z@}
+\def\LF@endpbox{%
+  \@finalstrut\@arstrutbox
+  \egroup
+  \the\LF@p@ftn
+  \global\LF@p@ftn{}%
+  \hfil}
+\def\LF@p@ftntext#1{%
+  \edef\@tempa{\the\LF@p@ftn\noexpand\footnotetext[\the\c@footnote]}%
+  \global\LF@p@ftn\expandafter{\@tempa{#1}}}%
+%    \end{macrocode}
+%    \subsection{References}
+%    \begin{description}
+%    \item[\textmd{Carlisle, D. 2004.}]
+%    \emph{The longtable Package}.
+%    Included in the ``Comprehensive \TeX\ Archive Network.'' \url{http://ctan.org}.
+%
+%    \item[\textmd{Lazarides, Y. 2010.}]
+%    \TeX stackexchange, online forum. \url{http://tex.stackexchange.com/questions/7992}.
+%
+%    \item[\textmd{Sch\"opf, R., B. Raichle, and C. Rowley. 2001.}]
+%    \emph{A New Implementation of \LaTeX's \texttt{verbatim} and \texttt{verbatim*} Environments}.
+%    Originally appeared in TUGboat 1990, 11(2), 284--296.
+%
+%    \item[\textmd{Thanh, H., S. Rahtz, H. Hagen, and H. Henkel. 2009.}]
+%    ``The pdf\TeX\ User's Manual'' Revision 655, corresponding to pdf\TeX\ 1.40.11.
+%    \url{www.tug.org/applications/pdftex}
+%
+%    \item[\textmd{Wilson, Peter. 2001.}]
+%    \emph{Glisterings} in TUGboat 22(4), 339--340.
+%    \end{description}
+%
+%\StopEventually{^^A
+%  \PrintChanges
+%  \PrintIndex
+%}
+%
+%    \begin{macrocode}
+%</longfigure>
+%    \end{macrocode}
+%\Finale
-- 
cgit v1.2.3

