In a mathematical text I use theorem environments, for example I have defined example. In some of these environments I‘d like to inlcude a graphic:

  A nice example for this foo is the following:


  As you can see: \dots

Unfortunately that does not work very well. At first I am unable to add a caption, but that is not the main problem. The main problem is that the graphic‘s bottom and the text of my environment (“Example x.y”) are aligend at their bottom, ie. parts of the grapic are above the environment.

I tried some googling, ie. used the placeins package and \FloatBarrier (and put the \includegraphics in a figure) but without any good result.

How to include such a graphic in a not ugly way?

  • Could you show a screen shot of what you mean? This could be an issue with the image bounding box.
    – Werner
    Apr 13, 2014 at 13:34
  • Please, make a minimal working example (MWE) to clarify the question. If the contents of environment example is set in vertical mode, then the image is in the middle. If it is set in horizontal mode, then the image can be moved via \raisebox, but a caption does not make any sense to me. Apr 13, 2014 at 13:48
  • @HeikoOberdiek: I understand the idea of a MWE, but since this question is answered, I do not see a reson to improve the question anymore.
    – Keba
    Apr 13, 2014 at 15:06

1 Answer 1


It is enough to write something before \includegraphics, e.g. mbox{}. \FloatBarriercould do nothing since you do not have a float — which would make no sense in a theorem environment. I suggest you centre your image and use the \captionof command from the caption package. Here is a code with a figure inclusion that can be referenced:




  \captionof{figure}{The example figure}\label{exfig1}
As can be seen in \cref{exfig1}, …


enter image description here


You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .