章节间距忽略位于顶部的数字

章节间距忽略位于顶部的数字

IIUC,通常情况下,如果部分不是列/页面中的第一个部分,则部分只会在其前面添加垂直空间。令我惊讶的是,在之后它的行为相同\begin{figure}[t] ... \end{figure}。有没有办法让部分像对待其他任何东西一样对待这些数字?IE使下面的第 2 列更像第 3 列,而不影响第 1 列?

第 1-2 列:

pdf 输出第 1 页

第 3-4 列:

pdf 输出第 2 页

梅威瑟:

\documentclass[twocolumn]{article}
\usepackage{graphicx}
\usepackage{tikz}
\usepackage{lipsum}

\makeatletter
\renewcommand\section{\@startsection{section}{1}{\z@}%
    {-5\baselineskip}% this does not get applied after figures
    {\baselineskip}%
    {\Huge}
}
\makeatother

\setlength{\abovecaptionskip}{0.5\baselineskip}
\setlength{\belowcaptionskip}{0.5\baselineskip}
\setlength{\textfloatsep}{0sp}

\providecommand\image[1]{
    \begin{figure}[t]%
        \begin{tikzpicture}
            \draw (0,0) -- (8,0) -- (8,4) -- (0,4) -- (0,0);
        \end{tikzpicture}
        \caption{\textbf{#1}}%
    \end{figure}%
}

\begin{document}

\image{Good. A normal paragraph is nice and close to the caption.}
\lipsum[1]

\newpage
\image{Bad. A title should have space no matter what comes before it.}
\section{This title has almost no space before it}

\newpage
\lipsum[2]
\section{This title has much more space before it}
\textbf{Good. This is how a title usually adds space when anything is preceding it.}

\newpage
\section{This title rightly has no space before it}
\textbf{Good. There is nothing above the title in this column.}

\end{document}

相关内容