且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

如何防止错误的分页符并防止文本跑出页面

更新时间:2023-12-02 08:07:04

我从所附的图片中注意到,您有许多个接一个的章节.胶乳的默认行为是永不中断两个标题,因此问题不在于您提供的序言:这是胶乳的功能.

I notice from your attached picture that you have a number of sections one after another. The default behavior in latex is to never break between two headings, so the problem is not the preamble you supplied: it is a feature of latex.

在标题之间添加文本可以使页面正常"中断,如果需要强制分页,可以在两个 \ section 命令之间手动插入 \ pagebreak

Adding text in between headings allows the page to break 'normally' and if you need to force a pagebreak you can manually insert \pagebreak in between two \section commands.

在下面的代码中,我们可以看到一个示例.取消注释任一注释行会导致分页符:

In the following code, we can see an example of this. Uncommenting either of the commented lines causes a pagebreak:

\documentclass{article}                                                         

\begin{document}                                                                

\section{Section 1}                                                             
 \vspace{21cm}                                                                  
 \subsection{Subsection 1}                                                      
 \section{Section 2}                                                            
% Your text here.                                                               
% \pagebreak                                                                    
 \subsection{Subsection 2}                                                      
 \subsection{Subsection 3}                                                      
 \subsection{Subsection 4}                                                      

\end{document}  

有一个非常相似的问题

There is a very similar question here, which suggests using the \Needspace command before sections that might fall off the bottom of the page.