| 1 |
% \iffalse meta-comment |
| 2 |
% |
| 3 |
% This is file `caption-light.dtx'. |
| 4 |
% |
| 5 |
% Copyright (C) 2020-2021 Axel Sommerfeldt ([email protected]) |
| 6 |
% |
| 7 |
% -------------------------------------------------------------------------- |
| 8 |
% |
| 9 |
% This work may be distributed and/or modified under the |
| 10 |
% conditions of the LaTeX Project Public License, either version 1.3 |
| 11 |
% of this license or (at your option) any later version. |
| 12 |
% The latest version of this license is in |
| 13 |
% http://www.latex-project.org/lppl.txt |
| 14 |
% and version 1.3 or later is part of all distributions of LaTeX |
| 15 |
% version 2003/12/01 or later. |
| 16 |
% |
| 17 |
% This work has the LPPL maintenance status "maintained". |
| 18 |
% |
| 19 |
% This Current Maintainer of this work is Axel Sommerfeldt. |
| 20 |
% |
| 21 |
% This work consists of the files |
| 22 |
% caption.ins, caption.dtx, caption-light.dtx, caption2.dtx, caption3.dtx, |
| 23 |
% caption-ams-smf.dtx, caption-beamer.dtx, caption-elsarticle.dtx, |
| 24 |
% caption-koma.dtx, caption-memoir.dtx, caption-ntg.dtx, |
| 25 |
% caption-thesis.dtx, bicaption.dtx, ltcaption.dtx, subcaption.dtx, |
| 26 |
% the derived files |
| 27 |
% caption.sty, caption-light.sty, caption2.sty, caption3.sty, |
| 28 |
% caption-ams-smf.sto, caption-beamer.sto, caption-elsarticle.sto, |
| 29 |
% caption-koma.sto, caption-memoir.sto, caption-ntg.sto, |
| 30 |
% caption-thesis.sto, bicaption.sty, ltcaption.sty, subcaption.sty. |
| 31 |
% |
| 32 |
% \fi |
| 33 |
% |
| 34 |
% \CheckSum{99} |
| 35 |
% |
| 36 |
% \iffalse |
| 37 |
%<*driver> |
| 38 |
\NeedsTeXFormat{LaTeX2e}[1994/12/01] |
| 39 |
\ProvidesFile{caption-light.drv}[2020/08/24 v1.0 Customizing captions (AR)] |
| 40 |
%\errorcontextlines=3 |
| 41 |
% |
| 42 |
\documentclass{captiondoc} |
| 43 |
\hypersetup{pdfkeywords={LaTeX, package, caption-light}} |
| 44 |
% |
| 45 |
\usepackage{caption-light}[2020/08/23] % needs v1.0 or newer |
| 46 |
% |
| 47 |
\begin{document} |
| 48 |
\DocInput{caption-light.dtx} |
| 49 |
\end{document} |
| 50 |
%</driver> |
| 51 |
% \fi |
| 52 |
% |
| 53 |
% \def\thispackage{the \pkg{caption-light} package} |
| 54 |
% \def\Thispackage{The \pkg{caption-light} package} |
| 55 |
% |
| 56 |
% \GetFileInfo{caption-light.drv} |
| 57 |
% \let\docdate\filedate |
| 58 |
% \let\docversion\fileversion |
| 59 |
% \GetFileInfo{caption-light.sty} |
| 60 |
% |
| 61 |
% \title{\texorpdfstring{\Thispackage\thanks{%^^A |
| 62 |
% This package has version number \docversion.}}%^^A |
| 63 |
% {The caption-light package}} |
| 64 |
% \author{Axel Sommerfeldt\\ |
| 65 |
% \url{https://gitlab.com/axelsommerfeldt/caption}} |
| 66 |
% \date{\docdate} |
| 67 |
% \maketitle |
| 68 |
% |
| 69 |
% \begin{abstract} |
| 70 |
% \Thispackage\ offers (limited) customization of captions |
| 71 |
% in floating environments such |figure| and |table|. |
| 72 |
% \par\smallskip |
| 73 |
% \textit{Please note:} Many document classes already have build-in options and |
| 74 |
% commands for customizing captions. |
| 75 |
% If these possibilities are sufficient for you, there is usually no need for |
| 76 |
% you to use the \pkg{caption} package at all. |
| 77 |
% And if you are just interested in using the command \cs{captionof}, loading |
| 78 |
% of the very small \pkg{capt-of} package is usually sufficient. |
| 79 |
% \end{abstract} |
| 80 |
% |
| 81 |
% \iffalse\clearpage\fi |
| 82 |
% \setcounter{tocdepth}{2} |
| 83 |
% \tableofcontents |
| 84 |
% |
| 85 |
% \clearpage |
| 86 |
% \section{Loading the package} |
| 87 |
% |
| 88 |
% Load this package using |
| 89 |
% \begin{quote} |
| 90 |
% |\usepackage|\oarg{options}|{caption-light}| |
| 91 |
% \end{quote} |
| 92 |
% or |
| 93 |
% \begin{quote} |
| 94 |
% |\usepackage{caption-light}|\\ |
| 95 |
% \ldots\\ |
| 96 |
% |\captionsetup|\marg{options} |
| 97 |
% \end{quote} |
| 98 |
% As opposite to the \pkg{caption} package only a limited set of options is |
| 99 |
% supported by \thispackage: |
| 100 |
% |aboveskip=|\ldots, |
| 101 |
% |belowskip=|\ldots, |
| 102 |
% |font=|\ldots, |
| 103 |
% |justification=|\ldots, |
| 104 |
% |labelfont=|\ldots, |
| 105 |
% |labelseparator=|\ldots, |
| 106 |
% |position=|\ldots, |
| 107 |
% |singlelinecheck=|\ldots, |
| 108 |
% |skip=|\ldots, and |
| 109 |
% |textfont=|\ldots |
| 110 |
% |
| 111 |
% See \pkg{caption} package documentation for the meaning and usage of |
| 112 |
% these options. |
| 113 |
% |
| 114 |
% \section{Commands} |
| 115 |
% |
| 116 |
% This package offers |\caption|\-|setup|, |\set|\-|caption|\-|type|, and |
| 117 |
% |\caption|\-|of| as well. |
| 118 |
% |
| 119 |
% \section{Why this package?} |
| 120 |
% |
| 121 |
% This package offers some advantages over the \pkg{caption} package: |
| 122 |
% \begin{itemize} |
| 123 |
% \item It does not depend on correct |\hsize| for "long" captions, |
| 124 |
% just like the original definition included in |article|, |report|, and |book|. |
| 125 |
% \item If the caption is typeset as "short" (centered), the content of |
| 126 |
% the caption is evaluated only once, |
| 127 |
% just like the original definition included in |article|, |report|, and |book|. |
| 128 |
% \item It does not re-define |\caption| and floating environments, |
| 129 |
% therefore avoiding incompatibilities. |
| 130 |
% \item It does not patch any other packages, therefore avoiding |
| 131 |
% incompatibilities. |
| 132 |
% \end{itemize} |
| 133 |
% |
| 134 |
% In short it's a more compatible and less troublesome variant of the |
| 135 |
% \pkg{caption} package, but (much) less powerful. |
| 136 |
% |
| 137 |
% \iffalse |
| 138 |
% --------------------------------------------------------------------------- % |
| 139 |
% \fi |
| 140 |
% |
| 141 |
% \StopEventually{%^^A |
| 142 |
% } |
| 143 |
% |
| 144 |
% \iffalse |
| 145 |
% --------------------------------------------------------------------------- % |
| 146 |
% \fi |
| 147 |
% |
| 148 |
% \DoNotIndex{\\,\_,\ ,\@@par} |
| 149 |
% \DoNotIndex{\@bsphack} |
| 150 |
% \DoNotIndex{\@car,\@cdr,\@classoptionslist,\@cons,\@currext,\@currname} |
| 151 |
% \DoNotIndex{\@ehc,\@ehd,\@empty,\@esphack,\@expandtwoargs} |
| 152 |
% \DoNotIndex{\@for,\@firstofone,\@firstoftwo} |
| 153 |
% \DoNotIndex{\@gobble,\@gobblefour,\@gobbletwo,\@hangfrom} |
| 154 |
% \DoNotIndex{\if@minipage,\@ifnextchar,\@ifpackagelater,\@ifpackageloaded} |
| 155 |
% \DoNotIndex{\@ifstar,\@ifundefined,\@latex@error,\@namedef,\@nameuse} |
| 156 |
% \DoNotIndex{\@onlypreamble,\@parboxrestore,\@plus,\@ptionlist} |
| 157 |
% \DoNotIndex{\@removeelement,\@restorepar,\@secondoftwo,\@setpar} |
| 158 |
% \DoNotIndex{\@tempa,\@tempboxa,\@tempdima,\@tempdimb,\@tempdimc,\@tempb,\@tempc} |
| 159 |
% \DoNotIndex{\@testopt} |
| 160 |
% \DoNotIndex{\@undefined,\@unprocessedoptions,\@unusedoptionlist} |
| 161 |
% \DoNotIndex{\p@,\z@} |
| 162 |
% \DoNotIndex{\active,\addtocounter,\addtolength,\advance,\aftergroup} |
| 163 |
% \DoNotIndex{\baselineskip,\begin,\begingroup,\bfseries,\box} |
| 164 |
% \DoNotIndex{\catcode,\centering,\changes,\csname,\def,\divide,\do,\downarrow} |
| 165 |
% \DoNotIndex{\edef,\else,\empty,\end,\endcsname,\endgraf,\endgroup,\expandafter} |
| 166 |
% \DoNotIndex{\fi,\footnotesize,\global} |
| 167 |
% \DoNotIndex{\hangindent,\hbox,\hfil,\hsize,\hskip,\hspace,\hss} |
| 168 |
% \DoNotIndex{\ifcase,\ifdim,\ifnum,\ifodd,\ifvoid,\ifvmode} |
| 169 |
% \DoNotIndex{\ifx,\ignorespaces,\itshape} |
| 170 |
% \DoNotIndex{\kernel@ifnextchar} |
| 171 |
% \DoNotIndex{\Large,\large,\leavevmode,\leftmargini,\leftskip,\let,\linewidth} |
| 172 |
% \DoNotIndex{\llap,\long,\m@ne,\margin,\mdseries,\message} |
| 173 |
% \DoNotIndex{\newcommand,\newdimen,\newlength,\newline,\newif,\newsavebox} |
| 174 |
% \DoNotIndex{\next,\nobreak,\nobreakspace,\noexpand,\noindent,\numberline} |
| 175 |
% \DoNotIndex{\normalcolor,\normalfont,\normalsize,\or,\par,\parbox,\parfillskip} |
| 176 |
% \DoNotIndex{\parindent,\parskip,\prevdepth,\protect,\protected@edef,\protected@write} |
| 177 |
% \DoNotIndex{\providecommand,\quad} |
| 178 |
% \DoNotIndex{\raggedleft,\raggedright,\relax,\renewcommand,\RequirePackage} |
| 179 |
% \DoNotIndex{\rightskip,\rmfamily} |
| 180 |
% \DoNotIndex{\sbox,\scriptsize,\scshape,\setbox,\setlength,\sffamily,\slshape} |
| 181 |
% \DoNotIndex{\small,\string,\space,\strut} |
| 182 |
% \DoNotIndex{\textheight,\the,\toks@,\typeout,\ttfamily} |
| 183 |
% \DoNotIndex{\unvbox,\uparrow,\upshape,\usebox,\usepackage} |
| 184 |
% \DoNotIndex{\value,\vbox,\vsize,\vskip,\wd,\width,\z@skip} |
| 185 |
% \DoNotIndex{\AtBeginDocument,\AtEndOfPackage,\CurrentOption,\DeclareOption} |
| 186 |
% \DoNotIndex{\ExecuteOptions,\GenericWarning,\IfFileExists,\InputIfFileExists} |
| 187 |
% \DoNotIndex{\NeedsTeXFormat,\MessageBreak} |
| 188 |
% \DoNotIndex{\PackageError,\PackageInfo,\PackageWarning,\PackageWarningNoLine} |
| 189 |
% \DoNotIndex{\PassOptionsToPackage,\ProcessOptions,\ProvidesPackage} |
| 190 |
% |
| 191 |
% \iffalse |
| 192 |
% --------------------------------------------------------------------------- % |
| 193 |
% \fi |
| 194 |
% |
| 195 |
% \setlength{\parskip}{0pt plus 1pt} |
| 196 |
% \changes{v1.0}{2020/08/24}{First version} |
| 197 |
% |
| 198 |
% \newcommand*\Note[2][Note]{\par{\small\emph{#1:} #2}} |
| 199 |
% |
| 200 |
% \iffalse |
| 201 |
% --------------------------------------------------------------------------- % |
| 202 |
% \fi |
| 203 |
% |
| 204 |
% \clearpage |
| 205 |
% \section{The implementation} |
| 206 |
% \iffalse |
| 207 |
%<*package> |
| 208 |
% \fi |
| 209 |
% |
| 210 |
% \subsection{Identification} |
| 211 |
% |
| 212 |
% \begin{macrocode} |
| 213 |
\NeedsTeXFormat{LaTeX2e}[1994/12/01] |
| 214 |
\ProvidesPackage{caption-light}[2021/03/21 v1.0a Customizing captions (AR)] |
| 215 |
% \end{macrocode} |
| 216 |
% |
| 217 |
% \section{Loading the kernel} |
| 218 |
% |
| 219 |
% \begin{macrocode} |
| 220 |
\RequirePackage{caption3}[2020/08/30] % needs v2.0 or newer |
| 221 |
% \end{macrocode} |
| 222 |
% |
| 223 |
% \section{Check against unknown document classes} |
| 224 |
% |
| 225 |
% \begin{macrocode} |
| 226 |
\caption@ifbool{documentclass}{}{% |
| 227 |
\caption@WarningNoLine{% |
| 228 |
Unknown document class (or package),\MessageBreak |
| 229 |
standard defaults will be used}} |
| 230 |
% \end{macrocode} |
| 231 |
% |
| 232 |
% \section{Check against incompatible packages} |
| 233 |
% |
| 234 |
% \begin{macrocode} |
| 235 |
\@ifpackageloaded{caption2}{% |
| 236 |
\caption@Error{% |
| 237 |
You can't use both, the (obsolete) caption2 *and*\MessageBreak |
| 238 |
the caption-light package}% |
| 239 |
\endinput |
| 240 |
}{} |
| 241 |
% \end{macrocode} |
| 242 |
% |
| 243 |
% \section{Processing of options} |
| 244 |
% |
| 245 |
% \begin{macrocode} |
| 246 |
\caption@SetupOptions{caption-light}{\caption@setkeys{caption}{#2}} |
| 247 |
\caption@ProcessOptions*{caption-light} |
| 248 |
% \end{macrocode} |
| 249 |
% |
| 250 |
% \section{\cs{@makecaption}} |
| 251 |
% |
| 252 |
% If the \pkg{caption} package is loaded, we abort processing this file. |
| 253 |
% \begin{macrocode} |
| 254 |
\caption@ifdefined\caption@makecaption |
| 255 |
{\caption@Info{\noexpand\caption@makecaption is already defined}% |
| 256 |
\endinput}{} |
| 257 |
% \end{macrocode} |
| 258 |
% |
| 259 |
% \begin{macro}{\caption@makecaption} |
| 260 |
% \changes{v1.0a}{2021/03/21}{Support of \cs{ifcaption@star} and \cs{caption@@make@epilogue} added} |
| 261 |
% |\@makecaption|\marg{label}\marg{text}\\ |
| 262 |
% We do basically the same as the original code (from the standard |
| 263 |
% \LaTeX\ document classes), but take care of selected settings |
| 264 |
% offered by the \pkg{caption3} kernel. |
| 265 |
% \begin{macrocode} |
| 266 |
\long\def\caption@makecaption#1#2{% |
| 267 |
\caption@iftop\caption@belowskip\caption@aboveskip |
| 268 |
\caption@labelseparator % defines \caption@iflabelfont and \caption@labelsep |
| 269 |
\caption@singlelinecheck |
| 270 |
{\sbox\@tempboxa{\caption@@makecaption{#1}{#2}}% |
| 271 |
\ifdim \wd\@tempboxa >\hsize}% |
| 272 |
{\iftrue}% |
| 273 |
\caption@@makecaption{#1}{#2}\par |
| 274 |
\else |
| 275 |
\global \@minipagefalse |
| 276 |
\hb@xt@\hsize{\hfil\box\@tempboxa\hfil}% |
| 277 |
\fi |
| 278 |
\caption@iftop\caption@aboveskip\caption@belowskip |
| 279 |
\caption@@make@epilogue} |
| 280 |
% \end{macrocode} |
| 281 |
% \begin{macrocode} |
| 282 |
\newcommand\caption@@makecaption[2]{% |
| 283 |
\caption@applyfont |
| 284 |
\ifcaption@star\else |
| 285 |
\begingroup |
| 286 |
\captionlabelfont #1\relax\relax |
| 287 |
\endgroup |
| 288 |
\fi |
| 289 |
\ifcaption@star\else |
| 290 |
\begingroup |
| 291 |
\caption@iflabelfont\captionlabelfont |
| 292 |
\relax\caption@labelsep |
| 293 |
\endgroup |
| 294 |
\fi |
| 295 |
\begingroup |
| 296 |
\captiontextfont #2% |
| 297 |
\endgroup} |
| 298 |
% \end{macrocode} |
| 299 |
% \end{macro} |
| 300 |
% |
| 301 |
% \begin{macro}{\@makecaption} |
| 302 |
% Patch |\@makecaption|, so our definition will be used. |
| 303 |
% \begin{macrocode} |
| 304 |
\let\@makecaption\caption@makecaption |
| 305 |
% \end{macrocode} |
| 306 |
% \end{macro} |
| 307 |
% |
| 308 |
% \section{\cs{setcaptiontype}} |
| 309 |
% |
| 310 |
% We offer the options |type=| and |type*=|, too: |
| 311 |
% \begin{macrocode} |
| 312 |
\caption@AtBeginDocument{% |
| 313 |
% \end{macrocode} |
| 314 |
% \begin{macrocode} |
| 315 |
\DeclareCaptionOption{type}{\setcaptiontype{#1}}% |
| 316 |
\DeclareCaptionOption{type*}{\setcaptiontype*{#1}}% |
| 317 |
% \end{macrocode} |
| 318 |
% \begin{macrocode} |
| 319 |
} |
| 320 |
% \end{macrocode} |
| 321 |
% \begin{macro}{\setcaptiontype} |
| 322 |
% |\setcaptiontype*|\marg{type}\\ |
| 323 |
% For compatibility reasons we offer a starred variant as well, |
| 324 |
% but it does not differ from the non-starred variant here. |
| 325 |
% \begin{macrocode} |
| 326 |
\newcommand*\setcaptiontype{% |
| 327 |
\caption@teststar{\def\@captype}{}{}} |
| 328 |
% \end{macrocode} |
| 329 |
% \end{macro} |
| 330 |
% |
| 331 |
% \begin{macro}{\captionof} |
| 332 |
% |\captionof*|\marg{type}\oarg{list-entry}\marg{text}\\ |
| 333 |
% For compatibility reasons we offer a starred variant as well. |
| 334 |
% \begin{macrocode} |
| 335 |
\caption@AtBeginDocument{% |
| 336 |
\def\captionof{\caption@teststar\caption@of{\caption*}\caption}} |
| 337 |
% \end{macrocode} |
| 338 |
% \begin{macrocode} |
| 339 |
\newcommand*\caption@of[2]{\setcaptiontype*{#2}#1} |
| 340 |
% \end{macrocode} |
| 341 |
% \end{macro} |
| 342 |
% |
| 343 |
% \iffalse |
| 344 |
%</package> |
| 345 |
% \fi |
| 346 |
% |
| 347 |
% \iffalse |
| 348 |
% --------------------------------------------------------------------------- % |
| 349 |
% \fi |
| 350 |
% |
| 351 |
% \Finale |
| 352 |
% |
| 353 |
\endinput |