Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

I'm using bibunit to enter multiple bibliographies in a document. I don't want the bibunit to have a separate heading. I can remove the text with by redefining \refname, but this still leaves big vertical space. How can I drop that space entirely?

Here's a toy example:

\documentclass{article}
\usepackage{bibunits}
\begin{document}

\defaultbibliographystyle{plainyr-rev}
\defaultbibliography{ab,ty2}
\renewcommand{\refname}{}

\section{Publications}

Some text goes here.

\begin{bibunit}
  \nocite{smith_douglas_ea_2004}
  \putbib
\end{bibunit}
\end{document}

This produces:

I've drawn a red line on the image to show the space I want to reduce/eliminate.

share|improve this question

1 Answer 1

up vote 2 down vote accepted

A hack specific for the article class. Other classes may require different workarounds:

\documentclass{article}
\usepackage{bibunits}

%%% START HACK
\usepackage{etoolbox}
\AtBeginEnvironment{bibunit}{\renewcommand\section[5]{}}
%%% END HACK

\begin{document}

\defaultbibliographystyle{plainyr-rev}
\defaultbibliography{ab,ty2}

\section{Publications}

Some text goes here.

\begin{bibunit}
  \nocite{smith_douglas_ea_2004}
  \putbib
\end{bibunit}
\end{document}

Explanation: the code for the thebibliography environment starts with

\newenvironment{thebibliography}[1]
     {\section*{\refname}%
      \@mkboth{\MakeUppercase\refname}{\MakeUppercase\refname}%
      \list{\@biblabel{\@arabic\c@enumiv}}%
      [...]

and the redefinition of \section we perform when bibunits starts gobbles \section together with the five "arguments" that follow:

*
{\refname}
\@mkboth
{\MakeUppercase\refname}
{\MakeUppercase\refname}

A cleaner approach would be to redefine the environment:

\makeatletter
\renewenvironment{thebibliography}[1]
     {\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}
\makeatother

removing the code responsible for the \section* command.

share|improve this answer
    
Thanks! I had found the relevant code in article.cls, but didn't know what to do with it. –  Tyler Dec 13 '12 at 14:19

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.