11

I've been using TeX for a while, so when I suggested my company compile its daily newsletter using LaTex, rather than an hour and a half of someone's time, I got tasked with actual implementation. I'm near done, but because the data is generated dynamically - I'm not sure exactly how much text is going to be generated an placed into each article. I've use \vspace{\fill} to strategically deal with an undersized newsletter - but I can't figure out what to do in the case of an oversized one.

Is there a way to force TeX to compile into a single page, every time? I mean, I'd rather (honest to god) just have the text cut off the way it does horizontally.

I found this this incredibly similar question, and tried everything listed there. I've looked into samepage, but that environment just breaks the page anyway after a while. Additionally, \parbox was suggested - but when I wrapped the whole document in that, an overfull box it just caused it to break the page before. needspace will do the same thing.

I've been developing this process over the last few days, periodically breaking to spend hours searching the Google Box or StackExchange for answers, to no avail. Anyone?

1

2 Answers 2

8

If you're happy just truncating the bottom of the content, then you can force into a minipage:

\documentclass{article}
\usepackage{lipsum}
\begin{document}
\begin{minipage}[t][0pt]{\linewidth}
\lipsum[1-100]
\end{minipage}
\end{document}

But notice how I set the height of the minipage to zero. This makes it stay on page one.

Is your company really going to be impressed with LaTeX if you truncate things?

Provided that you know your newsletter is never going to be longer than 2-3 pages. There is probably a way you work around this. I'm thinking that you don't set the height of the minipage, save its height to a minipage, the run latex again reading in the value of the minipage's height and set the height of the document's page to the same value. I'm not sure I know how to do such an elaborate work-around, but I'm sure if you post a question

How do I define the dimensions of a page to accommodate its contents: even if unusually large?

someone will come up with an interesting solution. Of course, such a solution only makes sense if the newsletter is something only posted electronically and not printed.

OR

If you know the contents are only be slightly larger than the page, you can use graphicx package and rescale the box so it does in fact fit on the page.

For example:

\documentclass{article}
\usepackage{graphicx}
\usepackage{calc}
%% for demo purposes only
\usepackage{showframe}
\usepackage{lipsum}
\begin{document}
\noindent\scalebox{.94}{%
\begin{minipage}[t]{1.06\linewidth}
\lipsum[1-6]
\end{minipage}}
\end{document}

This is a document for which \enlargethispage wouldn't suffice. But by selecting appropriate values for the scale factor and the \linewidth (I chose near reciprocals), you can get something fairly decent looking.

3
  • The unfortunate truth is that I can't make guarantees about pretty much anything, and this is meant to be distributed electronically as well as being printed and posted, alternate page sizes aren't really an option. I chose to truncate it based on some additional problems, and I have some alternate compile scripts that pull longer or shorter previews of the articles for fine tuning. This is a V1, and I'm sure I'll be making more changes as I have time in the future - but that's the design choice. Thanks for the solution! Jan 30, 2013 at 15:11
  • The minipage solution seems to shift all content slightly to the right...
    – Jasha
    Dec 15, 2015 at 4:37
  • 1
    @Jasha Probably could use a \noindent to prevent paragraph indentation from happening.
    – A.Ellett
    Dec 15, 2015 at 13:57
2

You can use the savetrees package to shrink your document.

There are 3 modes: subtle, moderate and extreme. It is recommended to try subtle mode first before trying other modes.

\usepackage[subtle]{savetrees}

% rest of your LaTex document...

See the documentation for further details.

Interestingly, it is used by PHD students to make their papers fit under the page limit. That article contains many more wonderful tricks about document shrinking.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .