How to prevent an errant page break and prevent text from running off the page [closed]

柔情痞子 提交于 2019-12-13 08:31:51

问题


I have an oddly forced page break that...

seems to force the rest of the headings and pages off the end of the next page

What code will force the next heading to continue without a page break? The offending page doesn't really have any code on it aside from section/subsections and citations. So is it possible there is a package conflict? The only errors are overfull/underfull vbox or hbox.

Preamble and main document code is currently as follows:

\documentclass[12pt,a4paper]{article}
\setcounter{secnumdepth}{0}
\usepackage[english]{babel}
\usepackage[utf8]{inputenc}

% Protrusion
\usepackage{microtype}

% Header
\usepackage{fancyhdr}
\fancyhf{}
\lhead{RUNNING HEAD}
\rhead{\thepage}
\setlength{\headheight}{15pt}

% URLs and PDF
\usepackage{url}
\usepackage[bookmarks, colorlinks=false, pdfborder={0 0 0}, pdftitle=
{PDF Title}, pdfauthor={Author Name}, pdfsubject={Psychology}, 
pdfkeywords={keywords, listed here}, {pdfpagelabels}]{hyperref} 

% graphics
\usepackage[pdftex]{graphicx}
\graphicspath{{./images/}}

% Title Page
\title{Title}
\author{Author Name}

% APA Style package
\usepackage[tocbib, bibnewpage, nodoi]{apacite}

\begin{document}
\pagenumbering{Alph}
\input{title}
\newpage
\pagenumbering{arabic}
\tableofcontents
\newpage
\input{abstract}
\newpage
\input{prob-definition}
\newpage
\input{topic}
\input{topic}
\input{topic}
\input{topic}
\input{topic}
\input{topic}
\input{topic}
\input{topic}
\input{topic of page with errant page break}
\input{page running off the bottom}
\input{topic - missing}
\input{topic - missing}
\input{topic - missing}
\newpage
\input{bibliography}
\end{document}          

Thank you very much


回答1:


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.

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.



来源:https://stackoverflow.com/questions/48456392/how-to-prevent-an-errant-page-break-and-prevent-text-from-running-off-the-page

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!