89

I have a manuscript in which has the following structure:

Main Text
Bibliography
Appendix

However, there are citations which are only cited in the appendix, and they show up in the main bibliography. I would like to split my Bibliography into two different sections, so that the structure of the paper would look like this:

Main Text
Bibliography for Main Text
Appendix
Bibliography for Appendix

I'm currently using bibtex and a single .bib file, and creating the bibliography with

\bibliographystyle {someBibStyleFile}
\bibliography {bibFileName}

I'm interested in a method to split my single bibliography into main bibliography and appendix bibliography with minimal changes to the rest of the document. I'm aware that biblatex is more powerful than bibtex, but I'm not prepared to make the switch before the deadline of this project. There are many related bibliography-with-multiple-sections type of questions, but I didn't see one that covers this case.

2

5 Answers 5

35

Here's a solution with the biblatex package. The following shows how to do it. Make sure you run bibtex on all auxiliary files, all *[0-9]-blx.aux files.

\documentclass{article}

\usepackage{filecontents}
\usepackage{biblatex}

\begin{filecontents}{myrefs.bib}
@Book{Knuth:1990,
    author    = {Knuth, Donald E.},
    title     = {The {\TeX}book},
    year      = {1990},
    isbn      = {0-201-13447-0},
    publisher = {Addison\,\textendash\,Wesley},
}

@Book{Lamport:94,
    author    = {Lamport, Leslie},
    title     = {\LaTeX: A Document Preparation System},
    year      = {1994},
    isbn      = {0-021-52983-1},
    publisher = {Addison\,\textendash\,Wesley},
}
\end{filecontents}

\addbibresource{myrefs.bib}
\begin{document}

\section{First}
    {\LaTeX} is aTuring-complete
    (procedural) markup language and
    typesetting processor~\parencite{Lamport:94}.


\printbibliography
\appendix
\section{Second}
\begin{refsection}
   The ultimate reference of {\TeX} is~\parencite{Knuth:1990}.
\printbibliography[heading=subbibliography]
\end{refsection}

\end{document}

example output

12
  • 8
    I was hoping for a solution that didn't use biblatex
    – Joe
    Commented Feb 18, 2013 at 5:46
  • @Joe Any reason why you don't want to use biblatex?
    – user10274
    Commented Feb 18, 2013 at 6:12
  • 3
    @PatrickT No, I meant bibtex.
    – user10274
    Commented May 14, 2016 at 8:34
  • 1
    Apologies, I was trying to compile it with XeLaTeX. I have successfully compiled it with PDFLaTeX and it looks just like your screenshot (a single .aux file was produced). But no luck with XeLaTeX. Since I was interested in XeLaTeX, I apparently hadn't tried with PDFLaTeX.
    – PatrickT
    Commented May 15, 2016 at 8:58
  • 1
    I deleted the comment above where I claimed that I had tried with PDFLaTeX, obviously not true. Problem came from having various shortcuts to compile with different engines and getting mixed up about which shortcut was calling which engine... sigh.
    – PatrickT
    Commented May 15, 2016 at 9:00
31

with multibibyou can define more than one bib.

\RequirePackage{filecontents}
\begin{filecontents}{myrefs.bib}
@Book{Knuth:1990,
    author    = {Knuth, Donald E.},
    title     = {The {\TeX}book},
    year      = {1990},
    isbn      = {0-201-13447-0},
    publisher = {Addison\,\textendash\,Wesley},
}

@Book{Lamport:94,
    author    = {Lamport, Leslie},
    title     = {{\LaTeX}: A Document Preparation System},
    year      = {1994},
    isbn      = {0-021-52983-1},
    publisher = {Addison\,\textendash\,Wesley},
}
\end{filecontents}

\documentclass{article}
\usepackage{multibib}
\newcites{latex}{\LaTeX-Literature}%  \citelatex, \nocitelatex, ...

\begin{document}

\section{First}
  \citelatex{Lamport:94} wrote \LaTeX.

\bibliographystylelatex{alpha}
\bibliographylatex{myrefs}

\appendix
\section{Second}
   The ultimate reference~\cite{Knuth:1990}

\bibliographystyle{plain}
\bibliography{myrefs}

\end{document}

with \newcites{suffix}{heading} you can define the special macros. The example has to be run with

pdflatex <file>
bibtex <file>.aux
bibtex latex.aux
pdflatex <file>

every additional bib needs its own bibtex run and can have a different bibstyle:

enter image description here

