I would like a figure (including a Tikz picture) to appear inside a theorem-like environment (the point is that I need a caption for the figure).

Even using the option [H] with the float package the figure does not behave so.

Is there an easy way of accomplishing this?


marked as duplicate by David Carlisle floats Sep 21 '16 at 11:05

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

  • The packages caption and capt-of offer the facilities to have captions outside of floats. – gernot Sep 21 '16 at 10:42
  • with H the figure will stay where you place it, but the only reason to use figure is to allow latex to move it so just using tikzpicture (or \includegraphics) directly without a figure environment is often clearer – David Carlisle Sep 21 '16 at 10:44
  • @David Indeed, the figure does not appear where I placed it (inside the environment, i.e. just below the environment heading). On the other hand, I used figure to allow a caption; is it not a valid reason for using it? – suitangi Sep 21 '16 at 10:52
  • 1
    as the first comment says you can add a caption anywhere if you use the capt-of package (which is just one line of code:-) – David Carlisle Sep 21 '16 at 10:53
  • I see, if any of you wants to write this as an answer I will accept it. Thanks! – suitangi Sep 21 '16 at 10:58

Browse other questions tagged or ask your own question.