TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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?

share|improve this question
Could you show a screen shot of what you mean? This could be an issue with the image bounding box. – Werner Apr 13 '14 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. – Heiko Oberdiek Apr 13 '14 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 '14 at 15:06
up vote 4 down vote accepted

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

share|improve this answer
Works fine, thanks :) – Keba Apr 13 '14 at 13:47

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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