Sunday, 14 September 2008

Two-Column Layouts in LaTeX

I was recently asked about using LaTeX to create the two-column layout often seen in scientific journals. I used this layout in some lab reports and project reports.

The first thing to do is to include the multicol package in your preamble:

After that, to place text within a multi-column layout, start the multicols environment (note the s at the end!) and specify the number of columns you'd like:

Finally, end the multi-column layout with:

It's as simple as that! Any sections, subsections, equations etc. between the two will now be automatically formatted into two columns.

There are, however, a few caveats and points to note for formatting considerations.

The first thing to note is that the abstract is often formatted as a single column. To do this, simply place the \begin{multicols}{2} command below your abstract, but above the first \section command.

Secondly, I usually typeset references within the two-column layout. To do this, end the multicols environment after your references section.

Finally, and most importantly, graphics and tables do not always work well with multi-column environments. In order to achieve reasonable results, I used a few workarounds.

If the graphic is large, or has small text, set it normally and it will float outside of the column layout, spanning both columns. For smaller figures, you can create an adjusted figure or table environment which forces LaTeX to set the figure in the column, at the point you typed it in the source text. This is not always what you want, but a reasonable layout can usually be obtained by playing with the exact positioning of the table or graphic commands in the source.

The following, inserted into the preamble, defines two new environments, tablehere and figurehere, which insert tables and figures inline with the column text.
% Figures within a column...
In addition to this, you'll probably need to scale graphics to the column width. This can be achieved with the \resizebox command inside a figure or our new figurehere environment. For example,
\caption{\label{gf-graphs}Graph showing applied RF frequency against magnetic field from the sweep coils, the gradient of the lines reveals information about $g_f$ for each isotope. The left gradient, corresponding to \chem{^{85}{Rb}} is $7.73 \times 10^9 (\pm 1.5 \times 10^8)$. The right gradient, corresponding to \chem{^{87}{Rb}}, is $5.24 \times 10^9 (\pm 6.00 \times 10^7)$ }

\columnwidth is defined by the multicol package to be the width of a text-column!


  1. Or you could use the command


  2. \twocolumn has a three major disadvantages when compared with the multicols package.

    1. You can only set two columns. With multicols you can set as many as you like.

    2. \twocolumn starts a new page every time it is issued. The multicols package does not.

    3. \twocolumn does not balance the output on the last page, so you can end up with an empty or almost empty right-column, and a full left-column. multicols balances the output so that both columns end at roughly the same point on the page.

  3. Why do you scale with a \resizebox, instead of letting the includegraphics do this for you?


  4. No real reason. Probably I did it that way once and the two-column template I now use retains that form. I'm pretty sure either way works, and the width=\columnwidth option to includegraphics is definitely the neater approach! Thanks for mentioning it.

  5. Awesome, thanks. Way helpful.

  6. nice work, Andrew

  7. Hi,
    Is it possible to set the columns to have different widths? I'm trying to place graphics next to chunks of text, where the images are smaller than half the textwidth. I also tried doing this with wraptext, but there I have trouble with vertical alignment. Using tables with multirow would fix that, but I'd rather keep all the text together.

  8. I can't see an easy way to do this quickly with the multicols package. You'd probably have to hack it to adjust the column widths after it'd automatically determined them from the page width. There's probably a better way, though. With LaTeX there (almost) always is.

  9. It it possible within the multicols environment to have figures and tables float to the top of their columns instead of appearing inline?

  10. Nice, i had that problem with the \twocolumn command, thank you!

  11. This is great stuff. Thanks Andrew.

  12. It does not seem to take my \caption{} command.. could you suggest me why \caption is always incompatible with floatflt or other packages. i am trying to put my Figure in one column in the multicolumn latex(with text up and below).

  13. I also had a problem with the \twocolumn command causing a new page to appear. Thanks for the fix!