3

I need to put a figure inside a minipage, like so:

\documentclass{memoir}

\begin{document}
\begin{minipage}{10cm}
  \begin{figure}
    blabla
    \caption{test}
  \end{figure}
\end{minipage}
\end{document}

However, LaTeX doesn't like that since it is no longer in outer par mode, so it crashes and burns. I then tried the solution provided here, but that doesn't work either since the float package doesn't play nicely with memoir.

Is there a way of working around this?

3
  • Reversing the order of minipage and figure is not a good option? Aug 30, 2013 at 15:25
  • why do you think you want to put a figure in the minipage? Either use minipage (you can use caption from capt-of package) or use figure, you can not use both. Aug 30, 2013 at 15:26
  • Related: How to use figure inside a minipage?
    – user11232
    Aug 30, 2013 at 22:54

1 Answer 1

8

You cannot place a floating environment inside a minipage; if you want to place a caption for your image inside a minipage, you can use memoir's \newfixedcaption command which provides captions outside floating environments:

\documentclass{memoir}
\newfixedcaption{\figcaption}{figure}

\begin{document}

\noindent\begin{minipage}{10cm}
\centering
 A
\figcaption{test}
\end{minipage}

\end{document}

Another option would be to use \captionof from the capt-of package:

\documentclass{memoir}
\usepackage{capt-of}

\begin{document}

\noindent\begin{minipage}{10cm}
\centering
 A
\captionof{figure}{test}
\end{minipage}

\end{document}

The caption package also provides the \captionof functionality, but it might interfer with the way memoir handles its captions, so I opted for capt-of.

3
  • memoir also have stationary captions, but it is not enabled by default, see \newfixedcaption in the memoir manual
    – daleif
    Aug 30, 2013 at 15:33
  • @daleif I thought I had seen this, but couldn't remember the name. I'll add this to my answer. Thanks! Aug 30, 2013 at 15:35
  • I had to look it up ...
    – daleif
    Aug 30, 2013 at 15:44

You must log in to answer this question.

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