summaryrefslogtreecommitdiff
path: root/macros/latex/contrib/caption/caption2.dtx
diff options
context:
space:
mode:
authorNorbert Preining <norbert@preining.info>2020-10-27 03:02:53 +0000
committerNorbert Preining <norbert@preining.info>2020-10-27 03:02:53 +0000
commit83aaf60600dc0b191bacbaacc786dbda33d7190a (patch)
tree57482692c8aaf7f19c79919b74e821dbeea5652e /macros/latex/contrib/caption/caption2.dtx
parent0ceea51e3c4c2d7364ffacd728497a66f16aa2ed (diff)
CTAN sync 202010270302
Diffstat (limited to 'macros/latex/contrib/caption/caption2.dtx')
-rw-r--r--macros/latex/contrib/caption/caption2.dtx61
1 files changed, 38 insertions, 23 deletions
diff --git a/macros/latex/contrib/caption/caption2.dtx b/macros/latex/contrib/caption/caption2.dtx
index 074dd7c630..9e6850dfe6 100644
--- a/macros/latex/contrib/caption/caption2.dtx
+++ b/macros/latex/contrib/caption/caption2.dtx
@@ -32,7 +32,7 @@
% caption-deu.tex, caption-eng.tex, caption-rus.tex.
%
% \fi
-% \CheckSum{868}
+% \CheckSum{864}
%
% \iffalse
%<*driver>
@@ -211,7 +211,7 @@
%
% \begin{macrocode}
\NeedsTeXFormat{LaTeX2e}[1994/12/01]
-\ProvidesPackage{caption2}[2020/01/02 v2.2e Customising captions (AR)]
+\ProvidesPackage{caption2}[2020/09/28 v2.2f Customising captions (AR)]
% \end{macrocode}
%
% \changes{v2.2b}{2007/06/15}{Made obsolete warning even more annoying}
@@ -230,7 +230,7 @@
% \subsection{Loading the caption3 kernel}
%
% \begin{macrocode}
-\RequirePackage{caption3}[2019/12/31] % should be used with v1.8f or newer
+\RequirePackage{caption3}[2020/09/28] % needs v2.2a or newer
% \end{macrocode}
% We undefine user commands offered by \package{caption} but not by \package{caption2}
% since they should not be used together with \package{caption2}.
@@ -242,15 +242,25 @@
\let\DeclareCaptionSubType\@undefined
% \end{macrocode}
%
+% \begin{macro}{\captiontwo@Error}
+% \changes{v2.2f}{2020/09/28}{This macro added}
+% |\captiontwo@Error|\marg{message}\\
+% issues an error message (with code line indication).
+% \begin{macrocode}
+\newcommand*\captiontwo@Error[2][]{%
+ \PackageError{caption2}{#2}{#1\caption@@eh{caption2}}}
+% \end{macrocode}
+% \end{macro}
+%
% \subsection{Check against the regular caption package}
% \changes{v2.2}{2007/04/06}{Check against regular \package{caption} package added}
% \changes{v2.2a}{2007/04/11}{Bugfix: Usage of \cs{caption@error} replaced by \cs{PackageError}}
%
% \begin{macrocode}
\@ifpackageloaded{caption}{%
- \PackageError{caption2}{%
+ \captiontwo@Error{%
You can't use both, the (current) caption *and*\MessageBreak
- the (obsolete) caption2 package}\caption@eh
+ the (obsolete) caption2 package}%
\endinput
}{}
% \end{macrocode}
@@ -347,7 +357,9 @@
%
% \begin{macro}{\defcaptionstyle}
% \begin{macro}{\newcaptionstyle}
+% \changes{v2.2f}{2020/09/28}{Uses \cs{captiontwo@Error} instead of \cs{PackageError} now}
% \begin{macro}{\renewcaptionstyle}
+% \changes{v2.2f}{2020/09/28}{Uses \cs{captiontwo@Error} instead of \cs{PackageError} now}
% These macros will define a new caption style. \cs{newcaptionstyle} and \cs{renewcaptionstyle}
% will additionally check if the caption style already exists or not.
% \begin{macrocode}
@@ -359,7 +371,7 @@
\expandafter\ifx\csname caption@@#1\endcsname\relax
\expandafter\defcaptionstyle
\else
- \PackageError{caption2}{Caption style `#1' already defined}{\caption@eh}%
+ \captiontwo@Error{Caption style `#1' already defined}%
\expandafter\@gobbletwo
\fi
{#1}}
@@ -367,7 +379,7 @@
% \begin{macrocode}
\newcommand*\renewcaptionstyle[1]{%
\expandafter\ifx\csname caption@@#1\endcsname\relax
- \PackageError{caption2}{Caption style `#1' undefined}{\caption@eh}%
+ \captiontwo@Error{Caption style `#1' undefined}%
\expandafter\@gobbletwo
\else
\expandafter\defcaptionstyle
@@ -379,6 +391,7 @@
% \end{macro}
%
% \begin{macro}{\dummycaptionstyle}
+% \changes{v2.2f}{2020/09/28}{Uses \cs{captiontwo@Error} instead of \cs{PackageError} now}
% This macro will also define a new caption style, but a one which is based on the
% actual set caption style. Therefore you can't set a caption style made with this
% command with \cs{captionstyle} -- we check this to avoid an endless recursion.
@@ -387,11 +400,11 @@
\defcaptionstyle{#1}{%
\expandafter\ifx\csname caption@@\caption@style\expandafter\endcsname%
\csname caption@@#1\endcsname
- \PackageError{caption2}{You can't use the caption style `#1' directy}{%
- The caption style `#1' is only a dummy and does not really exists.%
- \MessageBreak You have to redefine it (with \protect\renewcaptionstyle)
- before you can select\MessageBreak it with \protect\captionstyle.
- \space\caption@eh}%
+ \captiontwo@Error
+ [The caption style `#1' is only a dummy and does not really exists.%
+ \MessageBreak You have to redefine it (with \protect\renewcaptionstyle)
+ before you can select\MessageBreak it with \protect\captionstyle.\space]%
+ {You can't use the caption style `#1' directy}%
\else
#2\usecaptionstyle\caption@style
\fi}}
@@ -399,12 +412,13 @@
% \end{macro}
%
% \begin{macro}{\captionstyle}
+% \changes{v2.2f}{2020/09/28}{Uses \cs{captiontwo@Error} instead of \cs{PackageError} now}
% \cs{captionstyle} sets the actual caption style. It includes a check if the given caption
% style is defined or not.
% \begin{macrocode}
\newcommand*\captionstyle[1]{%
\expandafter\ifx\csname caption@@#1\endcsname\relax
- \PackageError{caption2}{Undefined caption style `#1'}{\caption@eh}%
+ \captiontwo@Error{Undefined caption style `#1'}%
\else
\def\caption@style{#1}%
\fi}
@@ -824,22 +838,22 @@
% \end{macro}
%
% \begin{macro}{\usecaptionstyle}
-% First we check if we are inside a caption -- if \cs{captiontext} is undefined we are not.
-% If we are we call the appropriate caption definition.
-%
% \changes{v2.1b}{2004/04/16}{Missing percent added (and extra space removed)}
% \changes{v2.2}{2007/04/06}{\cs{let}\cs{caption@make}\cs{caption@makecaption} added}
+% \changes{v2.2f}{2020/09/28}{Uses \cs{captiontwo@Error} instead of \cs{PackageError} now}
+% First we check if we are inside a caption -- if \cs{captiontext} is undefined we are not.
+% If we are we call the appropriate caption definition.
% \begin{macrocode}
\newcommand*\usecaptionstyle[1]{%
\caption@ifundefined\captiontext{%
- \PackageError{caption2}{You can't use \protect#1
- in normal text}{The usage of \protect#1 is only
- allowed inside code declared with\MessageBreak \protect\defcaptionstyle,
- \protect\newcaptionstyle \space or \protect\renewcaptionstyle.
- \space\caption@eh}
+ \captiontwo@Error
+ [The usage of \protect#1 is only
+ allowed inside code declared with\MessageBreak \protect\defcaptionstyle,
+ \protect\newcaptionstyle \space or \protect\renewcaptionstyle.\space]%
+ {You can't use \protect#1 in normal text}%
}{%
\@ifundefined{caption@@#1}%
- {\PackageError{caption2}{Caption style `#1' undefined}{\caption@eh}}%
+ {\captiontwo@Error{Caption style `#1' undefined}}%
{\let\caption@make\caption@makecaption
\@nameuse{caption@@#1}}%
}}
@@ -1301,12 +1315,13 @@
% \end{macro}
%
% \begin{macro}{\subcapstyle}
+% \changes{v2.2f}{2020/09/28}{Uses \cs{captiontwo@Error} instead of \cs{PackageError} now}
% Analogous to \cs{captionstyle} we define \cs{subcapstyle}
% and set it (via \cs{setsubcapstyle}) to a appropriate value.
% \begin{macrocode}
\newcommand*\subcapstyle[1]{%
\expandafter\ifx\csname caption@@#1\endcsname\relax
- \PackageError{caption2}{Undefined caption style `#1'}{\caption@eh}%
+ \captiontwo@Error{Undefined caption style `#1'}%
\else
\def\caption@substyle{#1}%
\fi}