Plan 9 from Bell Labs’s /usr/web/sources/contrib/steve/root/sys/lib/texmf/tex/latex/misc/hangcaption.sty

Copyright © 2021 Plan 9 Foundation.
Distributed under the MIT License.
Download the Plan 9 distribution.


%%% ====================================================================
%%%  @LaTeX-style-file{
%%%     filename        = "hangcaption.sty",
%%%     version         = "2.00",
%%%     date            = "27 August 1992",
%%%     time            = "22:23:46 EDT",
%%%     author          = "David M. Jones",
%%%     address         = "MIT Laboratory for Computer Science
%%%                        Room NE43-316
%%%                        545 Technology Square
%%%                        Cambridge, MA 02139
%%%                        USA",
%%%     telephone       = "(617) 253-5936",
%%%     FAX             = "(617) 253-3480",
%%%     checksum        = "57880 113 520 5319",
%%%     email           = "dmjones@theory.lcs.mit.edu",
%%%     codetable       = "ISO/ASCII",
%%%     keywords        = "LaTeX, caption",
%%%     supported       = "no",
%%%     abstract        = "Defines a variant of the caption command to
%%%                        produce captions with hanging
%%%                        indentation.",
%%%     docstring       = "This is the debugged version of a modified
%%%                        caption macro, \hangcaption, to produce
%%%                        captions with hanging indentation, like
%%%                        this:
%%%
%%%                        Figure 1.1: XXXXX XXX XXXX XXXX XXX
%%%                                    XXX XXX XXX XXX XX XXX
%%%
%%%                        The length variable \captionwidth controls
%%%                        how the caption is typeset.  If the width
%%%                        of the caption is less than \captionwidth,
%%%                        the \hangcaption is typeset the same way a
%%%                        short \caption would be (usually centered).
%%%                        Otherwise, it is set as shown above, with a
%%%                        total width equal to \captionwidth.
%%%                        \captionwidth is set to \hsize normally,
%%%                        but you may want to change it temporarily
%%%                        to match the width of a \tabular*
%%%                        environment, for example.
%%%
%%%                        \hangcaption is used in the same way as
%%%                        \caption.  To retain compatibility with
%%%                        previous versions of this style, the
%%%                        \hangcaption is also available under the
%%%                        name \isucaption.
%%%
%%%                        I did not write this file.  The original
%%%                        author is unknown.  However, I did fix a bug,
%%%                        namely, I removed a superflous "^^" that was
%%%                        causing one of the close braces to be
%%%                        interpreted as an equals sign, thus messing
%%%                        up the brace balancing.  I also tacked an
%%%                        "\endinput" on to the end of the file and
%%%                        added this header, and incorporated a few
%%%                        changes suggested by Harm Bakker, George
%%%                        Greenwade, and Rainer Schoepf.
%%%
%%%                        v2.00 (27 Aug 1992): altered \numberline to
%%%                        use \the... instead of \fnum@... (fix due to
%%%                        Harm Bakker <bakker@cs.rulimburg.nl>).
%%%                        Changed \isucaption to \hangcaption at George
%%%                        Greenwade's <bed_gdg@SHSU.edu> suggestion.
%%%
%%%                        v1.03 (12 August 1992): minor changes to
%%%                        header.
%%%
%%%                        v1.02 (12 August 1992): patches by Rainer
%%%                        Schoepf <schoepf@sc.ZIB-Berlin.DE> to (a)
%%%                        work around a bug in LaTeX and (b) measure
%%%                        the caption correctly by including room for
%%%                        the colon and the space.
%%%
%%%                        The checksum field above contains a CRC-16
%%%                        checksum as the first value, followed by the
%%%                        equivalent of the standard UNIX wc (word
%%%                        count) utility output of lines, words, and
%%%                        characters.  This is produced by Robert
%%%                        Solovay's checksum utility.",
%%%  }
%%% ====================================================================

\newlength\captionwidth \captionwidth=\hsize

\def\hangcaption{\refstepcounter\@captype\@dblarg{\@hangcaption\@captype}}

\long\def\@hangcaption#1[#2]#3{%
  \baselineskip 14.5\p@
  \addcontentsline{\csname ext@#1\endcsname}{#1}%
    {\protect\numberline{\csname the#1\endcsname}{\ignorespaces #2}}%
  \par
  \begingroup
    \@parboxrestore
    \setbox\@tempboxa\hbox{\csname fnum@#1\endcsname: #3}%
    \ifdim \wd\@tempboxa > \captionwidth
      \begingroup
        \setbox\@tempboxa\hbox{\csname fnum@#1\endcsname: }%
        \advance \captionwidth by -\wd\@tempboxa
        \@makecaption{\csname fnum@#1\endcsname}%
            {\ignorespaces{\protect\parbox[t]{\captionwidth}{\leavevmode#3}}}%
      \endgroup
    \else
      \begingroup
        \@makecaption{\csname fnum@#1\endcsname}{\ignorespaces #3}%
      \endgroup
    \fi
    \par\vspace{1.7ex}%
  \endgroup}

\let\isucaption\hangcaption

\endinput

Bell Labs OSI certified Powered by Plan 9

(Return to Plan 9 Home Page)

Copyright © 2021 Plan 9 Foundation. All Rights Reserved.
Comments to webmaster@9p.io.