28

Quick question, hopefully with a quick answer. I'm writing a paper where I'm limited by length (2 pages) and I need references, but it doesn't have to look nice. I'd like LaTeX to compress my bibliography to fit on as few lines as possible.

I have this (except, you know, longer and actual books and articles):

[1] Book 1
[2] Article 1
[3] Book 2
[4] Book 3
[5] Article 2

and I want this:

[1] Book 1 [2] Article 1 [3] Book 2 [4] Book 3 [5] Article 2

Edit: I'm not using any special bibliography packages and my document class is article.

Edit 2: Here's my bbl file:

\begin{thebibliography}{1}

\bibitem{kutsenok}
A.~Kutsenok.
\newblock Swarm {AI}: {A} {G}eneral-{P}urpose {S}warm {I}ntelligence
  {T}echnique.
\newblock
  \small{\url{http://mysite.ncnetwork.net/resqlap4/sitebuildercontent/sitebuil%
derfiles/SwarmAI-Short05.pdf}}.

\bibitem{shoham}
Y.~Shoham and K.~Leyton-Brown.
\newblock {\em Multiagent Systems: Algorithmic, Game-Theoretic, and Logical
  Foundations}.
\newblock Cambridge University Press, 2008.

\bibitem{wooldridge}
M.~Wooldridge.
\newblock {\em An Introduction to MultiAgent Systems}.
\newblock John Wiley \& Sons Ltd, 2002.

\end{thebibliography}
1
  • 1
    I removed the {bibtex} tag because the question is not specifically about BibTeX, but about modifying the thebibliography environment.
    – lockstep
    Mar 31, 2011 at 16:44

2 Answers 2

29

Since you did not say which document class or bibliography packages you're using I will give you a general answer.

A bibliography like this uses a numbered list. The paralist package provides such in-paragraph lists: you could use the inparaenum environment of paralist to get numbered items within a paragraph without linebreaks.

For instance, with article these two redefinitons would achieve it:

\renewenvironment{thebibliography}[1]{%
  \section*{\refname}\inparaenum[{[}1{]}]}{\endinparaenum}
\renewcommand{\bibitem}[1]{\item}

The bibliography would then look like:

alt text

Further features of paralist may be used for customization.

Edit: here's a minimal example showing it with your example bbl file. Note, I additionally disabled \par temporarily, because the bbl file contains empty lines.

\documentclass{article}
\usepackage{paralist}
\renewenvironment{thebibliography}[1]{%
  \section*{\refname}%
  \let\par\relax\let\newblock\relax%
  \inparaenum[{[}1{]}]}{\endinparaenum}
\renewcommand{\bibitem}[1]{\item}
\usepackage{url}
\begin{document}
\nocite{*}
\bibliography{testbib}
\end{document}

Output:

alt text

6
  • 3
    Furthermore, it's straightfoward to convert the .bbl file output by Bibtex to such a list: just change the begin/end tags to the approproate environment. Nov 18, 2010 at 12:53
  • @Stefan Thanks for your help! I tried doing what you said and bibtex refused to compile. You used a lot of new commands that I've never seen before so I had a hard time figuring out the errors.
    – JohnS
    Nov 18, 2010 at 18:04
  • @Charles I tried this and it worked. It took a little more effort than just changing the begin/end tags, but it was close enough for my work in this case. Thanks.
    – JohnS
    Nov 18, 2010 at 18:05
  • 2
    @JohnS: it can be modified to work with BibTeX. For example, if you post your .bbl file I could adjust the redefinitions. Instead of editing the .bbl after each BibTeX run LaTeX could to that adjustment for you.
    – Stefan Kottwitz
    Nov 18, 2010 at 18:21
  • @Stefan Added to the question.
    – JohnS
    Nov 19, 2010 at 3:43
13

The original poster didn't use "special bibliography packages", but for the sake of completeness here's a solution using biblatex. (Note that the redefinition of \defbibenvironment is intended for numeric bibliography styles. For alphabetic styles see the original definition in alphabetic.bbx and change it correspondingly; for styles without a label replace the third argument of \defbibenvironment in my code example with \addspace.)

\documentclass{article}

\usepackage{biblatex}

\defbibenvironment{bibliography}
  {}
  {}
  {\addspace
   \printtext[labelnumberwidth]{%
     \printfield{prefixnumber}%
     \printfield{labelnumber}}%
   \addhighpenspace}

\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}

\bibliography{\jobname}

\begin{document}

\nocite{*}

\printbibliography

\end{document}

(The filecontents environment is only used to include some external files directly into the example, so that it compiles. It is not necessary for the solution.)

EDIT: Since line breaks after labels should be discouraged, I replaced the second \addspace with \addhighpenspace.

5
  • To further compactify your bibliography, add \small to the first empty pair of braces in the \defbibenvironment. Or if you're feeling really pushed for space \scriptsize
    – Seamus
    Mar 6, 2011 at 21:09
  • @Seamus: Why not simply use \bibfont?
    – lockstep
    Mar 6, 2011 at 21:12
  • I don't know about bibfont. I'm just poking around biblatex innnards...
    – Seamus
    Mar 6, 2011 at 21:14
  • Oh yeah. \renewcommand\bibfont{\scriptsize} is much easier...
    – Seamus
    Mar 6, 2011 at 21:16
  • Thanks! Especially for adding the line about styles without a label, which makes the answer truly general. I had an older redefinition that no longer works with recent biblatex and this solves the problem for me.
    – Alan Munn
    May 15, 2011 at 16:32

You must log in to answer this question.

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