1

Currently I'm struggling with a weird problem. I use the chemmacros package to provide the \scheme float enviroment for my chemical schemes. Then I use \FloatBarrier to prevent them from floating away too far. Now there should be a specific layout where I have my sectionheading then the picture and then the text. So my code looks like this:

\documentclass[a4, english]{scrreprt}
\begin{document}
\section{Synthesis A}
\FloatBarrier
\begin{scheme}[h]
\includegraphics
\end{scheme}

Here some text

\end{document}

For some reason I have cases, where it works out totally fine, in other samples, the warning "h specified to ht" comes up and I have the scheme on the page, then the heading of the section or subsection then the text.

I know that Float enviroments are there to float not to be restricted but this drives me mad. So I'm looking for a workaround. Can I place a picture just by \includegraphics{} and then still add a label and a caption to it leaving out the float environment?

I heard of the package captionof which might provide some help?

1

The solution is quite easy, actually, and you're on the right track: don't use the floating environment. I'd probably use center instead.

You can still caption the image with \captionof which is available in each KOMA-Script class like scrreprt that you're already using*:

\documentclass{scrreprt}
\usepackage{chemmacros}
\usechemmodule{scheme}

\usepackage{lipsum}

\begin{document}

\section{Synthesis A}

\begin{center}
  \includegraphics{example-image-a}
  \captionof{scheme}{Some caption}
\end{center}

\lipsum

\end{document}

enter image description here


* users of other classes can use the caption package which also provides \captionof.

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.