summaryrefslogtreecommitdiff
path: root/macros/latex/contrib/caption/caption-koma.dtx
diff options
context:
space:
mode:
Diffstat (limited to 'macros/latex/contrib/caption/caption-koma.dtx')
-rw-r--r--macros/latex/contrib/caption/caption-koma.dtx51
1 files changed, 34 insertions, 17 deletions
diff --git a/macros/latex/contrib/caption/caption-koma.dtx b/macros/latex/contrib/caption/caption-koma.dtx
index 040692b453..87f15145c2 100644
--- a/macros/latex/contrib/caption/caption-koma.dtx
+++ b/macros/latex/contrib/caption/caption-koma.dtx
@@ -31,7 +31,7 @@
%
% \fi
%
-% \CheckSum{255}
+% \CheckSum{262}
%
% \iffalse
%<*driver>
@@ -169,7 +169,7 @@
%
% \begin{macrocode}
\NeedsTeXFormat{LaTeX2e}[1994/12/01]
-\ProvidesFile{caption-koma.sto}[2022/12/27 v2.0c Adaption of the caption package to the KOMA-Script document classes (AR)]
+\ProvidesFile{caption-koma.sto}[2023/09/08 v2.0e Adaption of the caption package to the KOMA-Script document classes (AR)]
% \end{macrocode}
%
% \section{Margin or width}
@@ -284,25 +284,32 @@
%
% \begin{macro}{\ifonelinecaptions}
% \changes{v1.1g}{2008/03/01}{\cs{def} changed to \cs{g@addto@macro}}
-% Patch |\onelinecaptionstrue| and |onelinecaptionsfalse| so they will set the corresponding \pkg{caption3} setting, too.
+% \changes{v2.0d}{2023/09/08}{Re-written using \cs{DeclareCaptionSinglelinecheck} and \cs{SetCaptionDefault}}
+% Define an own single-line-check which depends on |\ifonelinecaptions| offered by \KOMAScript.
% \begin{macrocode}
-\g@addto@macro\onelinecaptionstrue{\caption@setsinglelinecheck{true}}%
-\g@addto@macro\onelinecaptionsfalse{\caption@setsinglelinecheck{false}}%
+\DeclareCaptionSinglelinecheck{koma}{%
+ \ifonelinecaptions
+ \expandafter\@firstoftwo
+ \else
+ \expandafter\@secondoftwo
+ \fi}
% \end{macrocode}
+% Make this new single-line-check the default one.
% \begin{macrocode}
-\ifonelinecaptions
- \onelinecaptionstrue
-\else
- \onelinecaptionsfalse
-\fi
+\SetCaptionDefault{singlelinecheck}{koma}
+% \end{macrocode}
+% Patch |\onelinecaptionstrue| and |onelinecaptionsfalse| so they will set the corresponding \pkg{caption3} setting, too.
+% \begin{macrocode}
+\g@addto@macro\onelinecaptionstrue{\caption@setsinglelinecheck{koma}}
+\g@addto@macro\onelinecaptionsfalse{\caption@setsinglelinecheck{koma}}
% \end{macrocode}
% \end{macro}
%
% \section{Format}
%
-% The `default' caption format was taken from \KOMAScript\ \cs{@makecaption} and adapted.
+% The `koma' caption format was taken from \KOMAScript\ \cs{@makecaption} and adapted.
% \begin{macrocode}
-\DeclareCaptionFormat{default}[#1#2#3\par]{%
+\DeclareCaptionFormat{koma}[#1#2#3\par]{%
\ifdofullc@p
\caption@useformat{hang}{#1}{#2}{#3}%
\else
@@ -315,19 +322,29 @@
\fi\fi
#3\par
\fi}
+% \end{macrocode}
+% \begin{macrocode}
+\SetCaptionDefault{format}{koma}
+% \end{macrocode}
%
% \section{Label format}
%
-% The `fallback' caption label format maps to `autodot'.
% \begin{macrocode}
-\SetCaptionFallback{labelformat}{autodot}
+\DeclareCaptionLabelFormat{koma}{\bothIfFirst{#1}{\nobreakspace}#2\autodot}
+% \end{macrocode}
+% The `fallback' caption label format maps to `koma'.
+% \begin{macrocode}
+\SetCaptionFallback{labelformat}{koma}
% \end{macrocode}
%
% \section{Label separator}
%
% The `default' caption label separator maps to \cs{captionformat}.
% \begin{macrocode}
-\DeclareCaptionLabelSeparator{default}{\captionformat}
+\DeclareCaptionLabelSeparator{koma}{\captionformat}
+% \end{macrocode}
+% \begin{macrocode}
+\SetCaptionDefault{labelseparator}{koma}
% \end{macrocode}
%
% \section{Fonts}
@@ -396,7 +413,7 @@
% \changes{v1.5}{2013/02/15}{Support of \cs{if@figurecaptionabove} added}
% Patch |\@figurecaptionabovetrue| and |\@figurecaptionabovefalse| so they will set the \pkg{caption3} position setting, too.
% \begin{macrocode}
-\caption@ifdefined\@figurecaptionabovetrue{%
+\@ifundefined{@figurecaptionabovetrue}{}{%
\g@addto@macro\@figurecaptionabovetrue{\captionsetup*[figure]{position=t}}%
\g@addto@macro\@figurecaptionabovefalse{\captionsetup*[figure]{position=b}}%
% \end{macrocode}
@@ -405,7 +422,7 @@
\@figurecaptionabovetrue
\else
\@figurecaptionabovefalse
- \fi}{}
+ \fi}
% \end{macrocode}
% \end{macro}
%