# mdframed: unable to reproduce the example environment with figures [duplicate]

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?

• Can you show an attempt? – egreg Jul 10 '13 at 23:18
• @Papiro don't use floats; use `center` or a `minipage` and `\captionof` from the `capt-of` package if your plots/images/tables require captions. – Gonzalo Medina Jul 10 '13 at 23:23

`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`.