<html><head><meta name="color-scheme" content="light dark"></head><body><pre style="word-wrap: break-word; white-space: pre-wrap;">% \iffalse meta-comment
% 
% This is file `caption-memoir.dtx'.
% 
% Copyright (C) 2011-2023 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{90}
%
% \iffalse
%&lt;*driver&gt;
\NeedsTeXFormat{LaTeX2e}[1994/12/01]
\ProvidesFile{caption-memoir.drv}[2023/07/10 v2.2 Implementation of the caption-memoir package]
%\errorcontextlines=3
%
\documentclass{captiondoc}
\hypersetup{pdfkeywords={LaTeX, package, caption-memoir}}
%
\begin{document}
  \DocInput{caption-memoir.dtx}
\end{document}
%&lt;/driver&gt;
% \fi
%
% \GetFileInfo{caption-memoir.drv}
% \let\docdate\filedate
% \let\docversion\fileversion
% \GetFileInfo{caption-memoir.sto}
%
% \title{\texorpdfstring
%   {The adaption of the \pkg{caption} package to the \cls{memoir} document class\thanks{%^^A
%    This adaption has version number \docversion.}}%^^A
%   {The adaption of the caption package to the memoir document class}}
% \author{Axel Sommerfeldt\\
%         \url{https://gitlab.com/axelsommerfeldt/caption}}
% \date{\docdate}
% \maketitle
%
% \begin{abstract}
% This package adapts the \pkg{caption} package to the \cls{memoir} document class.
% \end{abstract}
% 
% \section*{User manual}
%
% This document is describing the code implementation only.
% The user documentation can be found in
% \nopagebreak\begin{quote}
% \begin{tabular}{ll}
% \href{http://mirror.ctan.org/macros/latex/contrib/caption/caption.pdf}%
%      {\texttt{caption.pdf}} &amp; The caption package documentation \\
% \end{tabular}
% \end{quote}
%
% \StopEventually{}
% \iffalse
% \clearpage
% \tableofcontents
% \fi
% 
% \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,\@minipagefalse,\@minipagetrue}
% \DoNotIndex{\@namedef,\@nameuse}
% \DoNotIndex{\@onlypreamble,\@parboxrestore,\@plus,\@ptionlist}
% \DoNotIndex{\@removeelement,\@restorepar,\@secondoftwo,\@setminipage,\@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}
% \newcommand*\Note[2][Note]{\par{\small\emph{#1:} #2}\par}
%
% \changes{v1.4a}{2011/10/21}{\cls{memoir} class support added}
% \changes{v2.0}{2020/07/27}{\cls{memoir} class support adapted to \pkg{caption3}~\version{2.0}}
%
% \iffalse
% --------------------------------------------------------------------------- %
% \fi
%
% \clearpage
%
% \iffalse
%&lt;*package&gt;
% \fi
%
% \section{Identification}
%
%    \begin{macrocode}
\NeedsTeXFormat{LaTeX2e}[1994/12/01]
\ProvidesFile{caption-memoir.sto}[2023/09/08 v2.2c Adaption of the caption package to the memoir document class (AR)]
%    \end{macrocode}
%
% \section{Adaptions already included in the caption package}
%
% The following adaptions to the \cls{memoir} document class are already included in the \pkg{caption} package:
% \begin{itemize}
%   \item \cs{@caption} expands \cs{memcaptioninfo}
%   \item \cs{caption@prepareanchor} expands \cs{M@gettitle}
%   \item \cs{caption@refstepcounter} expands \cs{donemaincaptiontrue}
%   \item All sub-caption counters will be reset at |\@mem|\-|reset|\-|sub|\-|counter|,
%         even if they weren't defined by the \cls{memoir} document class itself.
%         As work-around this command will be patched to protect the counters
%         defined by |\Declare|\-|Caption|\-|Sub|\-|Type|.
% \end{itemize}
%
% \section{Single-line-check}
%
% \begin{macro}{\pagenote}
% \changes{v1.4a}{2011/10/21}{Re-definition of \cs{pagenote} added}
%   We re-define \cs{pagenote} here so it won't disturb the single-line-check.
%    \begin{macrocode}
\providecommand*\AtCaptionSingleLineCheck{\g@addto@macro\caption@prepareslc} % for caption v3.5
\AtCaptionSingleLineCheck{%
  \let\pagenote\caption@gobble}
%    \end{macrocode}
% \end{macro}
%
% \section{Label separator}
%
% The `default' caption label separator maps to \cs{@contdelim}.
%    \begin{macrocode}
\DeclareCaptionLabelSeparator{@contdelim}{\@contdelim}
\SetCaptionDefault{labelseparator}{@contdelim}
%    \end{macrocode}
%
% \begin{macro}{\captiondelim}
% \changes{v2.1}{2020/10/10}{Re-definition of \cs{captiondelim} added}
%   We re-define |\caption|\-|delim| so it will set the \pkg{caption3} label separator setting, too.
%    \begin{macrocode}
\let\caption@memoir@delim\captiondelim
\renewcommand\captiondelim{%
  \captionsetup{labelsep=@contdelim}%
  \caption@memoir@delim}
