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?

gablin
  • 17,006

1 Answers1

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.

Gonzalo Medina
  • 505,128