4

I am preparing a thesis template (for the blog here http://tex.blogoverflow.com/) and I use a KOMA class together with the float package. I get the nasty warning which is already described and solved in here:

KOMA warning about ToC (\float@addtolists detected!)

I use the float package because of the [H] placement option (place the floating object right 'Here' and nowhere else).

Is there a way to achieve this without the float package? Maybe with the KOMA class?

7
  • 4
    You could just place your figure in the text without the figure environment; if you want to add the caption use the \captionof command provided by the package caption (also by capt-of).
    – Pier Paolo
    Jan 2, 2015 at 13:27
  • Thanks for the comment. I still want to use the standard syntax. A template should use the "best practice". Jan 2, 2015 at 13:29
  • 2
    I don't think it is considered "best practice" to place a nonfloating float, as this kind of contradicts its meaning. Pier Paolos comment is "best practice" here, as far as I would say. I may very well be wrong, though.
    – John
    Jan 2, 2015 at 13:33
  • 1
    I see what you mean. Let's not argue about that. I just wanted to see if there is another placement option. At my university the professors don't like when the pictures etc appear before they are mentioned in the text. And in my experience it is a common request from other LaTeX users. But please - no fight about that here. Jan 2, 2015 at 13:46
  • @ManuelKuehner Why not use the scrhack package? I think it's from the author of the KOMA classes. I'm unfortunately not aware of a pure KOMA class solution.
    – John
    Jan 2, 2015 at 13:56

1 Answer 1

4

You can use one of the commands \captionof, \captionaboveof or \captionbelowof defined by the KOMA-Script class:

\documentclass{scrartcl}
\usepackage{mwe}
\begin{document}
\section{Examples}
\blindtext
\begin{center}
  \begin{minipage}{\linewidth}
    \centering
    \captionaboveof{table}{First Table}
    \fbox{Table}
  \end{minipage}
\end{center}
\blindtext
\begin{center}
  \begin{minipage}{\linewidth}
    \centering
    \includegraphics[width=.5\linewidth]{example-image}
    \captionof{figure}{First Image}
  \end{minipage}
\end{center}
\blindtext
\listoffigures
\listoftables
\end{document}

enter image description here

\captionaboveof formats the caption as a heading. So the caption is not too close to the table below. There is also an option that could be used if all table captions are headings: captions=tableheading. Then a caption defined by \captionof{table}{...} is also set with the correct space to the table below.

3
  • Thanks! Do they still appear in the list of figures and so on? Jan 2, 2015 at 14:02
  • Yes they still appear there.
    – esdd
    Jan 2, 2015 at 14:04
  • So far so good. How do you fix the \ref{} link to navigate to the top of the figure, instead of jumping to the caption?
    – gilu
    Aug 27, 2020 at 9:01

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.