%    \end{macrocode}
% \end{macro}
%
% \changes{v2.0a}{2020/10/10}{Re-definition of label separator `gobble' added}
% If |\fnum@figure| (or |\fnum@table| or\ldots) ends with |\@gobble|, the `:' part of the caption
% label separator will be suppressed when a standard document class (\cls{article}, \cls{report},
% or \cls{book}) will be used, leaving the following space character intact.
% This is different when using the \cls{memoir} document class, in this case the complete
% label separator will be suppressed. For this reason we re-define the pre-defined caption label
% separator `gobble' to emulate this behaviour.
%
%    \begin{macrocode}
\DeclareCaptionLabelSeparator{gobble}{}
%    \end{macrocode}
%
% \section{Fonts}
%
% The `default' caption fonts map to \cs{@contnfont} or \cs{conttfont}.
%    \begin{macrocode}
\DeclareCaptionFont{@contnfont}{\@contnfont}
\SetCaptionDefault{labelfont}{@contnfont}
%    \end{macrocode}
%    \begin{macrocode}
\DeclareCaptionFont{@conttfont}{\@conttfont}
\SetCaptionDefault{textfont}{@conttfont}
%    \end{macrocode}
%
% \begin{macro}{\captionnamefont}
% \changes{v2.1}{2020/10/10}{Re-definition of \cs{captionnamefont} added}
%   We re-define |\caption|\-|delim| so it will set the \pkg{caption3} label separator setting, too.
%    \begin{macrocode}
\let\caption@memoir@namefont\captionnamefont
\renewcommand\captionnamefont{%
  \captionsetup{labelfont=@contnfont}%
  \caption@memoir@namefont}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\captiontitlefont}
% \changes{v2.1}{2020/10/10}{Re-definition of \cs{captiontitlefont} added}
%   We re-define |\caption|\-|delim| so it will set the \pkg{caption3} label separator setting, too.
%    \begin{macrocode}
\let\caption@memoir@titlefont\captiontitlefont
\renewcommand\captiontitlefont{%
  \captionsetup{textfont=@conttfont}%
  \caption@memoir@titlefont}
%    \end{macrocode}
% \end{macro}
%
% \section{Vertical spaces before and after captions}
%
% The \cls{memoir} document classes uses |\above|\-|caption|\-|skip| and |\below|\-|caption|\-|skip|
% different than the standard document classes and the \pkg{caption} package:
% They always typeset |\above|\-|caption|\-|skip| before the caption and
% |\below|\-|caption|\-|skip| after the captions. Both are preset to |0.5\one|\-|line|\-|skip|.
%
% For this reason we have to set the |\below|\-|caption|\-|skip| to |0pt| if the \pkg{caption}
% package is used, so no extra vertical space will be created.
%
%    \begin{macrocode}
\AtCaptionPackage{%
  \setlength\belowcaptionskip{0pt}}
%    \end{macrocode}
%
% Furthermore we adapt the `auto' positioning algorithm to match the one implemented
% in the \cls{memoir} document class.
% (Note: This needs at least \pkg{caption3} \version{2.3}.)
%
%    \begin{macrocode}
\@ifundefined{DeclareCaptionAutoPosition}{}{%
  \DeclareCaptionAutoPosition{%
    \ifvmode
      \ifdim\prevdepth&gt;-99\p@#2\else#1\fi
    \else
      #2%
    \fi}}%
%    \end{macrocode}
%
% \section{Side captions}
%
% \begin{macro}{\endsidecaption}
% \changes{v2.2c}{2023/09/08}{This re-definition added}
% The \env{sidecaption} environment uses |\ref|\-|step|\-|counter| (if \pkg{hyperref} is not loaded)
% or |\H@ref|\-|step|\-|counter| plus |\hyper@make|\-|current| (if \pkg{hyperref} is loaded).
% We need to patch it so |\caption@ref|\-|step|\-|counter| is used instead to get a proper hyperlink reference.
% Since the definition could be overwritten by |memhfixc.sty|, we need to define it using |\At|\-|Begin|\-|Document|.
%    \begin{macrocode}
\AtBeginDocument{\renewcommand*\endsidecaption{%
  \m@mscapend@fbox
  \caption@refstepcounter\@captype
  \m@mscaplabel
  \csname m@mscapcheckside\endcsname %&lt;--- added 2012/08/19
  \begin{lrbox}{\m@mscap@capbox}%
    \begin{minipage}[c]{\sidecapwidth}%
      \sidecapstyle
      \@caption\@captype[\m@mscap@fortoc]{\m@mscap@forcap}
    \end{minipage}%
  \end{lrbox}%
  \m@mscapopboxes}}
%    \end{macrocode}
% \end{macro}
%
% \section{TODO}
%
%    \begin{macrocode}
% TODO: \captionstyle
% TODO: \captionwidth, \changecaptionwidth, \normalcaptionwidth
% TODO: \hangcaption, \indentcaption, \normalcaption
% TODO: \precaption, \postcaption, \midbicaption
% TODO: \captiontitlefinal
% TODO: \contcaption
% TODO: \newfixedcaption, \renewfixedcaption, \providefixedcaption
% 
%    \end{macrocode}
%
% \iffalse
%&lt;/package&gt;
% \fi
%
% \iffalse
% --------------------------------------------------------------------------- %
% \fi
%
% \clearpage
% \Finale
%
\endinput

</pre></body></html>