Latex: Squeezing the Vertical White Space

Here are some tips on how to “compress” your paper vertically by minimizing white space gaps between elements. I had to do this few days ago when school refused to duplicate my syllabus because it was 14 pages long. I got it down to 6 without any cuts, and then down to 3 after doing some reductions in text.

So how do we squeeze the vertical whitespace? There are many ways to do this, and some are more complicated than the other. My tips range on the easy side, so you won’t need to write custom .sty files or redefine commands using intricate tex sequences.

First we want to set the spacing between paragraphs as small as possible. The commands below should kill just about any space inducing setting in your paper unless you are doing something fancy:

\setlength{\parskip}{0pt}
\setlength{\parsep}{0pt}
\setlength{\headsep}{0pt}
 \setlength{\topskip}{0pt}
\setlength{\topmargin}{0pt}
\setlength{\topsep}{0pt}
 \setlength{\partopsep}{0pt}

Now the paragraphs are snugly against each other so let’s take a look at line spacing. The \linespread command is usually used to increase the line spacing but we can exploit it to make it smaller by passing in a value smaller than 1:

\linespread{0.5}

You may want to play around with that value – if you set it to small, LaTex will just reject it. Below certain threshold some lines may start running into each other. For me 0.5 value did the trick, and slurped up swaths of white space.

Our next offender are section headings. By default they have huge gaps above and below them. Totally wasteful, especially if you are trying to save trees by decreasing your page count without sacrificing content. So what do you do? There are very complex ways to change the spacing above and below the section headings but we are lazy bums and don’t feel like using them. So let’s use the titlesec package and zero out all the spaces:

\usepackage[compact]{titlesec}
\titlespacing{\section}{0pt}{*0}{*0}
 \titlespacing{\subsection}{0pt}{*0}{*0}
\titlespacing{\subsubsection}{0pt}{*0}{*0}

If you look int the documentation, the attributes to \titlespacing are command, left margin, above-skip and below-kip respectively. The * notation replaces the formal notation using plus/minus and etc. If you set it to zero, headings will snug up to the paragraphs above and below them.

Enumerations and itemizations are horrible space wasters too. By default, all the lists are double-spaced. Why? Don’t ask me, but it’s easy to get rid of that by using “compacted” lists provided by the mdwlist package. In your preamble add:

\usepackage{mdwlist}

Then instead of using normal lists use:

\begin{enumerate*}
	\item
\end{enumerate*}

\begin{itemize*}
	\item
\end{itemize*}

This is not as straightforward as the other steps, as it will require some search and replace in a pre-existing text. If you know a better way to do this, please let me know.

Last thing I did was to change my margins using the geometry package. My command looked like this:

\usepackage[left=2cm,top=1cm,right=2cm,nohead,nofoot]{geometry}

My document had no headers or footers so I was able to disable them. You should probably experiment a bit with the values above to see what is the maximum range of your printer. Most devices won’t print all the way to the paper edge so you must set margins appropriate to your printer.

My document had no formulas or figures, but had several long item lists. Some of them were very narrow – 2-3 words per item. These types of lists are major space wasters so I set them in multi-column mode. Depending on your list you can either use 2, 4 or either 4 columns. For me 2 columns were the right fit. I recommend using the multicol package. In your preamble add:

\usepackage{multicol}

Then surround your text to be “columnized” (shut up, it’s a new word I just mad up) using:

\begin{multicols}{2}
	% your stuff goes here
\end{multicols}

Once I did all of that, the page count of my document was cut roughly in half. Feel free to add your vertical space squeezing tips in the comments.

[tags]latex, latex vertical space, section header spacing, list spacing, item spacing, margins[/tags]

This entry was posted in Uncategorized. Bookmark the permalink.



