3

I am trying to use the memoir class together with bibunits (and natbib, if that should matter). Specifically, I am using \begin{bibunit} and \end{bibunit} to define parts which should receive separate bibliographies, which I then place using \putbib, using different .bib-files.

This does work well enough, but with one problem: every instance of \putbib seems to insert (possibly among other things) an additional, unnumbered chapter titled "Bibliography", means the page with references has an accordingly large header (and automatically starts a new page, whether I want or not), there is an extra entry in the table of contents, etc. I'd much rather not have this - have putbib just produce the list of references and that's it - or if such an insertion is unavoidable, I would at least want the bibliography to be a section (of the current chapter) and not a chapter* of its own.

Here is a minimal example of what I mean:

\documentclass[12pt, a4paper]{memoir}
\usepackage{bibunits}
\usepackage[round, authoryear]{natbib}
\bibliographystyle{ecta}
\usepackage{bibunits}

\begin{document}
\frontmatter
\tableofcontents
\mainmatter

\begin{bibunit}[ecta]
\chapter{First Chapter}
Bla bla.
\putbib
\end{bibunit}

\chapter{Second chapter}
\begin{bibunit}[ecta]
Bla bla.
\putbib
\end{bibunit}
\end{document}

Produces the ToC:

enter image description here

I'd rather have the "Bibliography" entries on the section level; ideally be named "References" instead. Or just get rid of the heading altogether and I'll do it manually is fine too.

1
  • 1
    Welcome to TeX.se and thanks for including a minimal document with your question!
    – Alan Munn
    Jul 1, 2023 at 20:40

1 Answer 1

2

The basic problem you're having comes from not using the sectionbib option to bibunits. So to have section level bibliographies labelled "References" you need to add the following.

\usepackage[sectionbib]{bibunits}
\renewcommand{\bibname}{References}

Note that if you are loading babel then this renaming must be made by wrapping the \renewcommand inside the proper babel method. For example, if your main language is set to english then you need to use:

\addto\extrasenglish{\renewcommand{\bibname}{References}}

instead of the simple \renewcommand shown above.

However, memoir messes with various things, which means that packages like bibunits that assume just the basic document classes may not work. So we need to do some more magic, adapting the answer here (which is almost a duplicate):

\documentclass[12pt, a4paper]{memoir}
\begin{filecontents}{\jobname.bib}
@book{Chomsky1981,
    address = {Dordrecht},
    author = {Noam Chomsky},
    publisher = {Foris Publications},
    title = {Lectures on Government and Binding},
    year = {1981}}

@book{Chomsky1986,
    address = {New York},
    author = {Noam Chomsky},
    publisher = {Praeger},
    title = {Knowledge of Language: its nature, origin and use},
    year = {1986}}
\end{filecontents}

\usepackage[round, authoryear]{natbib}
\usepackage[sectionbib]{bibunits}

\renewcommand{\bibname}{References}
\newif\ifnumberedbib
\numberedbibfalse % False by default anyway
\makeatletter
\AtBeginDocument{%    
\renewcommand{\@memb@bsec}{%
  \ifnumberedbib
  \section{\bibname}
  \else
  \section*{\bibname}%
  \fi
  \bibmark
  \ifnobibintoc\else
  \ifnumberedbib\else
  \phantomsection
    \addcontentsline{toc}{section}{\bibname}%
    \fi
    \fi
    \prebibhook
}

\renewcommand{\bibsection}{\@memb@bsec}
}
\makeatother

\begin{document}
\bibliographystyle{ecta}
\frontmatter
\tableofcontents
\mainmatter

\begin{bibunit}[ecta]
\chapter{First Chapter}
Bla bla.
\citet{Chomsky1981}
\putbib[\jobname]
\end{bibunit}

\chapter{Second chapter}
\begin{bibunit}[ecta]
Bla bla.
\citet{Chomsky1986}
\putbib[\jobname]
\end{bibunit}
\end{document}

chapter 1 of code samepl

7
  • Hey, great, that is awesome and helps me so much. Sorry for missing the related question, which indeed is very similar. If moderators want to close this one, I'd of course understand. Just a small problem with your solution: In my actual document, it does not compile if I copy everything from the MWE. I get an error "Package natbib Error: Bibliography not compatible with author-year citations.(natbib) Press <return> to continue in numerical citation style.". The offending line seems to be \bibliographyunit[\chapter] ... (continued)
    – DavidP
    Jul 2, 2023 at 8:09
  • If I leave that line out, it compiles, but the sections are then titled "Bibliography" still. Since the minial example compiles nicely for me too, I assume it must have to do with that having empty bibliographies, or some problem in my bibfiles. I'll try to construct a MWE with some citations and then post again.
    – DavidP
    Jul 2, 2023 at 8:11
  • At any rate, if it is just the title of the section that is off, that'd ok in the worst case. So thank you again already
    – DavidP
    Jul 2, 2023 at 8:12
  • @DavidP I see that, and yes, it does seem to be related to empty bibliographies. I've updated the code with some sample bib items. When I remove the \bibliographyunit line, everything works with the titles renamed too.
    – Alan Munn
    Jul 2, 2023 at 13:41
  • 1
    @DavidP Perhaps you're loading babel, in which case you need to use \addto\extrasenglish{\renewcommand{\bibname}{References}} (Assuming you've chosen english as the main language.)
    – Alan Munn
    Jul 2, 2023 at 19:54

You must log in to answer this question.

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