70

I create a document in two-column-layout with LaTeX (and Koma-Script, if that is relevant). The two-column-layout is defined in documentclass. The last page of an chapter fills the left column first - the result is that both column are of different length. How can I balance that?

EDIT: flushend like mentioned in the answer of TH. doesn't work for me. Maybe it is conflicting with some other package I use?

EDIT 2: OK, after I tested with lipsum like suggested from Joseph Wright I saw it balanced. I tried a little bit and could find out, that flushend only balances the columns in the last chapter, not in all of them. Knowing that, I could see, that it is true for my document too, the last chapter has balanced columns. How can I achieve it for all of them? Here my short example:

\documentclass[a4paper, 10pt, twocolumn, DIV=18]{scrbook}

    \usepackage{flushend}
    \usepackage{lipsum}

    \begin{document}

    \chapter{test}

        \lipsum
        \lipsum

    \chapter{second}

        \lipsum
        \lipsum

    \chapter{third}

        \lipsum
        \lipsum

\end{document}
3
  • This post about two-column layout might also be of interest to you. Nov 23, 2010 at 8:52
  • Please post a compilable example: Will's comment below suggests that the flushend solution should work. You can use the lipsum package for filler text in an example.
    – Joseph Wright
    Nov 23, 2010 at 9:35
  • @Joseph Wright: Hmm, the example I produce with \lipsum works. I have to take a look what breaks it.
    – Mnementh
    Nov 23, 2010 at 9:47

7 Answers 7

11

You can also use \usepackage{multicol} and use the \begin{multicols}{x} environment where x is the amount of columns. They will automatically align themselves according to what you want.

3
  • I don't get it working, I miss the multicols-package. Any idea, how the package is named under Ubuntu Maverick, which contains it?
    – Mnementh
    Nov 23, 2010 at 10:08
  • 1
    The environment is called multicols, but the package's name is multicol (without "s"). I corrected your answer.
    – lockstep
    Nov 23, 2010 at 16:50
  • With locksteps addition I got it working. It is a little bit work, because I have to include each chapter into it's own multicolumn-block, but it works. Thanks.
    – Mnementh
    Nov 23, 2010 at 18:55
73

I'm not sure about Koma-Script in particular, but I've had reasonably good luck using the flushend package with a variety of conference-provided document classes. The use is pretty simple:

\usepackage{flushend}

and that's all it takes. There can occasionally be issues with pdf links being broken across columns.

7
  • I'd forgotten about this particular package. In a quick test, it does indeed seem to work with Koma-Script. Nov 23, 2010 at 8:07
  • 5
    This doesn't work for me.
    – hadi
    Oct 3, 2014 at 3:52
  • 2
    This does balance the bibliography (references) as well out-of-the-box.
    – alexei
    Mar 27, 2016 at 16:57
  • 6
    This is a dangerous package: it can make lines overlap in order to balance the columns. I recommend it should only be deployed at the very final stage of typesetting and every page checked.
    – Hugh
    Jun 9, 2016 at 14:45
  • 2
    This did not work for me in the ACM template to align the references of the bibliography. Literally nothing happens in the output document. Dec 20, 2019 at 9:20
67

\usepackage{balance} in the beginning of the latex document, and then add \balance somewhere in the left column text of the last page.

4
  • 3
    This one also works with \clearpage
    – Cimbali
    Aug 6, 2015 at 17:08
  • 9
    Moderator tag about giving long answers with explanation and context is invalid. The answer is perfect Feb 22, 2018 at 7:38
  • 2
    This did not work for me in the ACM template to align the references of the bibliography. Literally nothing happens in the output document. Dec 20, 2019 at 9:20
  • 2
    I'm using the ACM sigconf template, and this solution works.
    – PLG
    Feb 19, 2021 at 11:41
8

Neither the flushend nor balance environment works for me with or without lipsum; when I use them either nothing happens or the last page disappears. Since most of the papers I work with contain floats, multicols environment is unacceptable to me, because dealing with the balancing of columns is much easier than dealing with messed up floats. It takes only several minutes to balance the last page manually by using \addtolength{height}{-x}, where

x=((height of the residual vertical white space in the last column)/2).

Note that \addtolength needs to be entered just before the last page, so that only both the columns of the last page are redefined as having a different height.

If the balancing gives any micro-problems, you can fine tune it by entering n \vspace{y} commands between items or paragraphs in either of the left or right column, where n is the number of items in the selected column and

y=((height of the vertical micro-adjustment)/n).

Finally, if you need to balance columns on some other page, where multicolumn didn't work properly, you can do it by using \vbox{text you don't want to break} on the shorter column or using \newpage and \hspace{} on the longer column.

4
  • 6
    When I try to use \addtolength I get an "You can't use the letter h after \advance" error. Any ideas?
    – Bryan P
    Sep 13, 2014 at 7:08
  • 1
    Probably means \textheight instead of height. But it does not work for me.
    – ibid
    Aug 21, 2017 at 11:50
  • @BryanP: I think I found the problem: you (and I) copied the suggested command as is. However, it seems like you need to replace height with an appropriate height (and replace the x with some value), .e.g., \addtolength{\textheight}{-2cm}. Aug 25, 2021 at 8:42
  • 1
    This approach also moves the location of the page number. Any idea how to avoid that? Aug 25, 2021 at 8:43
4

A solution for RevTeX 4.1

I had the same problem with a RevTex paper, and the solutions proposed in the other answers failed to work, probably because RevTeX has its own way to manage columns.

Adding \onecolumngrid at the end of the the paper (after the bibliography in my case) balances the columns.

1
  • 2
    RevTeX uses the ltxgrid package under the hood.
    – krlmlr
    Sep 8, 2018 at 15:12
2

At the moment, I would recommend the pbalance package. Merely using \usepackage{pbalance} will balance the final page. Its package description explains how it's an improvement over the balance package:

This package balances the columns on the last page of a two-column document. If the page is “simple” (no footnotes, floats, or marginpars), is uses the balance package; otherwise, it uses \enlargethispage to make the left column shorter, balancing the columns.

All solutions I know of for balancing pages are hacks. Even with pbalance, which at least tries not to break anything, it can be a hassle. I've had an instance where rebuilding my document after some changes made the final page unbalanced again, and I had to clean and rebuild to fixpoint to get it to balance.

Protip: if you're using a LaTeX class from a conference, there's a chance it has an option for balancing the final page. For example, the acmart class has a pbalance option.

1
  • This works for acmart for sure, thank you!
    – K.S.
    Aug 31, 2023 at 22:51
0

The other answers have worked for me most of the time. But I ran into a combination of a two-column document using acmart and BibLaTeX where none of them did. I finally managed by adjusting the margin of the last column manually. That can be done with several approaches as well, but the one that finally did the trick was using enlargethispage of the fancyhdr package in combination with afterpage from the package with the same name. What I did was the following:

  1. Add the following close to the end of the document (just before printbibliography in my case):
    \afterpage{\enlargethispage{-5cm}}
    
    You see that some column now breaks earlier.
  2. Add an additional \afterpage{} around this code for every column before the one you actually want to shorten. For example, I had two entire pages of bibliography plus half a column on the third page, i.e., I wanted to shorten the fifth column, so I ended up adding:
    \afterpage{\afterpage{\afterpage{\afterpage{\afterpage{\enlargethispage{-5cm}}}}}}
    
  3. Manually tweak the value (-5cm) until the columns of the last page are balanced.

You must log in to answer this question.

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