BibTeX, biblatex and biberFormatting biblabel in a compact reference style

Information and discussion about BiBTeX - the bibliography tool for LaTeX documents.
Post Reply
epicurea
Posts: 11
Joined: Mon May 12, 2008 8:11 pm

Formatting biblabel in a compact reference style

Post by epicurea »

Hi All - I am trying to achieve a very compact set of references and am using the savetrees package to do this:

Code: Select all

{\scriptsize
\bibliographystyle{savetrees}
\bibliography{TheBibFile}
}
I also wanted these to be formatted as inparaenum so I used the example from here:
http://user.astro.columbia.edu/~williams/mn2ebst/
To get:

Code: Select all

\renewenvironment{thebibliography}[1]{%
  \section*{\refname}
  \let\par\relax\let\newblock\relax
  \let\olditem\item
  \renewcommand{\item}[1][]{\olditem[\bfseries\olditem]}%bolds the bib label but produces even numbered refs!!!
  \inparaenum}{\endinparaenum}
As you can see from the above, I also wanted to make sure the biblabel was in bold so it was easier to find a reference in the block. However, this results all even ref numbers (i.e. 2, 4, 6...60 instead of 1, 2, 3...30).

As always, any help would be very much appreciated!

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org
LaTeX books
kaiserkarl13
Posts: 707
Joined: Tue Mar 25, 2008 5:02 pm

Formatting biblabel in a compact reference style

Post by kaiserkarl13 »

You're skipping items because you used "\olditem" twice (the first increments the counter). I got it to work this way:

Code: Select all

\documentclass{article}
\usepackage{savetrees}
\usepackage{paralist}
\usepackage{url}

\begin{document}
    \renewenvironment{thebibliography}[1]{%
      \section*{\refname}
      \let\par\relax\let\newblock\relax
      \inparaenum
      \let\olditem\item
      \renewcommand{\item}[1][]{\textbf\olditem}
    }{\endinparaenum}

    {\scriptsize
    \nocite{*}
    \bibliographystyle{savetrees}
    \bibliography{TheBibFile}
    }
\end{document}
In the future, please provide a full Infominimal working example so I don't have to deduce which package "inparaenum" comes from.

The reason this "works" is because the \textbf only applies to the thing right after it, so it only grabs the number (which, thankfully, is in its own box and thus the whole number gets printed in bold).
epicurea
Posts: 11
Joined: Mon May 12, 2008 8:11 pm

Formatting biblabel in a compact reference style

Post by epicurea »

Hi - thanks very much for replying to my post - this works!

Sorry for not replying back earlier - I was very close to a submission deadline at the time and got the same solution from a friend who really knows his LaTeX!

Anyway, quick note for anyone else trying this: the package hyperref will interfere with this solution.

Cheers
epicurea
Posts: 11
Joined: Mon May 12, 2008 8:11 pm

Formatting biblabel in a compact reference style

Post by epicurea »

I forgot to add that anyone seeking to use the unsrt style in savetrees needs to do the following (thanks to Scott Pakin, the author of the savetrees package, for pointing this solution out to me):
  • Copy savetrees.bst to savetrees-unsrt.bst.
    The file is located here for the TexLive 2013 distribution in Mac OS X:

    Code: Select all

    /usr/local/texlive/2013/texmf-dist/tex/latex/savetrees/
    Depending on the permissions in your system, you may be better off copying the new file to your local path.
  • Edit your document to invoke \bibliographystyle{savetrees-unsrt}
    instead of \bibliographystyle{savetrees}.
  • Comment out the "SORT" line near the bottom of savetrees-unsrt.bst
    by prepending a "%".
I am attaching my savetrees-unsrt.bst file here if you'd rather use that.
Attachments
savetrees-unsrt.bst
(25.34 KiB) Downloaded 396 times
Post Reply