2

I want to have a float which covers an entire page, but with a table and two figures inside. From https://tex.stackexchange.com/a/111121 I figured (no pun indented) I need to write (using the caption and the subcaption package)

\documentclass[english]{llncs}

\RequirePackage{etoolbox}
\RequirePackage{xpatch}
\RequirePackage[T1]{fontenc} 
\RequirePackage[utf8]{inputenc}  
\RequirePackage[allowlitunits]{siunitx}
\makeatletter
\@ifpackageloaded{xcolor}{}{\RequirePackage[usenames,dvipsnames,svgnames,table]{xcolor}}
\makeatother
\RequirePackage[demo]{graphicx}
\RequirePackage{caption}
\captionsetup[figure]{labelfont={bf},name={Fig.},labelsep=period,font={small}}
\captionsetup[table]{labelfont={bf},name={Table},labelsep=period,font={small}}
\RequirePackage[labelfont={bf},name={Fig.},labelsep=period,font={small}]{subcaption}

\begin{document}

\newcolumntype{Z}{S[
    table-format=1.3,
    round-mode=places,
    round-precision=3]}

\begin{figure}[p]
\centering

    \captionof{table}{My table text}
    \label{tab:nmi}
    \setlength\tabcolsep{5pt}
    \begin{tabular}{lll}
    this & and & that
    \end{tabular}\vspace{3mm}


    \includegraphics [width=\textwidth] {fig1.pdf}
    \captionof{figure}{My fig 1 text}
    \label{fig:nmi_alldatasets}

    \includegraphics [width=\textwidth] {fig2.pdf}
    \caption{figure}{My fig 2 text}
    \label{fig:nmi1_perdataset}
\end{figure}

\end{document}

(Please find the class at ftp://ftp.springernature.com/cs-proceeding/llncs/llncs2e.zip)

But now I get the warnings

The caption type was already set to 'figure'(caption) on input line 27

The caption type was already set to 'table'(caption) on input line 36

Otherwise this is exactly what I want. What can I do?

1

The springer class has its own caption handling. Define a \captionof which do not needs a package:

\documentclass[english]{llncs}
\usepackage[demo]{graphicx}
\makeatletter
\def\captionof#1{%
    \begingroup
    \def\@captype{#1}%
    \@ifnextchar[\captionof@i{\captionof@ii}}
\def\captionof@i[#1]#2{\caption[#1]{#2}\endgroup}
\def\captionof@ii#1{\caption{#1}\endgroup}
\makeatother
\begin{document}

\begin{figure}
\centering
\captionof{table}{My table text}\label{tab:nmi}
\begin{tabular}{lll}
    this & and & that
\end{tabular}

\bigskip
 \includegraphics[width=\linewidth]{fig1.pdf}
\caption{My fig 1 text}\label{fig:nmi_alldatasets}

\bigskip
\includegraphics[width=\linewidth]{fig2.pdf}
\caption{My fig 2 text}\label{fig:nmil_perdatasets}
\end{figure}

\end{document}

enter image description here

It can be a simple definition if you use inside a figure or table environment always \captionof and not a mix of \caption and \captionof

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.