I use LaTeX to generate contracts and agreements. In most cases, it works okay but, every so often, it causes problems with pagination; specifically, if I have too many subsections without an explicit \newpage
.
This is an issue because, every time I edit or add a subsection I end up having to manually repaginate the entire document which sort of defeats the object of using Latex.
There's nothing particularly fancy about the following LaTeX definition but, if you compile it, you'll notice two problems:
There's a completely unnecessary page break after "In this Agreement, unless clearly inconsistent with or otherwise indicated by the context :"
There's an overfull
\vbox
at (plus or minus) subsection 3.26 and, without a manual\newpage
, I can't stop it "eating" the rest of the document
\documentclass{article}
\usepackage{fontspec}
\usepackage{setspace}
\usepackage{url}
\usepackage[top=2.0cm, bottom=2.0cm, left=2.0cm, right=2.0cm]{geometry}
\usepackage{listings}
\usepackage[english]{babel}
\usepackage{float}
\usepackage[final]{pdfpages}
\usepackage{graphicx,type1cm,eso-pic,color}
\usepackage{fancyhdr}
\usepackage{lscape}
\usepackage{color}
\usepackage[pageatnewline]{titlesec}
\titleformat{\section}{\normalfont\Large\bfseries}{\thesection}{1em}{}
\titleformat{\subsection}{\normalfont\normalsize}{\thesubsection}{1em}{}
\titleformat{\subsubsection}{\normalfont\normalsize}{\thesubsubsection}{1em}{}
\titleformat{\paragraph}{\normalfont\normalsize}{\theparagraph}{1em}{}
\titleformat{\subparagraph}{\normalfont\normalsize}{\thesubparagraph}{1em}{}
\titlespacing*{\section} {0pt}{3.5ex plus 1ex minus .2ex} {2.3ex plus .2ex}
\titlespacing*{\subsection} {0pt}{3.25ex plus 1ex minus .2ex}{1.5ex plus .2ex}
\titlespacing*{\subsubsection}{0pt}{3.25ex plus 1ex minus .2ex}{1.5ex plus .2ex}
\titlespacing*{\paragraph} {0pt}{3.25ex plus 1ex minus .2ex}{1.5ex plus .2ex}
\titlespacing*{\subparagraph} {0pt}{3.25ex plus 1ex minus .2ex}{1.5ex plus .2ex}
\newcommand\blah{blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah}
\setcounter{secnumdepth}{7}
\begin{document}
\setcounter{section}{0}
\newlength{\tabheight}
\setlength{\tabheight}{1.0cm}
\newpage
\pagenumbering{arabic}
\pagestyle{plain}
\section{PARTIES}
\subsection {A registered company. Registration Number: "***********", and}
\subsection {Another registered company. Registration Number: \textbf{"(***************)"}}
\section{RECITALS}
\textbf{NOW, THEREFORE, IN CONSIDERATION OF THE MUTUAL COVENANTS AND PROMISES CONTAINED HEREIN AND FOR GOOD AND VALUABLE CONSIDERATION, THE RECEIPT AND SUFFICIENCY OF WHICH IS HEREBY ACKNOWLEDGED, THE PARTIES HEREBY AGREE AS FOLLOWS:}
\subsection {Statements pertaining to the agreement.}
\subsection {More statements pertaining to the agreement.}
\subsection {\blah{}.}
\subsection {\blah{}}
\subsubsection {\blah{}}
\subsubsection {\blah{}}
\subsubsection {\blah{}}
\subsubsection {\blah{}}
\subsection {\blah{}.}
\subsection {\blah{}.}
\subsection {\blah{}.}
\subsection {\blah{}.}
\section{DEFINITIONS AND INTERPRETATION}
\subsection {DEFINITIONS}
\textbf{In this Agreement, unless clearly inconsistent with or otherwise indicated by the context :}
\subsection {"DEFINITION" means whatever we want it to mean \blah{};}
\subsection {"DEFINITION" means whatever we want it to mean \blah{};}
\subsection {"DEFINITION" means whatever we want it to mean \blah{};}
\subsection {"DEFINITION" means whatever we want it to mean \blah{};}
\subsection {"DEFINITION" means whatever we want it to mean \blah{};}
\subsection {"DEFINITION" means whatever we want it to mean \blah{};}
\subsection {"DEFINITION" means whatever we want it to mean \blah{};}
\subsection {"DEFINITION" means whatever we want it to mean \blah{};}
\subsection {"DEFINITION" means whatever we want it to mean \blah{};}
\subsection {"DEFINITION" means whatever we want it to mean \blah{};}
\subsection {"DEFINITION" means whatever we want it to mean \blah{};}
\subsection {"DEFINITION" means whatever we want it to mean \blah{};}
\subsection {"DEFINITION" means whatever we want it to mean \blah{};}
\subsection {"DEFINITION" means whatever we want it to mean \blah{};}
\subsection {"DEFINITION" means whatever we want it to mean \blah{};}
\subsection {"DEFINITION" means whatever we want it to mean \blah{};}
\subsection {"DEFINITION" means whatever we want it to mean \blah{};}
\subsection {"DEFINITION" means whatever we want it to mean \blah{};}
\subsection {"DEFINITION" means whatever we want it to mean \blah{};}
\subsection {"DEFINITION" means whatever we want it to mean \blah{};}
\subsection {"DEFINITION" means whatever we want it to mean \blah{};}
\subsection {"DEFINITION" means whatever we want it to mean \blah{};}
\subsection {"DEFINITION" means whatever we want it to mean \blah{};}
\subsection {"DEFINITION" means whatever we want it to mean \blah{};}
\subsection {"DEFINITION" means whatever we want it to mean \blah{};}
\subsection {"DEFINITION" means whatever we want it to mean \blah{};}
\subsection {"DEFINITION" means whatever we want it to mean \blah{};}
\subsection {"DEFINITION" means whatever we want it to mean \blah{};}
\subsection {"DEFINITION" means whatever we want it to mean \blah{};}
\subsection {"DEFINITION" means whatever we want it to mean \blah{};}
\subsection {"DEFINITION" means whatever we want it to mean \blah{};}
\subsection {"DEFINITION" means whatever we want it to mean \blah{};}
\subsection {"DEFINITION" means whatever we want it to mean \blah{};}
\subsection {"DEFINITION" means whatever we want it to mean \blah{};}
\subsection {"DEFINITION" means whatever we want it to mean \blah{};}
\subsection {"DEFINITION" means whatever we want it to mean \blah{};}
\subsection {"DEFINITION" means whatever we want it to mean \blah{};}
\subsection {"DEFINITION" means whatever we want it to mean \blah{};}
\subsection {"DEFINITION" means whatever we want it to mean \blah{};}
\subsection {"DEFINITION" means whatever we want it to mean \blah{};}
\subsection {"DEFINITION" means whatever we want it to mean \blah{};}
\subsection {"DEFINITION" means whatever we want it to mean \blah{};}
\subsection {"DEFINITION" means whatever we want it to mean \blah{};}
\subsection {"DEFINITION" means whatever we want it to mean \blah{};}
\subsection {"DEFINITION" means whatever we want it to mean \blah{};}
\subsection {"DEFINITION" means whatever we want it to mean \blah{};}
\subsection {"DEFINITION" means whatever we want it to mean \blah{};}
\subsection {"DEFINITION" means whatever we want it to mean \blah{};}
\subsection {"DEFINITION" means whatever we want it to mean \blah{};}
\subsection {"DEFINITION" means whatever we want it to mean \blah{};}
\subsection {"DEFINITION" means whatever we want it to mean \blah{};}
\subsection {"DEFINITION" means whatever we want it to mean \blah{};}
\subsection {"DEFINITION" means whatever we want it to mean \blah{};}
\subsection {"DEFINITION" means whatever we want it to mean \blah{};}
\subsection {"DEFINITION" means whatever we want it to mean \blah{};}
\subsection {"DEFINITION" means whatever we want it to mean \blah{};}
\subsection {"DEFINITION" means whatever we want it to mean \blah{};}
\subsection {"DEFINITION" means whatever we want it to mean \blah{};}
\subsection {"DEFINITION" means whatever we want it to mean \blah{};}
\subsection {"DEFINITION" means whatever we want it to mean \blah{};}
\section{INTERPRETATION}
\subsection {In this Agreement, unless clearly inconsistent with or otherwise indicated by the context:}
\subsubsection {Any reference to the singular includes the plural and vice versa;}
\subsubsection {Any reference to natural persons includes legal persons and vice versa; and any reference to a gender includes the other gender;}
\subsubsection {Where appropriate, meanings ascribed to defined words and expressions in the above paragraph's, shall impose substantive obligations on the Parties;}
\subsubsection {The clause headings in this Agreement have been inserted for convenience only and shall not be taken into account in its interpretation;}
\subsubsection {Words and expressions defined in any sub-clause shall, for the purposes of the clause of which that sub-clause forms part, bear the meanings assigned to such words and expressions in that sub-clause;}
\subsubsection {This Agreement is governed by and construed and interpreted in accordance with the laws of the Territory and shall be binding on successor in title;}
\subsubsection {Unless specifically otherwise provided, all amounts in this agreement are exclusive of value-added tax;}
\end{document}
I've tried messing around with the widow/orphan control and pageatnewline in the titlesec
parameter but nothing seems to stop the compiler from putting everything on one page.
All I'm after really is automated section numbering and automated references/labels. Maybe there's a better way to do this without having to write my own formatter.
However, for the moment, I'd just like to know how to make the compiler put a page break in if a section header goes over the end of a page.