为什么 LaTeX 会在由 \clearpage 命令生成的浮动页面后自动插入不需要的空格?

为什么 LaTeX 会在由 \clearpage 命令生成的浮动页面后自动插入不需要的空格?

我有一篇论文,其中有三个大浮点数,在编译源代码时它们会移动到文档的末尾,它们的位置根据我更新内容的方式而变化,但有时它们甚至会移动到参考文献列表的中间。

在此处输入图片描述

因此,我使用\afterpage{\clearpage}强制浮动元素进入合理位置的命令。但是,放置此类命令后,浮动元素页面后会出现一些空白。我曾经\vspace{-<some number>\baselineskip}插入负空间。但是,这样做并不好,原因有二:

  1. 随着文档的多次修改,空白处也随之变化。因此,负空间可能不够,也可能造成内容的重叠。
  2. 参考文献是使用 自动生成的\bibliography{*.bib},因此,我无法删除参考文献标题和参考文献列表之间的空格。

我正在使用IEEEtran文档类

下面是我在填充当前页面时强制浮动页面的方法(这对于浮动页面之前的页面很有效)

在此处输入图片描述

这是我的浮动页面 在此处输入图片描述

浮动页面后 在此处输入图片描述

平均能量损失

\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}

在此处输入图片描述

答案1

您需要强制将浮动元素放到浮动页面上的唯一原因\clearpage是默认定位已被覆盖,\begin{table*}[htb]这与 2 列浮动元素不能使用 h 或 b 相同\begin{table*}[t],除了阻止将表放置在强制浮动页面以外的浮动页面上之外,没有其他作用\clearpage。如果您删除此选项并删除,\afterpage{\clearpage}您将获得合理的定位:

在此处输入图片描述

\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}

答案2

我在使用 IEEE 期刊模板时也遇到了同样的问题。我尝试替换 by,\clearpage%\vspace*{size}只在一列中起作用。因此,我尝试切换模式以添加空格,结果发现只有这个(没有空格):

\onecolumn
\twocolumn

创建新页面就足够了(把它放在那里而不是\clearpage尝试)。

另一种有效的方法是将有问题的部分封装起来,\vbox并最终将它们定位到可能的空白处%\vspace*{-size}

其他解决方案,包括定位其他对象、刷新和新页面命令对我来说根本不起作用。

相关内容