34 Responses to Latex: Squeezing the Vertical White Space

  1. Brian UNITED STATES Mozilla Firefox Mac OS says:

    Thanks for these tips. Your method for eliminating space around sections is nice and clean. To get closer spacing in lists, you can also try redefining the enumerable environment as follows:

    % redefine enumerate env for closer spacing
    \renewenvironment{enumerate}%
      {\begin{list}{\arabic{enumi}.}%
         {\topsep=0in\itemsep=0in\parsep=0in\partopsep=0in\usecounter{enumi}}%
       }{\end{list}}
    
    Reply  |  Quote
  2. Mikaël BELGIUM Mozilla Firefox Windows says:

    Another possibility is to include the line

    “\setlength{\itemsep}{1ex or some other latex measure of length}”

    after the “\begin{enumerate}” or “\begin{list}” command. (Also works with the \begin{enumerate*} command from the mdwlist package)

    This allows you to choose the amount of spacing between the items for each separate itemization or enumeration. That way you can still have some spacing without it eating the whole page. This can also be more pleasant on the eyes if some of the items are comprised of a few lines of text.

    Reply  |  Quote
  3. Luke Maciak UNITED STATES Mozilla Firefox Ubuntu Linux Terminalist says:

    Nice! Thanks for the tip!

    Reply  |  Quote
  4. Serguei CANADA Mozilla Firefox Windows says:

    This:

    \usepackage{savetrees}

    does most if not all of that is described above. The package is pretty much standard and is carried by most LaTeX distributions (I used in in Fedora’s tetex, MacOS, and Windows (MiKTeX) standard distributions on a several occasions.

    Also, I’ve found this useful:

    http://www-h.eng.cam.ac.uk/help/tpl/textprocessing/squeeze.html

    Personally, what I could not find yet is how to reduce the blank space on the title page before the title and the top margin when using the standard article class. All I want is just that — no extra slack space between the top
    margin and the title on the title page.

    Thanks,

    -s

    Reply  |  Quote
  5. Luke Maciak UNITED STATES Mozilla Firefox Ubuntu Linux Terminalist says:

    Hey, thanks for the tip. I didn’t really know about the savetrees package. Heh. this is yet another example how comments can often be better than the contents of a blog post! :P

    Reply  |  Quote
  6. pravin INDIA Mozilla Firefox Linux says:

    You’re brilliant! Thank you. Saved me a lot of time.

    Reply  |  Quote
  7. Alexmart UNITED STATES Mozilla Firefox Windows says:

    Very helpful tips. Thanks a lot!

    Reply  |  Quote
  8. JGU UNITED STATES Mozilla Firefox Windows says:

    If you have figures and tables then \usepackage{wrapfig} which defines the wrapfigure and wraptable environments, is essential. It wraps the text around the typeset figure or table, allowing placement either at either left or right margins, or centered.

    Reply  |  Quote
  9. Fatima OMAN Internet Explorer Windows says:

    How can you reduce the space following the table of contents title “Contents”, i.e., the space between “Content” and the first item in the table of contents?

    Also, how can you reduce the space following the List of Figures and List of Tables titles?

    Thanks

    Reply  |  Quote
  10. Sam CYPRUS Mozilla Firefox Windows says:

    Thanks a bunch man!

    Reply  |  Quote
  11. MPF ITALY Mozilla Firefox Mac OS says:

    It works! Many thanks! :-)

    Reply  |  Quote
  12. Anne UNITED STATES Mozilla Firefox Ubuntu Linux says:

    Thank you! This is much simpler and more comprehensive than most explanations I’ve seen on the subject.

    Reply  |  Quote
  13. bhargav INDIA Mozilla Firefox Windows says:

    excellent …. thank you very much sir…..

    Reply  |  Quote
  14. santiago UNITED STATES Mozilla Firefox Ubuntu Linux says:

    It seems to me that there is an easier way to descrease the space between lists (or at least, one which does not incllude renaming every list).

    Take a look at: http://dcwww.camd.dtu.dk/~schiotz/comp/LatexTips/LatexTips.html#tweakl ist

    Reply  |  Quote
  15. Pingback: Squeezing space with LaTeX | Research tips UNITED STATES WordPress

  16. Lauren AUSTRALIA Mozilla Firefox Windows says:

    Thanks very much for the tips, they solved my space issues :)

    Reply  |  Quote
  17. I tried it out and it works great. Thanks so much for the tips!

    Reply  |  Quote
  18. Soma INDIA Mozilla Firefox SuSE Linux says:

    Thanks ! Your tips are excellent…worked immediately…saved me a lot of time

    Reply  |  Quote
  19. Oliver SWITZERLAND Mozilla Firefox Windows says:

    Saved my day! This is really the one major annoyance of Latex. Although it’s probably not its fault.

    Reply  |  Quote
  20. Serguei wrote:

    This:

    Personally, what I could not find yet is how to reduce the blank space on the title page before the title and the top margin when using the standard article class. All I want is just that — no extra slack space between the top
    margin and the title on the title page.

    Thanks,

    -s

    I second that question. In fact, that’s what I was searching for on Google that sent me here. I just want to write an essay for class and not have the first half of the page basically be the title. Haha.

    Reply  |  Quote
  21. Emma UNITED KINGDOM Mozilla Firefox SuSE Linux says:

    @ Thomas Wright:

    “..first half of the page basically be the title”..? Does this mean you have the default of no title page? If so, you can just leave out the \maketitle command, and write your title for example as
    \twocolumn[\begin{center}\textbf{TITLE} \end{center} \vspace{VALUE}]
    That’ll span both columns and you can choose the vertical space.

    Reply  |  Quote
  22. Dan NORWAY Mozilla Firefox Windows says:

    I have also some trouble with the size of the titles, sections , subsections. It is so big and a bite offensive. I am using document class scrbook. Is there any way to make such sizes a bite smaller? Or probably, does any body know which font style fits more appropriate with such class? The default is really more clumsy. Looking forward to hearing…

    Reply  |  Quote
  23. Ben UNITED STATES Mozilla Firefox Windows says:

    For the question of how to remove the vertical space before the title, try this:

    \title{\vspace{-1.3in}\textbf{my title}}
    \date{July 2010}
    \author{blah blah}

    Reply  |  Quote
  24. Chien SINGAPORE Mozilla Firefox Ubuntu Linux says:

    @ Brian:
    So how do you restore to the original spacing?

    Reply  |  Quote
  25. Pierre CANADA Mozilla Firefox Fedora Linux says:

    Thanks a lot for a quick and easy solution

    Reply  |  Quote
  26. Ragib Hasan UNITED STATES Mozilla Firefox Mac OS says:

    An easy way to reduce whitespace above the article title is this: just include a \vspace{-5pt} (or whatever amount you want) in the title itself.

    For example:

    \title{\vspace{-5pt}An Awesome way to Reduce Whitespace}

    This works for me for the default article class. Haven’t tested it elsewhere, but should work.

    Reply  |  Quote
  27. Stephanie UNITED STATES Mozilla Firefox Ubuntu Linux says:

    sweeeeeeeeeeeeeeeeeeet THANK YOU!

    Reply  |  Quote
  28. Thomas Wright UNITED STATES Google Chrome Windows says:

    Emma wrote:

    Does this mean you have the default of no title page? If so, you can just leave out the \maketitle command, and write your title for example as
    \twocolumn[\begin{center}\textbf{TITLE} \end{center} \vspace{VALUE}]
    That’ll span both columns and you can choose the vertical space.

    Well, I still want to make my title the way LaTeX allows me to without an in-body workaround. I might just have too high of hopes to suppose a preamble workaround. (If you’re wondering why, it’s really out of not wanting to write \twocolumn[\begin{center}\textbf{TITLE] \end{center}\vspace{VALUE} every other day for essays for class. I’d much rather, and am hopeful, that there might be something like a \usepackage{titlespace} or something. If anyone is bored enough to write that package for me using your suggested workaround, they can have at it! =D

    Reply  |  Quote
  29. Nick UNITED STATES Safari Mac OS says:

    Check out this package to move the title…

    \usepackage{titling}

    Specifically

    \setlength{\droptitle}{-XXpt}

    Should help you out.

    @ Serguei:@ Serguei:

    Reply  |  Quote
  30. Fiona McNeill Safari Mac OS says:

    Thanks a lot! I had resorted to using \vspace{-10pt}, etc., leaving the text looking all weird and squashed, before I found this page. Now it looks great and fits.

    Reply  |  Quote
  31. Xamuel Mozilla Firefox Windows says:

    Thanks a ton for providing this…. sometimes I wish Knuth had managed to program some kind of “\crameverythinginto1page” command :P

    Reply  |  Quote
  32. Jonas PORTUGAL Google Chrome Windows says:

    Thanks a lot!
    But I’ve got a problem, can anyone help me?

    \usepackage[compact]{titlesec}
    \titlespacing{\section}{0pt}{*0}{*0}

    These worked fine for \section and \subsection, but what’s about \chapter?
    Nothing happened here! I’ve been searching this for days…
    Thanks

    Reply  |  Quote
  33. Tim Turbine Mozilla Firefox Windows says:

    Maybe you should take a look at this: http://tex.stackexchange.com/questions/11233/distance-between-chapter- title-and-text.

    Another possibility could be that the compact version of titlesec is only applicable for headings available in articles and smaller document classes, so that the chapters of a report are not affected by it.

    Reply  |  Quote
  34. Mor ISRAEL Mozilla Firefox Windows says:

    Thanks!
    but…
    How do I shrink the gaps and fonts in the references section??

    Reply  |  Quote

Leave a Reply

Your email address will not be published. Required fields are marked *