I'd like to be able to control the behavior of latex indirectly. Let me try to explain what I mean. I've got a large document, generated by a program. We can assume that each page (or page group) includes
\oversize{12}
or \oversize{22}
, or something similar, where the 12
and 22
are section indicators, and \oversize
is a macro I'll be writing. My goal is for \oversize
to do nothing in general, but to evaluate to \enlargethispage{3\baselineskip}
in special cases.
I'd like to describe these special cases in either a text file, which might look like
5
37
289
to indicate that for those particular pages, I need to enlarge the page, or might look like
\newcommand{\bigpages}{5 37 289}
or something like that.
The key thing is to be able to indicate which pages/page-groups need enlarging in some way AFTER the latex file has been produced. (The preamble of the produced latex document can input
or include
the relevant list of pages.)
I don't understand enough of TeX/LaTeX as a programming language to know what kinds of constructs are available for this. In most languages, I'd do something silly like make an array or list of page-groups that need fixing, and if the argument to \oversize
appeared in the list, I'd emit the \enlargethispage
command, and otherwise would emit nothing.
We're talking here about a 500 page document in which something like 8 pages are going to be enlarged, so a O(nk) solution, where n is the number of pages and k is the number of enlargements, is totally OK. Can someone point me in the right direction?
\usepackage{xstring} \usepackage{everypage} \newcommand{\bigpages}{ 5 37 289 } \AddEverypageHook{% \IfSubStr{\bigpages}{ \thepage\space}{\enlargethispage{3\baselineskip}}{}% }
almost works. It correctly sees which page to enlarge. But it doesn't actually enlarge the page.