3

I would like to have figure captions appear above the figures themselves. The KOMA-Script documentation seems to suggest this can be achieved by setting the captions=heading option. But in the MWE below, the first caption always appears below, and the second above the image.

MWE:

\documentclass[captions=heading]{scrartcl}
\usepackage[demo]{graphicx}
\begin{document}

\begin{figure}
  \includegraphics[width=0.7\linewidth]{image}
  \caption{First caption (caption command below the figure)}
\end{figure}

\begin{figure}
  \caption{Second caption (caption command above the figure)}
  \includegraphics[width=0.7\linewidth]{image}
\end{figure}

\end{document}

Output:

output

2
  • Just move the caption above the \includegraphics-command – Sveinung Aug 20 '19 at 16:07
  • I should have added that this is not possible, since the latex source is generated automatically. – cfhooper Aug 20 '19 at 16:16
2

If you read the KOMA-script manual page 128, this behaviour is documented:

Note that these options change only the formatting, not the actual position of the caption. Whether the caption is placed above or below a float depends solely upon where you use the \caption command inside float environment. However, this can change when using the float package with the \restylefloats command (see [Lin01]).

To have a float (as you have) be typeset with the caption above the figure, you need to place the caption inside the float, but above the line that inputs the figure. caption=heading provides the formatting, i.e. that you have sufficient space below the caption.

When this is not possible, you may try not to use floats, and use

\captionaboveof{float type}[entry]{title}

See the KOMA-manual page 132, or you can try the float-package and its \restylefloat command.

\floatstyle{plaintop}
\restylefloat{figure}

If you prefer KOMA-features (and you probably are), use

\floatstyle{komaabove}
\restylefloat{figure}

When using this commands (and scrhack) the usual KOMA-script commands for font attributes, spacing etc. works, and all the figures end up in list of figure, if you have such listing in your document. Complete MWE (loads scrhack as recommended in the manual:

enter image description here

\documentclass[captions=heading]{scrartcl}
\usepackage[demo]{graphicx}
\usepackage{float, scrhack}  : KOMA-manual page 128 

\floatstyle{komaabove}
\restylefloat{figure}

\begin{document}

\begin{figure}
  \centering
  \includegraphics[width=0.7\linewidth]{image}
  \caption{First caption (caption command below the figure)}
\end{figure}

\begin{figure}
  \centering
  \caption{Second caption (caption command above the figure)}
  \includegraphics[width=0.7\linewidth]{image}
\end{figure}

\end{document}

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.