11

I'm trying to typeset a bibliography inside a multicols environment, but with the heading as a single column (using multicols' optional argument). I've noticed that the vertical space between the heading and the actual bibliography is larger than with a bibliography typeset in one-column mode. On closer inspection, it seems that the spacing after headings is also somewhat larger for "normal" text when using multicols, but that the combination biblatex/multicol results in even more additional vertical space.

The multicol documentation states on p. 2 that \addvspace is used for the spacing before and after the multicols environment (the length is \multicolsep). This seems to be consistent with the observed behaviour after "normal" headings because the default value of \multicolsep (12pt) is larger than the vertical space after sections in the standard classes (2.3ex, i.e. about 9.9pt for a fontsize of 10pt). My current workaround is to set \multicolsep to 0pt, but this will negatively affect in-text multicols environments. So I'd like to know what is the cause of the "on-top" additional vertical space after bibliography headings.

\documentclass{article}

\usepackage[english]{babel}
\usepackage{blindtext}

\usepackage{biblatex}
\defbibheading{none}{}% for biblatex v<1.5

\usepackage{multicol}

% My current workaround
% \setlength{\multicolsep}{0pt}

\usepackage{filecontents}

\begin{filecontents}{\jobname.bib}
@misc{A01,
  author = {Author, A.},
  year = {2001},
  title = {Alpha},
}
@misc{B02,
  author = {Buthor, B.},
  year = {2002},
  title = {Bravo},
}
@misc{C03,
  author = {Cuthor, C.},
  year = {2003},
  title = {Charlie},
}
\end{filecontents}

\addbibresource{\jobname.bib}

\nocite{*}

\begin{document}

\section{First Section }

\blindtext

\begin{multicols}{2}[\section{Second Section}]
\blindtext
\end{multicols}

\printbibliography[title={First Bibliography}]

\begin{multicols}{2}[{\printbibheading[title={Second Bibliography}]}]
\printbibliography[heading=none]
\end{multicols}

\end{document}
1
  • 3
    This is not an answer, but if you put your \setlength{\multicolsep}{0pt} inside multicols environment optional argument, it solves the problem without messing with the in-text multicols environments... Like this: \begin{multicols}{2}[{\setlength{\multicolsep}{0pt}\printbibheading[title={Second Bibliography}]}]
    – henrique
    Commented Jul 1, 2011 at 20:14

2 Answers 2

11

Apart from following the good advice by henrique, you can say

\begingroup\setlength{\multicolsep}{0pt}
\begin{multicols}{2}[{\printbibheading[title={Second Bibliography}]}]
\printbibliography[heading=none]
\end{multicols}\endgroup

or, probably, define a personal command:

\newcommand\twocolprintbibliography[2][0pt]{%
  \begingroup\setlength{\multicolsep}{#1}%
  \begin{multicols}{2}[{\printbibheading[title={#2}]}]
  \printbibliography[heading=none]
  \end{multicols}\endgroup}

and call it as

\twocolprintbibliography{Second Bibliography}
\twocolprintbibliography[3pt]{Second Bibliography}

which provides for a much clearer input. The optional argument is to fine tune the spacing in case of need.

5
  • I agree that these are much better workarounds, so +1. However, I'd still like to know what causes the observed erratic behaviour.
    – lockstep
    Commented Jul 1, 2011 at 20:26
  • Great workaround (not really a workaround, a good solution)! I'd only suggest that in the newcommand approach, arg. #2 where left alone, so one can pass more options than just the title to the command, like: \begin{multicols}{2}[{\printbibheading[#2]}]
    – henrique
    Commented Jul 1, 2011 at 20:42
  • @lockstep One should delve deep into the \printbibliography routine, perhaps. Actually it seems that 0pt is not quite the right setting.
    – egreg
    Commented Jul 1, 2011 at 20:48
  • @egreg: Why does it seem so?
    – lockstep
    Commented Jul 1, 2011 at 20:50
  • In my test the spacing between the bibliography header and the first entry is less than the space between a section header and the text, with \multicolsep=0pt.
    – egreg
    Commented Jul 1, 2011 at 21:10
5

Taking a closer look at my minimal example, it seemed that the "incorrect" vertical spacing after bibliography headings typeset inside a multicols environment equaled the sum of \multicolsep and the vertical space after normal headings. In other words, \addvspace seemed to work like \vspace.

A search at comp.text.tex for "\addvspace" resulted in the series of messages spacing problem with \index in LaTeX from 1999, where some users described a general deficiency of \addvspace. Quoting James Kilfiger:

[A] second \addvspace can't 'see' the first when there is a 'write whatsit' between them.

David Carlisle:

[V]ertical mode is generally a hostile place for \write's \specials \marks or anything else that you don't want to affect the spacing.

Donald Arseneau:

Most of the things that add vertical space in LaTeX, such as lists and section titles, contribute their space via \addvspace (see the manual) which doesn't necessarily add any space at all! (Poor naming!) What \addvspace{v} does is conditionally increase the existing space so it is at least as big as v. To do this, it needs to look for a preceding space (vertical skip) in the "vertical list".

In the normal case, the \section command sees the space below a list, and increases that to the space needed before a section, but an \index command puts something else on the list, and then your \section command can't see any preceding space, so it adds the entire pre-section space to give a total space of after_list + before_section.

The same problem happens with \label, \addtocontents, and \color commands.

The bibliographies in my MWE use the standard "bibliography" bibheading. Its definition for the article class is as follows:

\defbibheading{bibliography}[\refname]{%
  \section*{#1}%
  \markboth{\MakeUppercase{#1}}{\MakeUppercase{#1}}%
}

That is, the bibliography will be typeset as an an unumbered section that will generate no ToC entry. However, the document header and footer will (contrary to a normal \section*) be updated by the \markboth command -- and this command is the culprit for \addvspace's malfunctioning. Removing the code line starting with \markboth from the above code snippet and then inserting it in my MWE will result in correct vertical spacing for all bibliography headings (at the expense of correct headers and footers).

Obviously, not updating the header and footer is a poor workaround. Numbered sections will update the header and footer inside the \section command and therefore not affect the workings of \addvspace. For unnumbered sections without a ToC entry, we can make use of the fact that "[the] entire list of references printed by \printbibliography and similar commands is processed in a group" (biblatex manual, section 4.11.9). That is, we can redefine the "bibliography" bibheading so that it a) locally sets the value of the counters secnumdepth and tocdepth to -2 b) uses the non-starred version \section to typeset the heading. The following code must be added to my MWE for correct vertical spacing:

\defbibheading{bibliography}[\refname]{%
%   \section*{#1}% DELETED
%   \markboth{\MakeUppercase{#1}}{\MakeUppercase{#1}}% DELETED
  \defcounter{secnumdepth}{-2}% NEW
  \defcounter{tocdepth}{-2}% NEW
  \section{#1}% NEW
}

You must log in to answer this question.

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