Is there a way to give LaTeX a hint on the maximum number of pages I would like the document to have, so LaTeX at least tries to not exceed this maximum if possible?
Go with the pt option of \documentclass available for most of the document classes. Reduce space in lists. Also, don't forget the \tightlists , \firmlists , \firmlists* commands in memoir class.
Overleaf is free to use, while the paid subscription plans allow larger projects to compile, with a higher timeout limit. * Some larger files may remain editable under certain circumstances. To ensure that a file remains editable, please limit its size to 1MB or less. † There is no enforced limit on total project size.
While you can't make a "suggested" page length, you can enforce a page limit where any pages past the limit will not print. Here's an example of a command you can create in your preamble to do this:
\makeatletter
\newcounter{pagecount}
\newcommand{\limitpages}[1]{
\setcounter{pagecount}{0}%
\gdef\maxpages{#1}%
\ifx\latex@outputpage\@undefined\relax%
\global\let\latex@outputpage\@outputpage%
\fi%
\gdef\@outputpage{%
\addtocounter{pagecount}{1}%
\ifnum\value{pagecount}>\maxpages\relax%
% Do not output the page
\else%
\latex@outputpage%
\fi%
}%
}
\makeatother
No. LaTeX optimizes text at page level but not document level. So there is no way to automatically squeeze the text into a maximum number of pages. However, there are lots of ways to squeeze things in order to reduce the number of pages. See this blog post on "Squeezing space with LaTeX".
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With