# Suspend figures and tables to appendix

For my thesis I'm looking to be able to suspend all figures and tables (basically all floatables, but in my case I think I'll only be using figures) to the appendix, where they are all collected together - preferably as a list of figures followed by a list of tables and so on. Also, they should retain the numbering they would have received had they been placed within the text. As I'm using scrbook I would like them to retain the chapter-wise numbering, respectively.

Side note: I have already experimented with the package endfloat LINK that somewhat does what I'd like to have, but:
1) places figures & tables at the end of the whole document, but I would prefer another place
2) does produce compiling errors from the second run on that render me unable to compile the document from then on.

# Minimum work example:

For now my file looks something like this (I left most of the packages inside so possible conflicts can be avoided prior to posting an answer. I'm sorry if they clutter the document a bit):

\documentclass[a4paper, 12pt, toc=listof, titlepage, toc=bibliography, open=right, ngerman]{scrbook}
\usepackage[utf8]{inputenc}
\usepackage{babel}
\usepackage{csquotes}
\usepackage[style = ieee, urldate =comp, citestyle = numeric-comp]{biblatex}
\DefineBibliographyStrings{german}{
}
\usepackage[sfdefault,lf]{carlito}
\usepackage[T1]{fontenc}
\renewcommand*\oldstylenums[1]{\carlitoOsF #1}
\usepackage{subcaption}
\usepackage{graphicx}
\usepackage{tikz}
\usepackage[onehalfspacing]{setspace}
\usepackage[margin=12pt,font=sf,labelfont=bf]{caption}
\usepackage[format=hang,justification=centering,singlelinecheck=off]{caption}
\setcounter{secnumdepth}{3}
\setcounter{tocdepth}{3}
\usepackage{listings}
\usepackage[nottoc]{tocbibind}
\usepackage{url}
\usepackage[toc,style=long,entrycounter,]{glossaries}
\renewcommand*{\glsentrycounterlabel}{}
\makeglossaries
\selectlanguage{ngerman}

\begin{document}
\sloppy
\overfullrule=2cm
\pagenumbering{Roman}
The titlepage
\normalsize
\vspace*{10cm}
\thispagestyle{empty}
\newpage
% Abstract
Abstract here
\tableofcontents
\listoffigures
\listoftables
\cleardoubleoddpage
\pagenumbering{arabic}
% actual content here
\chapter{My test chapter}
Chapter description
\section{My test section}
Section description
\begin{figure}[p]
\centering
\begin{subfigure}{.325\linewidth}
Figure 1
\caption{Figure}
\end{subfigure}
\hfill
\begin{subfigure}{.325\linewidth}
Figure 1
\caption{Figure}
\end{subfigure}
\hfill
\\ \vspace{1cm}
\begin{subfigure}{.325\linewidth}
Figure 1
\caption{Figure}
\end{subfigure}
\hfill
\begin{subfigure}{.325\linewidth}
Figure 1
\caption{Figure}
\end{subfigure}
\hfill
\begin{subfigure}{.325\linewidth}
Figure 1
\caption{Figure}
\end{subfigure}
% \hfill
\caption{Some figures}
\end{figure}
\chapter{Next chapter}
Next chapter description
\section{Next Section}
Next section description
\cleardoubleoddpage
% beginning of appendix
\pagenumbering{Alph}
%
% This is the place where I want my figures to actually appear
%
\printglossary[title={Glossar}]
\setlength{\emergencystretch}{3em}
\printbibliography
\end{document}


You should find yourself with a thirteen pages long document compiling this with only 3 pages of chapter and figure content (ranging from page 9 to 11). I marked the space where I would want my floatables to be (as if I could write a command there to force it) in the code.

• You can place endfloat using \processdelayedfloats (page 8). See also tex.stackexchange.com/questions/430603/…. – John Kormylo Jul 5 '18 at 13:05
• @John Kormylo that question is indeed very similar (if not identical) to my question. I experimented with either solutions, but did not receive the result I wanted - which is chapter relative numeration of the floatables. Do you perhaps have another idea of a solution to my problem? – mgessenich Jul 10 '18 at 11:20
• Since endfloat copies the figure and table source into files (.fff and .ttt), compilation errors probably come from the code itself. Endfloat appears to use its own counters for the markers, but the captions are all executed together at the end. One might be able to redefine \thefigure and \thetable to look up previously computed numbers. – John Kormylo Jul 10 '18 at 13:02
• Strangely I just realized that endfloat actually preserves the correct numbering, but I just encountered 2 problems. -- 1 -- figure captions don't support UTF-8 characters (I'm German and wanted to use "ü" in a caption) I cared about the special characters for the normal text though.. with \usepackage[utf8]{inputenc} and babel ngerman -- 2 -- get a empty page with only the "Figures" title but no figures on it because latex places all figures on "floatables-only-pages" :( do you have any advice? – mgessenich Jul 10 '18 at 13:11
• Sorry, I use ASCII. BTW, you are loading caption twice. – John Kormylo Jul 10 '18 at 13:48

In the following, just using endfloat will cause the caption numbers to use the current chapter number (in this case, 2.1 instead of 1.1). The macro \savecaptionof needs to go after each figure or table. \restorecaptionof redefines \thefigure or \thetable to use these stored values.

I'm not sure what \label will do, but with one figure per page it should work fine.

\documentclass[a4paper, 12pt, toc=listof, titlepage, toc=bibliography,

open=right, ngerman]{scrbook}
%\usepackage[utf8]{inputenc}% ASCII here
\usepackage{babel}
\usepackage{csquotes}
\usepackage[style = ieee, urldate =comp, citestyle = numeric-comp]{biblatex}
\DefineBibliographyStrings{german}{
}
\usepackage[sfdefault,lf]{carlito}
%\usepackage[T1]{fontenc}
\renewcommand*\oldstylenums[1]{\carlitoOsF #1}
\usepackage{subcaption}
\usepackage{graphicx}
\usepackage{tikz}
\usepackage[onehalfspacing]{setspace}
\usepackage[margin=12pt,font=sf,labelfont=bf,format=hang,justification=centering,singlelinecheck=off]{caption}
\setcounter{secnumdepth}{3}
\setcounter{tocdepth}{3}
\usepackage{listings}
%\usepackage[nottoc]{tocbibind}
\usepackage{url}
\usepackage[toc,style=long,entrycounter,]{glossaries}
\renewcommand*{\glsentrycounterlabel}{}
\makeglossaries
\selectlanguage{ngerman}

\usepackage{endfloat}

\newcommand{\savecaptionof}[1]% #1 = figure or table (counter)
{%
\refstepcounter{#1}%
\expandafter\xdef\csname #1\arabic{#1}\endcsname{\csname the#1\endcsname}% store as \figure1 etc.
}
\newcommand{\restorecaptionof}[1]% #1 = figure or table (counter)
{%
\setcounter{#1}{0}%
\expandafter\gdef\csname the#1\endcsname{\csname #1\arabic{#1}\endcsname}%
}

\begin{document}
\sloppy
\overfullrule=2cm
\pagenumbering{Roman}
The titlepage
\normalsize
\vspace*{10cm}
\thispagestyle{empty}
\newpage
% Abstract
Abstract here
\tableofcontents
\listoffigures
\listoftables
\cleardoubleoddpage
\pagenumbering{arabic}
% actual content here
\chapter{My test chapter}
Chapter description
\section{My test section}
Section description
\begin{figure}[p]
\centering
\begin{subfigure}{.325\linewidth}
Figure 1
\caption{Figure}
\end{subfigure}
\hfill
\begin{subfigure}{.325\linewidth}
Figure 1
\caption{Figure}
\end{subfigure}
\hfill
\\ \vspace{1cm}
\begin{subfigure}{.325\linewidth}
Figure 1
\caption{Figure}
\end{subfigure}
\hfill
\begin{subfigure}{.325\linewidth}
Figure 1
\caption{Figure}
\end{subfigure}
\hfill
\begin{subfigure}{.325\linewidth}
Figure 1
\caption{Figure}
\end{subfigure}
% \hfill
\caption{Some figures}
\end{figure}
\savecaptionof{figure}% goes immediately after figure or table

\chapter{Next chapter}
Next chapter description
\section{Next Section}
Next section description
\cleardoubleoddpage
% beginning of appendix
\pagenumbering{Alph}
%
% This is the place where I want my figures to actually appear
\restorecaptionof{figure}% goes before \processdelayedfloats
\processdelayedfloats
%
\printglossary[title={Glossar}]
\setlength{\emergencystretch}{3em}
\printbibliography
\end{document}

• Currently I'm not able to compile your answer.. I commented out the bib, but it still has lots of errors. Did I do something wrong? – mgessenich Jul 10 '18 at 14:28
• I commented out inputenc, since I don't need it with my editor, and fontenc gives me errors whenever I try to use it. – John Kormylo Jul 10 '18 at 17:50
• Commenting in inputenc did not solve all the problems :( lots of "Missing \endcsname inserted" and " Extra \endcsname" and a "Paragraph ended before \@fileswith@ptions was complete" .. suggestions? – mgessenich Jul 12 '18 at 11:20
• I tried out to add the \newcommand definitions and the \restorecaptionof{figure} at the end, but I receive lots of "Undefined control sequence" errors.. in the logfile it compains about "\efloatseparator" .. – mgessenich Jul 12 '18 at 12:16
• I do not advice commenting out inputenc if your editor produces utf8. My editor doesn't, and I normally don't use xelatex. – John Kormylo Jul 12 '18 at 14:01