2

I'm using LaTeX to typeset a legal contract (trust indenture) using book and I'm using chapters for each major section of the contract but it's sometimes leaving big gaps of empty space at the end of the said chapters.

I've searched the archives of stack exchange and even asked an LLM and no luck. The postings in here are all about putting some kind of centered message in blank PAGES saying something like "THIS PAGE INTENTIONALLY BLANK" but I also need something like that for a blank space that exceeds say 2 inches in height.

Can anyone help me?

1 Answers1

1

After an initial misinterpretation of the question, I have revised my answer to achieve "Intentionally blank" message for those cases where a twoside document leaves a blank page before a new chapter (with the macro \gotooddpage). I also provide the macro \finishonevenpage to achieve the same effect at the end of the document.

With the additional use of \pretocmd and \AtEndDocument, I can achieve the execution of \gotooddpage and \finishonevenpage automatically, without intervention from the user.

Adding the message to partially full end-of-chapter pages, but only when there is significant (>2in) blank space, is achieved using an approach similar to this question: Measure remaining space on page and use it on another page.

\documentclass[twoside]{book}
\usepackage{changepage}% TO MAKE SURE CERTAIN THINGS START ON ODD PAGE #
% MACRO TO GO TO ODD PAGE, INSERTING "INTENTIONALLY LEFT BLANK" IF NEEDED
\newcommand\gotooddpage{\clearpage%
  \checkoddpage\ifoddpage\else\blankpage\fi\clearpage}
% MACRO TO FINISH ON EVEN PAGE, INSERTING "INTENTIONALLY LEFT BLANK" IF NEEDED
\newcommand\finishonevenpage{%
  \clearpage\checkoddpage\ifoddpage\else\blankpage\fi}
\newcommand{\blankpage}{%
  \clearpage
  \begin{center}
    {\textsc{\rule{0em}{4.5in}Intentionally left blank.}}
  \end{center}
}
\def\measurepage{\the\dimexpr\pagegoal-\pagetotal-\baselineskip\relax}
\newcommand\finishthispage{\ifnum\value{chapter}=0\else
  \ifdim\measurepage>2in\relax
    \vfill\centerline{\textsc{Intentionally left blank}}\vfill\clearpage
  \fi%
\fi}
\usepackage{lipsum}
\usepackage{etoolbox}
\pretocmd{\chapter}{\finishthispage\gotooddpage}{}{}
\AtEndDocument{\finishthispage\finishonevenpage}
\begin{document}
\chapter{First Chapter} 
\lipsum[1-3] % some text 
%\gotooddpage only needed manually if no \pretocmd used on \chapter
\chapter{Second Chapter} 
\lipsum[4-10] % some text 
\chapter{Third Chapter} 
\lipsum[11-20] % some more text
%\finishonevenpage only needed manually if no \AddEndDocument used
\end{document}

enter image description here

enter image description here

enter image description here

  • Thanks, that does look useful. Since it's been many decades since I did much LaTex, can you adapt this to just automatically run at the end of every chapter of a book type document? I tried to get an LLM to do it and it really just royally screwed it (and the whole rest of the document) up.

    in the next post is what it came up with

    – VigilanceTech.com Feb 22 '24 at 00:40
  • \documentclass[twoside]{book} \usepackage{etoolbox} \usepackage{lipsum} % for dummy text \def\measurepage{\the\dimexpr\pagegoal-\pagetotal-\baselineskip\relax} \newcommand\finishchapter{\vfill \ifdim\measurepage>2in\relax \centerline{THIS PAGE INTENTIONALLY LEFT BLANK}\fi% \vfill\cleardoublepage} \appto{\chapter}{\finishchapter} \begin{document} \chapter{First Chapter} \lipsum[1-10] % some text \chapter{Second Chapter} \lipsum[11-20] % some more text \end{document} – VigilanceTech.com Feb 22 '24 at 00:40