Error by loading subcaption using the LNCS class

captionssubfloatstikz-pgf

I've used the subcaption package without any problem.
Now I am drawing the tikz picture using the documentclass LNCS.

If I use the subcaption package,

\documentclass[runningheads]{llncs}

\usepackage[T1]{fontenc}

\usepackage{tikz}
\usepackage{subcaption}
%\usepackage{subfig}

\begin{document}

\section{First Section}

\begin{figure}
\centering
\begin{subfigure}{0.4\textwidth}
    \centering
    \begin{tikzpicture}[scale=0.7]
        \draw (0,0) circle (2cm);
    \end{tikzpicture}
    \caption{Fig1} \label{fig1:a}
\end{subfigure}
\begin{subfigure}{0.4\textwidth}
    \centering
    \begin{tikzpicture}[scale=1.2]
        \draw (0,0) circle (2cm);
    \end{tikzpicture}
    \caption{Fig2} \label{fig1:b}
\end{subfigure}
\caption{Fig1} \label{fig1}
\end{figure}

\end{document}

I get the error:

Package caption Warning: Unknown document class (or package), standard defaults will be used.

See the caption package documentation for explanation.

If I use the subfig package,

\documentclass[runningheads]{llncs}

\usepackage[T1]{fontenc}

\usepackage{tikz}
%\usepackage{subcaption}
\usepackage{subfig}

\begin{document}

\section{First Section}

\begin{figure}
\centering
\subfloat[]{\label{fig2:a}
    \begin{tikzpicture}[scale=0.7]
        \draw (0,0) circle (2cm);
    \end{tikzpicture}
    }\
\subfloat[]{\label{fig2:b}
    \begin{tikzpicture}[scale=1.2]
        \draw (0,0) circle (2cm);
    \end{tikzpicture}
    }
\caption{Fig2} \label{fig2}
\end{figure}

\end{document}

I also get the same error.
However, if I use the documentclass article, both cases compile fine.

Any idea on what the problem might be? (Using the subcaption package may be better if possible.)

Best Answer

Classes that want to print captions in a special way are usually not compatible with the caption package, which is only able to interact with a few classes (the standard ones, the KoMa ones and possibly a few others).

If you load caption with an unsupported class, you'll get at least a warning and caption would hijack the captions as defined by the class, which is not wanted, because such classes are usually meant for submissions to journals (articles) or publishers (books) and the work would be likely rejected for noncompliance with the required typesetting format.

Of course, loading subcaption is likewise forbidden with such classes.

Can you have subfloats, then? Yes, you can use subfig, provided you load it without caption.

\usepackage[caption=false]{subfig}

Full example.

\documentclass[runningheads]{llncs}

\usepackage[T1]{fontenc}

\usepackage{tikz}
\usepackage[caption=false]{subfig}

\begin{document}

\section{First Section}

\begin{figure}[htp]
\centering

\subfloat[]{\label{fig2:a}%
    \begin{tikzpicture}[scale=0.7]
        \draw (0,0) circle (2cm);
    \end{tikzpicture}%
    }\quad
\subfloat[]{\label{fig2:b}%
    \begin{tikzpicture}[scale=1.2]
        \draw (0,0) circle (2cm);
    \end{tikzpicture}%
    }

\caption{Fig2} \label{fig2}

\end{figure}

\end{document}

Beware of spurious spaces (check the % characters I added).

enter image description here