3

I have the following figure, where I can't seem to get the numbering right. The numbers next to the captions comes out as Figure 1, Figure 2, and Figure 3, but I want them to be (a), (b), and Figure 1

\begin{figure}[!h]
\centering
\begin{minipage}{0.45\linewidth}

\begin{python}
  for i in [1,2,3,4]:
    print i
\end{python}
\caption{Implementation in Python}

\end{minipage}
\qquad
\begin{minipage}{0.45\linewidth}

\begin{python}
  1
  2
  3
  4 
\end{python}
\caption{Output}

\end{minipage}

\caption{Python code}
\label{lst:python_code}
\end{figure}

I am using the memoir class. Including the minipages in subfigures yields an error from pygmentize.

  • have you looked at the subcaption package? if you load it, you can change all of your minipage to subfigure... – cmhughes May 2 '12 at 17:23
  • The subcaption is not (yet) compatible to the memoir document class. – Axel Sommerfeldt May 2 '12 at 17:48
  • @AxelSommerfeldt ah, thanks for the info. Thanks also for your wonderful packages :) – cmhughes May 2 '12 at 19:08
4

Use \newsubfloat{figure} and then \subcaption

\documentclass{memoir}
\newsubfloat{figure}

\begin{document}

\begin{figure}
\centering
\begin{minipage}{0.45\linewidth}
contents...
\subcaption{Implementation in Python}
\end{minipage}\hfill
\begin{minipage}{0.45\linewidth}
contents...
\subcaption{Output}
\end{minipage}
\caption{Python code}
\label{lst:python_code}
\end{figure}

\end{document}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.