1

I have a paper with three large floats that go to the end of the document when compiling the source code, their position vary depending on how I update the content, but they even go to the middle of references list sometimes.

enter image description here

Hence, I use \afterpage{\clearpage} to force the floats to go in a reasonable position. However, after placement of such command, some empty spaces appear after the float page. I used \vspace{-<some number>\baselineskip} to insert negative spaces. However, this is not good for two reasons:

  1. With many changes in the document, the empty spaces change. Thus, the negative space can be either not enough or it may cause overprinting of contents.
  2. The references are generated automatically by using \bibliography{*.bib}, hence, I would not be able to remove the space between references title and references list.

I am using IEEEtran document class

Here is how I force a float page while filling the current page (this works well for the page before the floats page)

enter image description here

Then this is my float page enter image description here

After the float page enter image description here

MWE

\documentclass{IEEEtran}

\usepackage[svgnames, x11names]{xcolor}
\usepackage{amsmath}
\usepackage{array}
\renewcommand{\arraystretch}{1.7}

\usepackage{multirow}
\usepackage{caption}
\usepackage{ragged2e}
\usepackage{tabularx}
\newcolumntype{C}{ >{ \arraybackslash \Centering } X }
\usepackage{booktabs}
\usepackage{makecell}
\usepackage{adjustbox}

\usepackage{stackengine}

