# I get an error when using subfigure with memoir

I made an article and insert several subfigures in that as follows:

\begin{figure}
\centering
\begin{subfigure}[b]{0.3\textwidth}
\includegraphics[width=\textwidth]{fig6_1}
\caption{Increase}
\end{subfigure}%
\begin{subfigure}[b]{0.3\textwidth}
\includegraphics[width=\textwidth]{fig6_2}
\caption{Increase}
\end{subfigure}
\begin{subfigure}[b]{0.3\textwidth}
\includegraphics[width=\textwidth]{fig6_3}
\caption{Increase}
\end{subfigure}
\caption{Round}
\end{figure}


But, when I copy the same code to my thesis file, it turns out errors

I compile my file with xelatex in command prompt, it gives a warning error that

Class memoir Warning: You are using caption package with the memoir class. This may cause unexpected or inconsistent results if you use any of the memoir's captioning facilities.

While compiling, it stops with error

! LaTeX Error: Command \subcaption already defined. Or name \end... illegal, see P.192 of the manual.

But, there is no page 192 in the caption guide on CTAN. I checked the thesis class file and observed use the of memoir. What change should I have in my code or class file code to make it functional?

• "p. 192 of the manual" refers to the original "LaTeX - A Document Preparation System" document, written by Leslie Lamport. – Werner May 30 '13 at 6:25

As a document class, memoir provides sub-float support out of the box. As such, it may have some compatibility problems with packages (extensions) provided by packages like subcaption or caption. Hence, the errors/warnings being displayed during compilation.

Given your code snippet, here's what a comparable version would look like in memoir:

\documentclass{memoir}% http://ctan.org/pkg/memoir
\usepackage{graphicx}% http://ctan.org/pkg/graphicx
\newsubfloat{figure}% Allow subfloats in figure environment
\begin{document}

\begin{figure}
\centering
\subbottom[Increase]{%
\includegraphics[width=0.3\linewidth]{example-image-a}}
\subbottom[Increase]{%
\includegraphics[width=0.3\linewidth]{example-image-b}}
\subbottom[Increase]{%
\includegraphics[width=0.3\linewidth]{example-image-c}}
\caption{Round}
\end{figure}

\end{document}


\newsubfloat creates the appropriate interface and output-generating structure for a sub-float environment. \subbottom[<ToC>][<caption>]{<stuff>} sets a sub-float with a caption at the bottom (a counterpart to \subtop).

• How can one move the position of the label? In many books, theses and publications each subfigure has a label in the top left corner, not centered below. – The V Mar 31 '14 at 9:36

You can put the sub-caption above the float by using \subtop[<sub-caption>]{<content of sub-float>}. If you give it empty options [], it will just give you the numbering/lettering.