改進了自動預分頁符號確定

改進了自動預分頁符號確定

我希望一個特定的節宏能夠在其正上方自動部署分頁符,當且僅當它放置得太靠近頁面底部時。這裡的「太接近」意味著沒有足夠的空間在同一頁上排版該部分的第一個條目。

我使用以下兩個環境之一來處理我的切片,從“中等長度專業”履歷resume.cls:

% Defines the rSection environment for the large sections within the CV
\newenvironment{rSection}[1]{ % 1 input argument - section name
  \sectionskip
  \MakeUppercase{\bf #1} % Section title
  \sectionlineskip
  \hrule % Horizontal line
  \begin{list}{}{ % List for each individual item in the section
    \setlength{\leftmargin}{1.5em} % Margin within the section
  }
  \item[]
}{
  \end{list}
}

\newenvironment{rSection*}[2]{ % 2 input arguments - section name and parenthetical
  \sectionskip
  \MakeUppercase{\bf #1} % Section title
  {\bf (#2)} % parenthetical
  \sectionlineskip
  \hrule % Horizontal line
  \begin{list}{}{ % List for each individual item in the section
    \setlength{\leftmargin}{1.5em} % Margin within the section
  }
  \item[]
}{
  \end{list}
}

我想修改這些以防止下面描述的問題,沒有\pagebreak[N]任何簡單或命令的使用\enlargethispage{k},這對於我的大多數用例來說是不夠的。我也不希望將我的程式碼重構為更新的程式碼現代履歷–型別類別。

所描述的分頁問題的範例。

請注意,上圖中的小灰線表示目前分頁符號。在這個範例中,標題為「國際合作活動」的部分應該會自動移至下一頁,其中包含其第一個條目 ( $C_{1}$)。

(注意,我希望避免必須提供 MWE。如果幾天后沒有人決定提出任何建議,我將提供一個。)

答案1

謝謝大衛卡萊爾的很好的使用建議needspace(我以前不知道),我已經解決了這個問題(對於rSection)。

下面的補丁就夠了:

\patchcmd{\rSection}{\sectionskip}{\sectionskip \needspace{6em}}{}{}

相關內容