[Tex/LaTex] subcaption package incompatible with memoir class


When I try to compile a document with the memoir class and the subcaption package I get the following error:

! Package subcaption Error: This package can't be used in
cooperation with the subfig package.

I presume this is because the memoir class loads the subfig package. Is that correct?

Is there a way to make them work together?

Best Answer

The subfig and subcaption packages can not be used in cooperation with each other. Instead, you can usecaption package with subfig to add some flavor to the captions and subcaptions (or you can use caption along with subcaption (which gives a subfigure command also).

\usepackage[demo]{graphicx} % remove [demo] in your file
\usepackage{subfig} % for subfigures

subrefformat=parens} %<-----designing subcaption
\newcommand{\myfigref}[2]{~\ref{#1}.\subref{#2}}% <---- a new macro for referring to a subfigure
\chapter{First chapter}
  \includegraphics[width=1\textwidth]{my figure}
  \caption{My single picture}\label{fig:figures}
\subfloat[My first picture]{\label{fig:mdleft}{\includegraphics[width=0.4\textwidth]{my figure}}}\hfill
\subfloat[My second picture]{\label{fig:mdright}{\includegraphics[width=0.4\textwidth]{my figure}}}
\caption{My two big pictures}
From figure~\ref{fig:subfigures}.\subref{fig:mdleft}, we can see a small cat, in     
\myfigref{fig:subfigures}{fig:mdright} both can be used to refer figures.

enter image description here

Related Question