# Stop LaTeX adjusting vertical spacing when fitting more text onto a page

I need to place two pieces of paper side-by-side. Each piece of paper is a printout of a compiled LaTeX document. The second document starts in an identical way to the first, but has more text inserted below. I'd like the lines/images/bullet points/table cells to line up in the parts of the document that are the same.

Here is a minimal example. The two documents are side-by-side. The one on the right starts in the same way as the one on the left. I've added some red lines to guide the eye in examining the vertical gaps in which I'm interested.

To my eye, roughly, here are the things I notice:

• The inter-line spacing in each paragraph remains roughly constant. This is what I want.
• The spacing between paragraphs on the right is slightly less than the spacing between paragraphs on the left (\parskip is set to \medskipamount). I'd like this to be the same.
• The spacing above the first item in the list on the left is very much greater than the same spacing on the right. I'd like this to be the same.
• I can't tell whether or not the spacing between items in the list is the same.
• I can't tell whether or not the spacing above/below the image is the same.
• I haven't tried a table in this example, and I'm not sure whether row height would be adjusted or not.

What I'd like to do: set all the vertical spacings so that they're the same on the left or right. As I understand it, this will involve fixing to a constant value:

• the inter-paragraph space
• the space above and below a list
• the inter-item space in a list
• the space above and below a float
• the space above and below a listing
• the space above and below an image
• the space above and below a table
• the row height in tables
• the space when starting/ending an environment (if any)

I don't know whether or not this list is exhaustive, but I think it covers all my use cases.

From what I've read, each length in LaTeX has a plus/minus amount, and I need to set this to 0 for all vertical spaces. However, I don't know the best way to achieve this, and I don't know the name of each length that I need to set, or whether there's a way to set all vertical lengths at once. Setting them all at once would be better, because it would mean that I didn't miss out any variables that I don't know about.

I know that LaTeX adjusting the spaces leads to the most typographically pleasing result in 99.99% of cases, but I really do need everything lined up for my application. This may lead to an excessively large amount of blank space at the end of a page, which I don't mind. I'd almost like to be able to control whether LaTeX splits the last paragraph on the page over the page boundary, or just moves the whole paragraph to the next page (by adjusting a penalty or the like).

I also note that the setspace package has a \setstretch command, but I don't understand fully what this does, and which lengths are set/not set.

The final option would be to allow LaTeX to adjust the spaces in the longer document as it desired, and then feed this information back into the compilation of the shorter document, so that each space is the same in this. Is there any way I could achieve this option?

I don't think this question is a duplicate, since I haven't been able to find the answer through several searches, but please point me to the original if it is and accept my apologies. It's possible that I can't find the correct search term.

• The "plus/minus amount" is called `glue`. Take a look at `\abovedisplayskip`, `\belowdisplayskip`, `\abovedisplayshortskip` and `\belowdisplayshortskip` if you have equations. For figures, look at `\floatsep` (see this answer) – Scz Jul 22 '15 at 12:25
• Using `\raggedbottom` will surely help. In any case, you need to set many skips to be rigid. – Manuel Jul 22 '15 at 12:42
• Thanks both so far! Is there somewhere that I can find a list of these skips? They seem to all be documented separately. A flick through Lamport's book and the LaTeX Companion hasn't yielded a suitable list, but it's possible I'm looking in the wrong place. – Froskoy Jul 22 '15 at 12:44
• these skips are usually defined in the document class. you could make a start by looking into whatever`.cls` file you're using and redefine them by copying the definitions into your preamble and omitting the "plus" and "minus" components. – barbara beeton Jul 22 '15 at 15:26

It depends on your use case, but there are packages for this kind of task. E.g., `paracol.sty` (asymmetric column widths to show the effect):

Maybe it's not very professional, but I would use

``````\phantom{what you don't want to see}
``````

for the first page and put inside what's added on the second one.

There are two great answers here that both do the job, but neither directly answered the question that I asked. I'm therefore adding this answer (my eventual solution) in case anyone comes across the question with a different use-case.

I found this page: http://www-h.eng.cam.ac.uk/help/tpl/textprocessing/squeeze.html It is a very approachable introduction to spacing in LaTeX and contains many useful variables that need fixing to a constant value (without glue) in order to meet my requirements.

The variables that I set in the header of my document (based on those taken from the above link) are:

`````` %% page layout
%% paragraphs
\setlength{\baselineskip}{12pt plus 0pt minus 0pt}
\setlength{\parskip}{12pt plus 0pt minus 0pt}
\setlength{\parindent}{0pt plus 0pt minus 0pt}
%% floats
\setlength{\floatsep}{12pt plus 0 pt minus 0pt}
\setlength{\textfloatsep}{20pt plus 0pt minus 0pt}
\setlength{\intextsep}{14pt plus 0pt minus 0pt}
\setlength{\dbltextfloatsep}{20pt plus 0pt minus 0pt}
\setlength{\dblfloatsep}{14pt plus 0pt minus 0pt}
%% maths
\setlength{\abovedisplayskip}{12pt plus 0pt minus 0pt}
\setlength{\belowdisplayskip}{12pt plus 0pt minus 0pt}
%% lists
\setlength{\topsep}{10pt plus 0pt minus 0pt}
\setlength{\partopsep}{3pt plus 0pt minus 0pt}
\setlength{\itemsep}{5pt plus 0pt minus 0pt}
\setlength{\labelsep}{8mm plus 0mm minus 0mm}
\setlength{\parsep}{\the\parskip}
\setlength{\listparindent}{\the\parindent}
%% verbatim
\setlength{\fboxsep}{5pt plus 0pt minus 0pt}
``````

I'm not claiming that this list is exhaustive, but it meets my requirements. For an exhaustive list, follow @barbara beeton's suggestion and grep the .cls file for all the seps/skips. Note that writing "plus 0pt minus 0pt" is not necessary, since LaTeX will infer this if it is omitted, but I included it explicitly to remind myself of the "no glue" requirement when revisiting the document in the future.

I also used `\raggedbottom` to ensure that any extra whitespace is always added at the bottom of the page.

It's also important to note that changing the text colour can have a drastic impact on vertical spacing. See this question: Changing font color in a table adding unwanted extra spacing The solution that I used to this problem was that suggested in the second half of the accepted answer to that question: use `\leavevmode` before `\color`:

``````\leavevmode\color{new1}\lipsum[1]
\leavevmode\color{new2}\lipsum[2]
``````
• You need not to write the `plus 0pt minus 0pt` part. – Manuel Jul 26 '15 at 10:34