5

I used mdframed but I am unable to reproduce the example environment (?) from this primer. The main problem is with figures (graphics, plots), of course. Any help?

enter image description here

1 Answers1

1

mdframed does not allow floats within the mdframed environment*. The reason for this is obvious, since the float should be allowed to move around in the document, and fixing it within a block-like environment prohibits this movement. In fact, LaTeX will complain with an error

! LaTeX Error: Float(s) lost.

Instead, create a "fake" float by using (say) the center environment with a caption created by \captionof{<fenv>}[<ToC entry>]{<caption>} (provided by the capt-of and caption packages). As an extra step to group the image and its caption, perhaps wrap them inside a minipage.

* This might change in the future, based on Marco's comment.

David Carlisle
  • 757,742
Werner
  • 603,163