1

I am trying to

  • process figures and tables from the body at the end of the article but before the appendix using endfloat (following this discussion) and
  • in the appendix, add the section identifier to the figure and table captions, e.g., Table A1, using, e.g., \renewcommand{\thetable}{\thesection\arabic{table}} (following this discussion)

While each "feature" works independently, when commenting out the relevant lines in the MWE below, both features together cause a compilation error. I suspect that endfloat messes with the caption relevant environments throughout the document.

How can I fix this?

See my MWE below (I compile with xelatex)

\documentclass[11pt,a4paper]{article}

\usepackage[
    a4paper,
    left=1in,
    right=1in,
    top=1.5in,
    bottom=1.5in
]{geometry}                              % DIN A4 margins
\usepackage[toc,page,titletoc,title]{appendix}     % appendix
\usepackage[font=large,labelfont=bf]{caption}      % format captions
\usepackage{subcaption}                            % create subfigures
\setlength{\abovecaptionskip}{8pt}                 % caption settings
\usepackage{adjustbox}                             % scale tables and figures to page size
\usepackage{graphicx}                              % figures
\usepackage[figuresfirst,nomarkers,nolists]{endfloat}      % put tables and figures at end

\begin{document}

% -------------------- article ----------------------- %

Some text.

\begin{table}
    \centering
    \caption{Title}
    \caption*{Some description}
    \label{tab:table-1}
    \begin{tabular}{ c c c }
     cell1 & cell2 & cell3 \\ 
     cell4 & cell5 & cell6 \\  
     cell7 & cell8 & cell9    
    \end{tabular}
\end{table}

\newpage

Some text.

% -------------------- tables and figures ----------------------- %
% process delayed floats here, i.e., at end of body but before the appendix
\clearpage
\processdelayedfloats

% -------------------- appendix ----------------------- %
\clearpage

\renewcommand\appendixname{Appendix}

\appendix

% restart counter within each section
\counterwithin{figure}{section}
\counterwithin{table}{section}

% set names
\renewcommand{\thefigure}{\thesection\arabic{figure}}
\renewcommand{\thetable}{\thesection\arabic{table}}

\begin{appendices}   
    \section{Something with Tables}

    \begin{table}
        \centering
        \caption{Title}
        \caption*{Some description}
        \label{tab:appendix-table-1}
        \begin{tabular}{ c c c }
         cell1 & cell2 & cell3 \\ 
         cell4 & cell5 & cell6 \\  
         cell7 & cell8 & cell9    
        \end{tabular}
    \end{table}

\end{appendices}

\end{document}

1 Answer 1

0

It looks like endfloat is indeed to blame based on this post.

The solution was to restore the old definitions of all environments endfloat has re-defined.

The changed MWE now compiles as expected.

\documentclass[11pt,a4paper]{article}

\usepackage[
    a4paper,
    left=1in,
    right=1in,
    top=1.5in,
    bottom=1.5in
]{geometry}                              % DIN A4 margins
\usepackage[toc,page,titletoc,title]{appendix}     % appendix
\usepackage[font=large,labelfont=bf]{caption}      % format captions
\usepackage{subcaption}                            % create subfigures
\setlength{\abovecaptionskip}{8pt}                 % caption settings
\usepackage{adjustbox}                             % scale tables and figures to page size
\usepackage{graphicx}                              % figures
\usepackage[figuresfirst,nomarkers,nolists]{endfloat}      % put tables and figures at end

\begin{document}

% -------------------- article ----------------------- %

Some text.

\begin{table}
    \centering
    \caption{Title}
    \caption*{Some description}
    \label{tab:table-1}
    \begin{tabular}{ c c c }
     cell1 & cell2 & cell3 \\ 
     cell4 & cell5 & cell6 \\  
     cell7 & cell8 & cell9    
    \end{tabular}
\end{table}

\newpage

Some text.

% -------------------- tables and figures ----------------------- %
% process delayed floats here, i.e., at end of body but before the appendix
\clearpage
\processdelayedfloats
% restore the old definitions of all environments endfloat has re-defined
% this is necessary to change captions in the appendix
\csname efloat@restorefloats\endcsname   % <---------------------------- added

% -------------------- appendix ----------------------- %
\clearpage

\renewcommand\appendixname{Appendix}

\appendix

% restart counter within each section
\counterwithin{figure}{section}
\counterwithin{table}{section}

% set names
\renewcommand{\thefigure}{\thesection\arabic{figure}}
\renewcommand{\thetable}{\thesection\arabic{table}}

\begin{appendices}   
    \section{Something with Tables}

    \begin{table}
        \centering
        \caption{Title}
        \caption*{Some description}
        \label{tab:appendix-table-1}
        \begin{tabular}{ c c c }
         cell1 & cell2 & cell3 \\ 
         cell4 & cell5 & cell6 \\  
         cell7 & cell8 & cell9    
        \end{tabular}
    \end{table}

\end{appendices}

\end{document}

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .