Text FormattingBibliography section in multicols env

Information and discussion about LaTeX's general text formatting features (e.g. bold, italic, enumerations, ...)
Post Reply
achim
Posts: 49
Joined: Wed Aug 05, 2009 2:29 pm

Bibliography section in multicols env

Post by achim »

Hi

I'm writing on a paper. The main text body is set in one column. In order to save some space, I'd like to put the bibliography in a multicols environment.

Have a look at the pseudo code (it is not a minimal working example as I don't cite anything and I don't provide a *.bib file...):

Code: Select all

\documentclass[10pt,a4paper]{article}
\usepackage{multicol}
\usepackage{cite}

\beging{document}

\section{Main body}

Some random text with citations... %\cite{...}

\begin{multicols}{2}
	\small
	\bibliographystyle{plain}
	\bibliography{mybib}
\end{multicols}

\end{document}
This then yields something like:
bib.png
bib.png (31.12 KiB) Viewed 14446 times
The problem with my solution is that the section title References already prints in the two column environment (which obviously must be the case as I call \bibliography{...} in the multicols environment).
I'd rather have the section in the one columns area, so that the references in the right column start at the same height as the ones on the left.

Code: Select all

References

[1] ...       [8] ...
[2] ...       [9] ...

and not:


References    [8] ...
              [9] ...
[1] ...       [10] ...
[2] ...       [11] ...
Cheers
Last edited by achim on Thu Sep 23, 2010 10:13 pm, edited 1 time in total.
OS: Kubuntu
Distribution: TexLive
Editor: Kile

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org

NEW: TikZ book now 40% off at Amazon.com for a short time.

And: Currently, Packt sells ebooks for $4.99 each if you buy 5 of their over 1000 ebooks. If you choose only a single one, $9.99. How about combining 3 LaTeX books with Python, gnuplot, mathplotlib, Matlab, ChatGPT or other AI books? Epub and PDF. Bundle (3 books, add more for higher discount): https://packt.link/MDH5p

localghost
Site Moderator
Posts: 9202
Joined: Fri Feb 02, 2007 12:06 pm

Bibliography section in multicols env

Post by localghost »

achim wrote:[…] Have a look at the pseudo code (it is not a minimal working example as I don't cite anything and I don't provide a *.bib file...) […]
In principal a minimal working example (MWE) is always possible. In this case a short bibliography database file would have done.

Regarding the problem you have to redefine the thebibliography environment to make it use the multicols environment. See sample below.

Code: Select all

\begin{filecontents*}{\jobname.bib}
@BOOK{knuth:84,
  author={Donald Ervin Knuth},
  title={The \TeX book},
  year={1984},
  publisher={Addison-Wesley}
}
@BOOK{lamport:94,
  author={Leslie Lamport},
  title={\LaTeX\ - A Document Preparation System},
  note={User's Guide and Reference Manual},
  year={1994},
  publisher={Addison-Wesley},
  edition={Second}
}
@BOOK{mitgoo:04,
  author={Frank Mittelbach and Michel Goossens},
  title={The \LaTeX\ Companion},
  year={2004},
  publisher={Addison-Wesley},
  edition={Second}
}
@BOOK{goomit:07,
  author={Michel Goossens and Frank Mittelbach and Sebastian Rahtz and Denis Roegel and Herbert Voss},
  title={The \LaTeX\ Graphics Companion},
  year={2007},
  publisher={Addison-Wesley},
  edition={Second}
}
\end{filecontents*}
\documentclass[11pt,a4paper,english]{article}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage{babel}
\usepackage[includeheadfoot,margin=2cm]{geometry}
\usepackage{multicol}

% bibliography environment over multiple columns (multicol)
\makeatletter
\renewenvironment{thebibliography}[1]{%
  \section*{\refname \@mkboth{\MakeUppercase\refname}{\MakeUppercase\refname}}%
  \begin{multicols}{2}
  \list{\@biblabel{\@arabic\c@enumiv}}{%
    \settowidth\labelwidth{\@biblabel{#1}}%
    \leftmargin\labelwidth
    \advance\leftmargin\labelsep
    \@openbib@code
    \usecounter{enumiv}%
    \let\p@enumiv\@empty
    \renewcommand\theenumiv{\@arabic\c@enumiv}}%
    \sloppy
    \clubpenalty4000
    \@clubpenalty \clubpenalty
    \widowpenalty4000%
    \sfcode`\.\@m}
{
  \def\@noitemerr{\@latex@warning{Empty `thebibliography' environment}}%
  \endlist\end{multicols}
}
\makeatother

\begin{document}
  \nocite{*}
  \bibliographystyle{plain}
  \small
  \bibliography{\jobname.bib}
\end{document}
Note that this redefinition only works with the »article« class because the environment code was taken from there. For other classes it requires other modifications.


Thorsten
achim
Posts: 49
Joined: Wed Aug 05, 2009 2:29 pm

Bibliography section in multicols env

Post by achim »

Thanks

I just came up with a bit of a (simple) cheat instead of your (rather complex, but certainly better) solution.

Code: Select all

\section*{References}
\begin{multicols}{2}
    \small
    \renewcommand{\refname}{ \vspace{-\baselineskip}\vspace{-1.1mm} }
    \bibliographystyle{plain}
    \bibliography{paper_ref}
\end{multicols}
ref.png
ref.png (29.14 KiB) Viewed 14433 times
What I do here is put the Reference section manually outside the multicols environment and then just replace the \refname command with a negative space in order to make up for the gap.

What I couldn't work out though is how to get the exact 'line grating' (distance form baseline to baseline. So, for now, I had to tune it with the -1.1mm, which is sort of ugly I'm afraid.

Cheers
Achim
OS: Kubuntu
Distribution: TexLive
Editor: Kile
Post Reply