4
  • Works perfectly. I like this solution because it needs no additional \begin \end. Commented Mar 31, 2020 at 14:13
  • Note that there is no mechanism to avoid having the same reference in both bibliographies. If you cite the same article in both sections, make sure to use the cite command from your first section, otherwise the reference will show up in your second bibliography (even though it will still be cited according to the number in the first bibliography)
    – Andrew
    Commented Jun 24, 2020 at 13:29
  • Is it possible to define a Build Profile in TeXnicCenter that will run the four commands required to compile this file (pdflatex <file>, bibtex <file>.aux, bibtex latex.aux, pdflatex <file>), instead of having to run them in the Command Prompt? I tried to export the LaTeX-->PDF profile and modify it to add the second bibtex line, but TeXnicCenter gave an error when I tried to import the modified *.tco file, saying that it expected a "makeIndexCommand" instead of a second "bibTexCommand". Commented Jul 23, 2021 at 16:58
  • It looks like this can't work with TeXShop (on macs), because we don't have a pdflatex style run?
    – Leah Bevis
    Commented May 30, 2022 at 5:05
20

You can use the bibunits package and structure your document as follows

\documentclass{book}
\usepackage{bibunits}

\defaultbibliography{<bib-file>}
\defaultbibliographystyle{<preferred bib style>}

\begin{document}
\begin{bibunit}
Main Text
\putbib
\end{bibunit}

\begin{bibunit}
Appendix
\putbib
\end{bibunit}
\end{document}
5
  • It is not clear to me how do you put the two different bibliographys as requested. As is, this seems to print the same biblio in two different places.
    – leo
    Commented Feb 18, 2013 at 4:41
  • 2
    This is the standard way bibunit works, \putbib just prints a list of references for the \cite commands in the current unit. Commented Dec 5, 2013 at 20:11
  • this simply does not work for me
    – Sim
    Commented Sep 22, 2021 at 14:34
  • Forgot to mention that it creates separate bu*.aux files that need to be compiled with bibtex.
    – Zohar Levi
    Commented Jan 27, 2022 at 22:23
  • Is it possible to continue numbering between bibliographies so that the second bibliography picks up where the first left off? Commented Jun 21, 2023 at 14:16
1

The problem with the answers here is that the the choice is not really automatic: one needs to either use different commands/bib files, and even in that case duplicated items between main body and references are not removed. Here is a different solution for biblatex, which combines filters and refsegment.

enter image description here

\documentclass{article}

\usepackage{filecontents}
\usepackage[style=trad-alpha]{biblatex}

\begin{filecontents}{myrefs.bib}
@Book{Knuth:1990,
    author    = {Knuth, Donald E.},
    title     = {The {\TeX}book},
    year      = {1990},
    isbn      = {0-201-13447-0},
    publisher = {Addison\,\textendash\,Wesley},
}

@Book{Lamport:94,
    author    = {Lamport, Leslie},
    title     = {\LaTeX: A Document Preparation System},
    year      = {1994},
    isbn      = {0-021-52983-1},
    publisher = {Addison\,\textendash\,Wesley},
}
\end{filecontents}

\addbibresource{myrefs.bib}
\defbibfilter{appendixOnlyFilter}{
  segment=1 % Segment 1 will be chosen to be the one in appendix
  and not segment=0 % Default segment is 0
}

\begin{document}

\section{Main Body}
{\LaTeX} is aTuring-complete (procedural) markup language and typesetting processor~\cite{Lamport:94}.

\printbibliography[segment=0]
\appendix
\newrefsegment %% <== increases the segment number (0 by default)

\section{Appendix}
The ultimate reference of {\TeX} is~\cite{Knuth:1990} and \cite{Lamport:94}, which should NOT be cited in this section.
\printbibliography[heading=subbibliography,filter=appendixOnlyFilter]

\end{document}
0

Another possible solution is to simply compile the body and the appendix separately, and then append them on the back end. A basic script to do this would look like:

latex body.tex
bibtex body.aux
latex body.tex
latex body.tex
dvips -P pdf body.dvi
ps2pdf body.ps

latex appendix.tex
bibtex appendix.aux
latex body.tex
latex body.tex
dvips -P pdf appendix.dvi
ps2pdf appendix.ps    

gs -dBATCH -dNOPAUSE -q -sDEVICE=pdfwrite -dPDFSETTINGS=/prepress -sOutputFile=main.pdf body.pdf appendix.pdf

In this situation, you would need to surround your appendix.tex with appropriate preamble, \begin{document}, and \end{document}.

The last command (appending via Ghostscript) is taken from the second-ranked answer here. You need to run latex at least thrice, as explained here.

A streamlined script that I wrote (and regularly use), and which you can run from your Linux terminal, is available on GitHub here. It has a few more bells and whistles (syntax checking, deletion of temporary LaTeX compilation files, etc.). The basic syntax is combiner body.tex appendix.tex master.pdf.

You must log in to answer this question.

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