6

I would like to ask how to compile subfigure command in Springer Journals. Here is my code:

 \begin{figure*}[htp]   
   \begin{subfigure}[t]{0.65\textwidth}
    \centering            
\includegraphics[width=.65\textwidth]{../latex/figure/rev_n.pdf}
        \caption{An example of }\label{rev}
     \end{subfigure}
~
 \begin{subfigure}[t]{0.35\textwidth}
  \centering
\includegraphics[width=.35\textwidth]{../latex/figure/rev_sol_n.pdf}
        \caption{An scheme of }\label{rev_sol} 
   \end{subfigure}

        \caption{Illustration of }\label{bs1}
\end{figure*}

Link for springer latex template:https://www.springer.com/gp/livingreviews/latex-templates.

Once removed subfigure linewidth (\begin{subfigure}[t]%{0.65\textwidth}), it is possible to compile the file. However, gives different figure number not subfigure number. Is there any way to command some codes to run the file with subfigure?

Sebastiano
  • 54,118
ruz
  • 343
  • 6
    (1) welcome, (2) please post the full minimal document, and post the error message you get. As you question sits here, we don't know if you have loaded anything that provides subfigure, I don't think Springers provides it by default. – daleif Jul 05 '18 at 09:42
  • 1
    A possible solution is to add \usepackage{subcaption} to your preamble (between \documentclass and \begin{document}). To answer the question it would also be helpful to know which error message you currently get when trying to compile the document. – Marijn Jul 05 '18 at 11:11
  • I already have \usepackage{subcaption} – ruz Jul 07 '18 at 09:22

1 Answers1

8

When compiling your document you should get the following error:

Package caption Warning: \caption will not be redefined since it's already
(caption)                redefined by a document class or package which is
(caption)                unknown to the caption package.
See the caption package documentation for explanation.

! Package caption Error: The `subcaption' package does not work correctly
(caption)                in compatibility mode.

This is because the caption package isn't adapted to the svjour3 document class. It detects unknown caption code and therefore switches itself into the "compatibility mode", trying to be as compatible as possible to the caption package v1.x from 1995.

The subcaption package is relying on new features offered by caption v3.x, and therefore refuse to work in this environment.

Possible solution: Try the subfig package instead which isn't relying on caption:

\usepackage[caption=false]{subfig}

An example document, derived from the template:

\documentclass[twocolumn]{svjour3}          % twocolumn
%
\usepackage[demo]{graphicx}
\usepackage[caption=false]{subfig}

\begin{document}

\title{Insert your title here}
\subtitle{Do you have a subtitle?\\ If so, write it here}

%\titlerunning{Short form of title}        % if too long for running head

\author{First Author         \and
        Second Author %etc.
}

%\authorrunning{Short form of author list} % if too long for running head

\institute{F. Author \at
              first address \\
              Tel.: +123-45-678910\\
              Fax: +123-45-678910\\
              \email{fauthor@example.com}           %  \\
%             \emph{Present address:} of F. Author  %  if needed
           \and
           S. Author \at
              second address
}

\date{Received: date / Accepted: date}
% The correct dates will be entered by the editor

\maketitle

\begin{abstract}
Insert your abstract here. Include keywords, PACS and mathematical
subject classification numbers as needed.
\keywords{First keyword \and Second keyword \and More}
\end{abstract}

\section{Subfigures}

\begin{figure*}[htp]
   \subfloat[An example of ]{\label{rev}
      \includegraphics[width=.65\textwidth]{../latex/figure/rev_n.pdf}}
~
   \subfloat[An scheme of ]{\label{rev_sol}
      \includegraphics[width=.35\textwidth]{../latex/figure/rev_sol_n.pdf}}

   \caption{Illustration of }\label{bs1}
\end{figure*}

\end{document}
  • Unfortunately does not work. I already have \usepackage[caption=false]{sub fig}. – ruz Jul 10 '18 at 07:08
  • @ruz What exactly do you mean with "does not work". What error message do you get? Please note that the subfig package offers a different syntax than the subcaption package. –  Jul 10 '18 at 07:15
  • @nuz I just added an example document to my answer. –  Jul 10 '18 at 07:22
  • Thanks! This solves the problem for the ws-ijbc class. – Ali Shakiba Sep 03 '18 at 14:16
  • The answer at https://tex.stackexchange.com/questions/31906/subcaption-package-compatibility-issue fixes this for me (\captionsetup{compatibility=false}) with the caveat this might change formatting – Neil Aug 26 '20 at 06:18