\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
\captionaboveofor\captionbelowofcan 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,\captionaboveand\captionbelowfor 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
\captionofto\caption(below|above)ofand the same withoutof. Many thanks for that!Last edit: Markus Kohm 2025-06-05
I think, the correct fix of
\captionof,\captionaboveof,\captionbelowofwould be:And I should also implement options
captions=figuredefaultandcaptions=tabledefault, which would set\if@figurecaptionaboveresp.\if@tablecaptionaboveto\relaxand therefore use the setting ofcaptions=aboveresp.captions=below. But I still need to test, what happens when using packagecaptionwith the change. And I need to inspect\caption,\captionaboveand\captionbelow.Unfortunately, compatibility with package
captionis indeed a problem. For example, the package relies on the fact that if\@figurecaptionabovetrueexists,\if@figurecaptionabovetrueis either\iftrueor\iffalse. It also changes\@figurecaptionabovetrue,\@figurecaptionabovefalse,\@captionabovetrueand\@captionabovefalsein 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 incaptionare 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
captionand makes\captionabove,\captionbelow,\captionof,\captionaboveof,\captionbelowofavailable with the standard classes + packagetocbasic. The position formatting of\captionand\captionofcan be setup usingtocbasic(preamble) optionenablepatch=captiontogether 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\DeclareNewTOCare 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
captionpackage and all his packages from the related collection. The collection will thus go into “unmaintained” status. Sincecaptionis IMHO an important package, this means additional work for me, because I now have to make sure thatcaption3no longer loadscaption-koma.stoand 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
caption2023-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