# confict between the subfigure and customized caption(side-by-side subfigures)

the desired result:

Q:The .cls document i used is a template for a journal IJCAS, i want to use the subfloat package to reveal the side-by-side subfigures,

1，when the subfig package is loaded， Message:! LaTeX Error: Command \setcaptionmargin already defined.Or name \end... illegal, see p.192 of the manual.See the LaTeX manual or LaTeX Companion for explanation.Type H for immediate help.... \caption@setmargin}

2，when the subfig package isnot loaded, of course, the undefined message will apear.

MWE:

\documentclass[fleqn]{IJCAS}
%% include the useful LaTeX packages:
%\usepackage{subfig}

\begin{document}
\title{Title}

\begin{figure}[H]
\centering
\subfloat[topology1]{
\includegraphics[scale=1]{1}
}

\subfloat[topology2]{
\includegraphics[scale=1]{1}
}
\caption{Interaction topology}
\end{figure}

\clearafterbiography\relax
\end{document}


the needed document: IJCAS.cls

Thoughts: the customized caption in IJCAS.cls conficts with the subfig package(in my opinion), is there any way to fix it ,thanks!

The IJCAS document class contains a build-in version of the (obsolete) caption2 package which is incompatible to the subfig package. (The actual version of caption2 can be used with subfig so it's a shame that they integrated caption2 support by copy+paste instead of \RequirePackage{caption2}.) So the only way to get the subfig package working is writing the maintainer of the IJCAS document class that it would be nice if she/he could drop all of the copied and modified caption2 code and replace it with \RequirePackage{caption} and regular adaption of the caption style using documented methods offered by the recent version of the caption package.

As alternative one could use the (obsolete) subfigure package which is compatible to the (old) version of caption2 package build-in in IJCAS:

\documentclass[fleqn]{IJCAS}
%% include the useful LaTeX packages:

\usepackage{subfigure}

\begin{document}
\title{Title}

\begin{figure}[H]
\centering
\subfigure[topology1]{%
\includegraphics[scale=1]{1}
}
\subfigure[topology2]{%
\includegraphics[scale=1]{1}
}
\caption{Interaction topology}
\end{figure}

\clearafterbiography\relax
\end{document}

• IT WORKS! thank you so much. Now i need to submit the manuscript before the deadline, i will fix it in your way! Later, i'll try to email the chief editor to state the problem! anyway, thanks! – mazhengg Jun 6 '16 at 6:40