\newcommand{\stackanchormath}[3][\stackgapSdefaultl]{
    \stackanchor[#1]{$#2$}{$#3$}
}

\newlength{\stackgapSdefaultl}
\setlength{\stackgapSdefaultl}{1.06mm}
\setstackgap{S}{\stackgapSdefaultl}



\usepackage{graphicx}
\usepackage{float}
\usepackage{afterpage}


\usepackage{blindtext}



\begin{document}


\blindtext
\blindtext
\blindtext
\blindtext
\blindtext

\begin{figure*}
    \centering
    \includegraphics[width=0.6\textwidth]{example-image-a}
\end{figure*}

\begin{table*}[htb]

    \noindent
    \hspace*{\fill}
    \begin{minipage}{0.45\textwidth}

        % Table options

        % Caption
        \caption{Top five weak combinations of PoIs at different voltage levels identified using the exhaustive search method}
        \label{table:ex_screen_result}

        % Center the table
        \centering

        \begin{tabularx}{1\textwidth}{c ||C C C C C |C}

            \toprule

            & \multicolumn{5}{c|}{\adjustbox{rotate=90, valign=c}{
                    \Shortunderstack{{Reference} {PoI}}
                } \hspace{\fill} \bfseries Combinations of PoIs \hspace{\fill} } &
            \adjustbox{rotate=90}{
                \Shortunderstack{{Min} {SDSCR}}
                                }
            \\
            \Xhline{0.25mm}

            \multirow{5}{0.3cm}{\adjustbox{rotate=90, valign=c, center}{$69$ KV}} & \bfseries 80 & \bfseries 84  & \bfseries 76 & \bfseries 81 & \bfseries 78 & \bfseries 1.77
            \\

            & 52 & 35 & 86 & 70 & 22 & 1.79
            \\

            & 40 & 45  & 80 & 90 & 10 & 1.80
            \\

            & 14 & 11  & 50 & 30 & 20 & 1.83
            \\

            & 18 & 88  & 32 & 02 & 01 & 1.85
            \\
            \Xhline{0.25mm}
            \addlinespace
            \Xhline{0.25mm}

            \multirow{5}{0.3cm}{\adjustbox{rotate=90, valign=c, center}{$34.5$ KV}} & \bfseries 1008 & \bfseries 926  & \bfseries 925 & \bfseries 885 & \bfseries 884 & \bfseries 2.65
            \\

            & 56 & 900  & 200 & 800 & 400 & 2.68
            \\

            & 450 & 500  & 400 & 300 & 250 & 2.76
            \\

            & 750 & 30  & 100 & 20 & 10 & 30
            \\

            & 40 & 80  & 30 & 180 & 120 & 3.06
            \\
            \Xhline{0.25mm}
            \addlinespace
            \Xhline{0.25mm}


            \multirow{5}{0.3cm}{\adjustbox{rotate=90, valign=c, center}{$13.8$ KV}} & \bfseries 969 & \bfseries 998 & \bfseries 1001 & \bfseries 1003 & \bfseries 1000 & \bfseries 1.20
            \\

            & 60 & 20 & 2000 & 1500 & 200 & 1.22
            \\

            & 40 & 30 & 450 & 50 & 30 & 1.42
            \\

            & 95 & 550 & 1400 & 14 & 1700 & 1.60
            \\

            & 200 & 900 & 1017 & 1222 & 3333 & 1.82
            \\
            \Xhline{0.25mm}
            \addlinespace
            \Xhline{0.25mm}

            \multicolumn{4}{c}{\bfseries \color{DeepSkyBlue2} Time Consumed} & \multicolumn{3}{c}{\bfseries \color{DeepSkyBlue2} 8 hours}

            \\
            \bottomrule
        \end{tabularx}
    \end{minipage}
    \hspace{\fill}
    \begin{minipage}{0.45\textwidth}

        % Table options

        % Caption
        \caption{Top five weak combinations of PoIs at different voltage levels identified using the exhaustive search method}
        \label{table:ex_screen_result}

        % Center the table
        \centering

        \begin{tabularx}{1\textwidth}{c ||C C C C C |C}

            \toprule

            & \multicolumn{5}{c|}{\adjustbox{rotate=90, valign=c}{
                    \Shortunderstack{{Reference} {PoI}}
                } \hspace{\fill} \bfseries Combinations of PoIs \hspace{\fill} } &
            \adjustbox{rotate=90}{
                \Shortunderstack{{Min} {SDSCR}}
                                }
            \\
            \Xhline{0.25mm}

            \multirow{5}{0.3cm}{\adjustbox{rotate=90, valign=c, center}{$69$ KV}} & \bfseries 80 & \bfseries 84  & \bfseries 76 & \bfseries 81 & \bfseries 78 & \bfseries 1.77
            \\

            & 52 & 35 & 86 & 70 & 22 & 1.79
            \\

            & 40 & 45  & 80 & 90 & 10 & 1.80
            \\

            & 14 & 11  & 50 & 30 & 20 & 1.83
            \\

            & 18 & 88  & 32 & 02 & 01 & 1.85
            \\
            \Xhline{0.25mm}
            \addlinespace
            \Xhline{0.25mm}

            \multirow{5}{0.3cm}{\adjustbox{rotate=90, valign=c, center}{$34.5$ KV}} & \bfseries 1008 & \bfseries 926  & \bfseries 925 & \bfseries 885 & \bfseries 884 & \bfseries 2.65
            \\

            & 56 & 900  & 200 & 800 & 400 & 2.68
            \\

            & 450 & 500  & 400 & 300 & 250 & 2.76
            \\

            & 750 & 30  & 100 & 20 & 10 & 30
            \\

            & 40 & 80  & 30 & 180 & 120 & 3.06
            \\
            \Xhline{0.25mm}
            \addlinespace
            \Xhline{0.25mm}


            \multirow{5}{0.3cm}{\adjustbox{rotate=90, valign=c, center}{$13.8$ KV}} & \bfseries 969 & \bfseries 998 & \bfseries 1001 & \bfseries 1003 & \bfseries 1000 & \bfseries 1.20
            \\

            & 60 & 20 & 2000 & 1500 & 200 & 1.22
            \\

            & 40 & 30 & 450 & 50 & 30 & 1.42
            \\

            & 95 & 550 & 1400 & 14 & 1700 & 1.60
            \\

            & 200 & 900 & 1017 & 1222 & 3333 & 1.82
            \\
            \Xhline{0.25mm}
            \addlinespace
            \Xhline{0.25mm}

            \multicolumn{4}{c}{\bfseries \color{DeepSkyBlue2} Time Consumed} & \multicolumn{3}{c}{\bfseries \color{DeepSkyBlue2} 8 hours}

            \\
            \bottomrule
        \end{tabularx}
    \end{minipage}
    \hspace{\fill}

\end{table*}

\afterpage{\clearpage}

\blindtext
\blindtext
\blindtext


\section{Conclusions}
\blindtext


\section{Conclusions}
\blindtext


\section{Conclusions}
\blindtext

\end{document}

enter image description here

13
  • 2
    As always on this site please post a full minimal example that others can try. You can replace your images with \rule{width}{height}. As it sits now we have no way of saying anytihng as we don't know your document class, preamble etc
    – daleif
    Commented Sep 10, 2018 at 8:14
  • 1
    I wouldn't use \afterpage in a production document except as a really last resort (and I wrote it) the question you should be asking (and we can not answer from the posted information) is why are your floats going to the end of the document. Commented Sep 10, 2018 at 8:26
  • 2
    with respect to your final comment about inability to make a MWE it is always possible, just start from a copy of your document, delete anything you can delete while still showing the problem then replace every paragraph of text by x\\x\\x\\x\\x\\x (with the right number of lines), and replace every image by \rule{3cm}{4cm} (using the right size for the image) latex will make the same float position decisions so the resulting example will show the problem. Commented Sep 10, 2018 at 8:31
  • 1
    I do not see that when I run your example. also the only reason that the table is not on a float page and so you have to force it on to a float page with \clearpage is that you have explicitly prevented it from being placed on a float page by \begin{table*}[htb] which is the same as \begin{table*}[t] as 2-col floats can not use h or b. Why do you prevent p here?????? Commented Sep 10, 2018 at 8:50
  • 1
    Please use reasonably sized images next time! You don't need 5000x8000 images just to demonstrate extra spacing between paragraphs
    – siracusa
    Commented Sep 10, 2018 at 9:42

2 Answers 2

3

The only reason that you need \clearpage to force the floats on to a float page is that the default positioning has been over-ridden \begin{table*}[htb] which is the same as \begin{table*}[t] as 2-col floats can not use h or b, does nothing other than prevent the table being placed on float pages other than the forced float pages from \clearpage. If you remove this option and remove the \afterpage{\clearpage} you get reasonable positioning:

enter image description here

\documentclass{IEEEtran}

\usepackage[svgnames, x11names]{xcolor}
\usepackage{amsmath}
\usepackage{array}
\renewcommand{\arraystretch}{1.7}

\usepackage{multirow}
\usepackage{caption}
\usepackage{ragged2e}
\usepackage{tabularx}
\newcolumntype{C}{ >{ \arraybackslash \Centering } X }
\usepackage{booktabs}
\usepackage{makecell}
\usepackage{adjustbox}

\usepackage{stackengine}

\newcommand{\stackanchormath}[3][\stackgapSdefaultl]{
    \stackanchor[#1]{$#2$}{$#3$}
}

\newlength{\stackgapSdefaultl}
\setlength{\stackgapSdefaultl}{1.06mm}
\setstackgap{S}{\stackgapSdefaultl}



\usepackage{graphicx}
\usepackage{float}
\usepackage{afterpage}


\usepackage{blindtext}



\begin{document}


\blindtext
\blindtext
\blindtext
\blindtext
\blindtext

\begin{figure*}
    \centering
    \includegraphics[width=0.6\textwidth]{example-image-a}
\end{figure*}

\begin{table*}

    \noindent
    \hspace*{\fill}
    \begin{minipage}{0.45\textwidth}

        % Table options

        % Caption
        \caption{Top five weak combinations of PoIs at different voltage levels identified using the exhaustive search method}
        \label{table:ex_screen_result}

        % Center the table
        \centering

        \begin{tabularx}{1\textwidth}{c ||C C C C C |C}

            \toprule

            & \multicolumn{5}{c|}{\adjustbox{rotate=90, valign=c}{
                    \Shortunderstack{{Reference} {PoI}}
                } \hspace{\fill} \bfseries Combinations of PoIs \hspace{\fill} } &
            \adjustbox{rotate=90}{
                \Shortunderstack{{Min} {SDSCR}}
                                }
            \\
            \Xhline{0.25mm}

            \multirow{5}{0.3cm}{\adjustbox{rotate=90, valign=c, center}{$69$ KV}} & \bfseries 80 & \bfseries 84  & \bfseries 76 & \bfseries 81 & \bfseries 78 & \bfseries 1.77
            \\

            & 52 & 35 & 86 & 70 & 22 & 1.79
            \\

            & 40 & 45  & 80 & 90 & 10 & 1.80
            \\

            & 14 & 11  & 50 & 30 & 20 & 1.83
            \\

            & 18 & 88  & 32 & 02 & 01 & 1.85
            \\
            \Xhline{0.25mm}
            \addlinespace
            \Xhline{0.25mm}

            \multirow{5}{0.3cm}{\adjustbox{rotate=90, valign=c, center}{$34.5$ KV}} & \bfseries 1008 & \bfseries 926  & \bfseries 925 & \bfseries 885 & \bfseries 884 & \bfseries 2.65
            \\

            & 56 & 900  & 200 & 800 & 400 & 2.68
            \\

            & 450 & 500  & 400 & 300 & 250 & 2.76
            \\

            & 750 & 30  & 100 & 20 & 10 & 30
            \\

            & 40 & 80  & 30 & 180 & 120 & 3.06
            \\
            \Xhline{0.25mm}
            \addlinespace
            \Xhline{0.25mm}


            \multirow{5}{0.3cm}{\adjustbox{rotate=90, valign=c, center}{$13.8$ KV}} & \bfseries 969 & \bfseries 998 & \bfseries 1001 & \bfseries 1003 & \bfseries 1000 & \bfseries 1.20
            \\

            & 60 & 20 & 2000 & 1500 & 200 & 1.22
            \\

            & 40 & 30 & 450 & 50 & 30 & 1.42
            \\

            & 95 & 550 & 1400 & 14 & 1700 & 1.60
            \\

            & 200 & 900 & 1017 & 1222 & 3333 & 1.82
            \\
            \Xhline{0.25mm}
            \addlinespace
            \Xhline{0.25mm}

            \multicolumn{4}{c}{\bfseries \color{DeepSkyBlue2} Time Consumed} & \multicolumn{3}{c}{\bfseries \color{DeepSkyBlue2} 8 hours}

            \\
            \bottomrule
        \end{tabularx}
    \end{minipage}
    \hspace{\fill}
    \begin{minipage}{0.45\textwidth}

        % Table options

        % Caption
        \caption{Top five weak combinations of PoIs at different voltage levels identified using the exhaustive search method}
        \label{table:ex_screen_result}

        % Center the table
        \centering

        \begin{tabularx}{1\textwidth}{c ||C C C C C |C}

            \toprule

            & \multicolumn{5}{c|}{\adjustbox{rotate=90, valign=c}{
                    \Shortunderstack{{Reference} {PoI}}
                } \hspace{\fill} \bfseries Combinations of PoIs \hspace{\fill} } &
            \adjustbox{rotate=90}{
                \Shortunderstack{{Min} {SDSCR}}
                                }
            \\
            \Xhline{0.25mm}

            \multirow{5}{0.3cm}{\adjustbox{rotate=90, valign=c, center}{$69$ KV}} & \bfseries 80 & \bfseries 84  & \bfseries 76 & \bfseries 81 & \bfseries 78 & \bfseries 1.77
            \\

            & 52 & 35 & 86 & 70 & 22 & 1.79
            \\

            & 40 & 45  & 80 & 90 & 10 & 1.80
            \\

            & 14 & 11  & 50 & 30 & 20 & 1.83
            \\

            & 18 & 88  & 32 & 02 & 01 & 1.85
            \\
            \Xhline{0.25mm}
            \addlinespace
            \Xhline{0.25mm}

            \multirow{5}{0.3cm}{\adjustbox{rotate=90, valign=c, center}{$34.5$ KV}} & \bfseries 1008 & \bfseries 926  & \bfseries 925 & \bfseries 885 & \bfseries 884 & \bfseries 2.65
            \\

            & 56 & 900  & 200 & 800 & 400 & 2.68
            \\

            & 450 & 500  & 400 & 300 & 250 & 2.76
            \\

            & 750 & 30  & 100 & 20 & 10 & 30
            \\

            & 40 & 80  & 30 & 180 & 120 & 3.06
            \\
            \Xhline{0.25mm}
            \addlinespace
            \Xhline{0.25mm}


            \multirow{5}{0.3cm}{\adjustbox{rotate=90, valign=c, center}{$13.8$ KV}} & \bfseries 969 & \bfseries 998 & \bfseries 1001 & \bfseries 1003 & \bfseries 1000 & \bfseries 1.20
            \\

            & 60 & 20 & 2000 & 1500 & 200 & 1.22
            \\

            & 40 & 30 & 450 & 50 & 30 & 1.42
            \\

            & 95 & 550 & 1400 & 14 & 1700 & 1.60
            \\

            & 200 & 900 & 1017 & 1222 & 3333 & 1.82
            \\
            \Xhline{0.25mm}
            \addlinespace
            \Xhline{0.25mm}

            \multicolumn{4}{c}{\bfseries \color{DeepSkyBlue2} Time Consumed} & \multicolumn{3}{c}{\bfseries \color{DeepSkyBlue2} 8 hours}

            \\
            \bottomrule
        \end{tabularx}
    \end{minipage}
    \hspace{\fill}

\end{table*}



\blindtext
\blindtext
\blindtext


\section{Conclusions}
\blindtext


\section{Conclusions}
\blindtext


\section{Conclusions}
\blindtext

\end{document}
5
  • This worked with the MWE but not my original code. I added a picture showing where the tables go when I let them float as LaTeX wants. Sometime my document gets crowded with tables, figures, and equations that are very close to each other, and LaTeX pushes them to the end even when requesting h positioning or reducing the floats sizes. Commented Sep 10, 2018 at 9:10
  • 1
    @Al-MotasemAldaoudeyeh using "h" as option makes it harder for latex to find a suitable place. Better use ! or change the float parameters. See e.g. texfaq.org/FAQ-floats Commented Sep 10, 2018 at 9:26
  • 1
    @UlrikeFischer I just solved it by placing finding better placement of the tables and figures source codes. I still, however, would like to know why \clearpage inserts the empty spaces in the page that follows the float page. Is that a bug in LaTeX or float package? @David Charlisle. I did not know that t and b placements are meaningless in two-column documents unless there is a float page. Thank you Commented Sep 10, 2018 at 9:37
  • @Al-MotasemAldaoudeyeh using [h] on a single column float makes it almost certain the float goes to the end of the document, h and b are not "meaningless unless ther is a float page, they are always ignored, h has no possible meaning for a 2-col float and b is not supported by default although there are some packages that support that) Commented Sep 10, 2018 at 9:54
  • 1
    @Al-MotasemAldaoudeyeh we can only answer the questions as asked, if your MWE does not show the problem you should change the MWE (It has no bad space even as posted in your question) but for your real document, first make sure that every figure or table that has an optional argument includes p in the options. Doing anything else makes it impossible for latex to make float pages and will force most floats to the end of the document. Commented Sep 10, 2018 at 10:02
1

I got the same problem with an IEEE journal template. I tried to replace the \clearpage by %\vspace*{size} but that was working only in one column. So I tried to switch the mode to add the space and found out that just this (without the space):

\onecolumn
\twocolumn

Is sufficient to create the new page (put it there instead of the \clearpage attempts).

What also kind of worked was encapsulating the problematic sections in \vbox and eventually positioning them to the possible blank space with %\vspace*{-size}.

Other solutions with positioning of the other objects, flushing and new page commands were not working at all for me.

You must log in to answer this question.

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