\captionbelowof not working
KOMA-Script is a bundle of versatile LaTeX classes and packages
Brought to you by:
kohm
With captions=figureheading
, the command \captionbelowof
doesn't set the correct space for a below caption, as expected.
Example:
\documentclass{scrartcl}
\begin{document}
\KOMAoptions{captions=figureheading}
\noindent \dotfill BEFORE \dotfill
\captionbelowof{figure}{Caption below}
\noindent \dotfill AFTER \dotfill
\end{document}
This can be fixed with
\renewcommand*{\captionaboveof}[1]{\def\@captype{#1}%
\@captionabovetrue%
\scr@caption}
\renewcommand*{\captionbelowof}[1]{\def\@captype{#1}%
\@captionabovefalse%
\scr@caption}
In attachment, a more detailed test.
Sorry, but it is even more generally wrong, because a previous
\captionaboveof
or\captionbelowof
can influence a following\captionof
. This either has to be documented or (and this would IMHO be better) should be changed.And I should also check
\caption
,\captionabove
and\captionbelow
for similar issues.So I need some more time to change it.
BTW: Your attachment is extremely helpful as a basis for intensive testing not only of the current mistake, but also of possible solutions. I just have to extend it with the mentioned cases with
\captionof
to\caption(below|above)of
and the same withoutof
. Many thanks for that!Last edit: Markus Kohm 2025-06-05
I think, the correct fix of
\captionof
,\captionaboveof
,\captionbelowof
would be:And I should also implement options
captions=figuredefault
andcaptions=tabledefault
, which would set\if@figurecaptionabove
resp.\if@tablecaptionabove
to\relax
and therefore use the setting ofcaptions=above
resp.captions=below
. But I still need to test, what happens when using packagecaption
with the change. And I need to inspect\caption
,\captionabove
and\captionbelow
.Unfortunately, compatibility with package
caption
is indeed a problem. For example, the package relies on the fact that if\@figurecaptionabovetrue
exists,\if@figurecaptionabovetrue
is either\iftrue
or\iffalse
. It also changes\@figurecaptionabovetrue
,\@figurecaptionabovefalse
,\@captionabovetrue
and\@captionabovefalse
in a way that makes it difficult for me to implement the desired changes. I will therefore probably undo the changes I have just spent hours implementing and start all over again next week. A few things incaption
are also still unclear to me, for example whether both a\captionsetup*[figure]{position=t}
(via\@figurecaptionabovetrue
) and a\caption@setposition{t}
(via\@captionabovetrue
) are really needed. The latter may be sufficient. The package really intervenes very deeply and in detail in internal functions of KOMA-Script.You could maybe set the flags locally (inside groups)
In attachment the test file, rewritten and simplified.
The new code of [r4174], [r4175], [r4176] should not only fix this issue. It is also intended to improve compatibility of KOMA-Script and package
caption
and makes\captionabove
,\captionbelow
,\captionof
,\captionaboveof
,\captionbelowof
available with the standard classes + packagetocbasic
. The position formatting of\caption
and\captionof
can be setup usingtocbasic
(preamble) optionenablepatch=caption
together withtocbasic
(general) options:captionabove
,captionbelow
,captionposition=top
,captionposition=bottom
(the default),figurecaptionabove
,figurecaptionbelow
,figurecaptionposition=bottom
,figurecaptionposition=top
,figurecaptionposition=default
(the default),tablecaptionabove
,tablecaptionbelow
,tablecaptionposition=top
,tablecaptionposition=bottom
,tablecaptionposition=default
(the default). Additional options for environments defined using\DeclareNewTOC
are automatically added and can be used after the declaration of the environments using\SetKeys[tocbasic}{…}
.Note: There is still one issue in cooperation with package
caption
. But this is should be solved incaption
→ caption-koma.sto should be updated for KOMA-Script v3.46 and later.Related
Commit: [r4174]
Commit: [r4175]
Commit: [r4176]
Last edit: Markus Kohm 2025-06-20
Unfortunately Axel has announced that he will discontinue support for the
caption
package and all his packages from the related collection. The collection will thus go into “unmaintained” status. Sincecaption
is IMHO an important package, this means additional work for me, because I now have to make sure thatcaption3
no longer loadscaption-koma.sto
and instead relevant parts of it go directly into KOMA-Script or are rebuilt. This sets the next release back even further and sets me back quite a bit in my overall plans.I now have two open, very urgent tasks that I am working on simultaneously, in addition to the ongoing task of maintaining and improving compatibility with new LaTeX releases (including the creation of tagging support).
From [r4186] everything should work with and without using
caption
2023-09-08.See also [wiki-en:Release 3.46] or [wiki-de:Release 3.46].
Related
Commit: [r4186]
Wiki (Deutsch): Release 3.46
Wiki (English): Release 3.46