[Tex/LaTex] I get an error when using subfigure with memoir

captionsfloatsmemoirsubcaption

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

Command \subcaption already defined. …ubcaption{\captionsetup{subtype*}\caption}

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?

Best Answer

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:

enter image description here

\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).