Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

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.

share|improve this question
    
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
add comment

1 Answer 1

up vote 4 down vote accepted

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}
share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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