3

For my paper, I want to have all of my figures and tables in the appendix at the end of my document and not in the main part of the document. I'm trying to put the figures in one section and the tables in a separate section but the appendix sections are printed on the first two lines of the page and then the figures and tables are randomly inserted after. How do I get them into separate section and in the order they are added? I have 7 figures and 3 tables total. This is the code I am using now:

\cleardoublepage
\appendix

\section{Figures}
\begin{figure}[h!]
\begin{subfigure}
\includegraphics[width=1in]{image1}
\caption{}
\label{img1}
\end{subfigure}
\begin{subfigure}
\includegraphics[width=1in]{image2}
\caption{}
\label{img2}
\end{subfigure}
\caption{some text}
\label{img12}
\end{figure}

\begin{figure}[h!]
\includegraphics[width=1in]{image3}
\caption{some text}
\label{img3}
\end{figure}

\section{Tables}
\begin{longtable}[h!]{cc}
\caption{} \label{table1} \\
column1 & column2 \\ 
\hline 
57.4 & -43.3 \\ 
60.6 & -24.5 \\ 
105.2 & -83.0 \\ 
30.2 & -27.3 \\ 
94.2 & -67.7 \\ 
28.4 & -68.8 \\ 
24.4 & -35.4 \\ 
47.1 & -120.0 \\ 
59.4 & -100.9 \\ 
82.5 & -60.3 \\ 
19.0 & -53.8 \\ 
111.9 & -26.2 \\ 
65.5 & -121.2 \\ 
60.2 & -33.9 \\ 
56.1 & -57.0 \\ 
56.6 & -91.3 \\ 
61.9 & -96.5 \\ 
59.9 & -46.6 \\ 
62.2 & -42.0 \\ 
35.8 & -34.7 \\ 
23.0 & -49.4 \\ 
88.7 & -61.5 \\ 
74.4 & -31.6 \\ 
71.8 & -66.8 \\ 
\end{longtable}

\begin{table}[h!]
\centering
\caption{}
\resizebox{\textwidth}{!}{\begin{tabular}{lllllllll}
& A d2l & A l2d & B d2l & B l2d & C d2l & C l2d & D d2l & D l2d \\ 
\hline 
12 & 68.3 & -56.5 & 81.0 & -70.3 & 95.3 & -81.4 & 76.1 & -75.5 \\ 
11 & 105.2 & -102.3 & 79.8 & -82.1 & 103.7 & -90.4 & 84.5 & -81.2 \\ 
10 & 56.3 & -51.9 & 57.1 & -56.0 & 57.1 & -53.8 & 38.3 & -40.4 \\ 
9 & 91.1 & -83.1 & 107.9 & -103.7 & 93.1 & -96.4 & 101.9 & -86.7 \\ 
8 & 63.7 & -62.6 & 50.6 & -44.8 & 42.0 & -45.3 & 55.5 & -54.4 \\ 
7 & 68.3 & -50.4 & 56.3 & -56.8 & 65.1 & -52.8 & 59.1 & -60.4 \\ 
6 & 60.8 & -60.1 & 59.2 & -64.7 & 65.9 & -69.3 & 57.0 & -48.3 \\ 
5 & 89.9 & -79.7 & 87.7 & -92.0 & 90.6 & -81.0 & 88.5 & -86.9 \\ 
4 & 64.0 & -54.7 & 48.4 & -40.9 & 53.6 & -54.3 & 62.5 & -58.5 \\ 
\hline 
\end{tabular}}
\label{table2}
\end{table}
1
  • 1
    maybe you can explore the package endfloat
    – Rmano
    Mar 17, 2021 at 6:40

2 Answers 2

3

There are some ways you can achieve this

1. For your current document

The easiest option in your case would probably be to simply load \usepackage[section]{placeins}, which makes \sections impermeable for floats, ensuring that the figures and tables stay where you have already put them

2. In case you haven't coded the floats yet

the endfloat package automatically does, I think, exactly what you are trying to do manually. You could then write the figures/tables where they would normally appear in the text, and let the package deal with the proper referencing and placing of the floats.

3. Avoid floats

As @Οὖτις suggested in their answer, if you want to decide where figures/tables go, don't let them float and place them outside the respective environment. This option is probably the least flexible though and makes the task of organizing/fitting the figures/tables on pages neatly your responsibility.

2

As you are using float environments (e.g. figure), you allow LaTeX to decide where the figure/table fits best. You have two options:

  1. As you do not want them to float, avoid the float environments. Just leave out the \begin{figure} and \end{figure}-lines. As you still want to use captions, put \captionof{figure}{figurecaption} like here:
Text or previous figures.

\bgroup\centering% \bgroups keeps the \centering-command local
\includegraphics{image1}%
\captionof{figure}{test}%
\egroup

Text or following figures.
  1. Load the float-package which allows you to write \begin{figure}[H]. The figure will be placed exactly here (where you have it in your code).

You must log in to answer this question.

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