# KOMA and float package - alternative to float [H] placement

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?

• 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 '15 at 13:27
• Thanks for the comment. I still want to use the standard syntax. A template should use the "best practice". – Dr. Manuel Kuehner Jan 2 '15 at 13:29
• 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 '15 at 13:33
• 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. – Dr. Manuel Kuehner Jan 2 '15 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 '15 at 13:56

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}


\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.

• Thanks! Do they still appear in the list of figures and so on? – Dr. Manuel Kuehner Jan 2 '15 at 14:02
• Yes they still appear there. – esdd Jan 2 '15 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 '20 at 9:01