6

Question

Is there a way to exclude some bibliography entries when using

\nocite{*}

to list all entries?

MWE

\documentclass{article}

\usepackage{cite}
\usepackage{filecontents}

\begin{filecontents}{bibliography.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},
}
% And even more bibliography...
\end{filecontents}

\begin{document}
  Some text citing \textsc{Author}\cite{A01} but not \textsc{Buthor} and \textsc{Cuthor}. Though \textsc{Buthor} (and all other entries -- not shown in this example -- excludig \textsc{Cuthor}) should be in the references.
  Since there are even more entries in the real bibiography, \textbf{\textbackslash{}nocite\{B02\}} will not work. So the best thing to use might be \textbf{\textbackslash{}nocite\{*\}}, but unfortunately this also "cites" \textsc{Cuthor}.

% \nocite{*}
  \bibliographystyle{plain}
  \bibliography{bibliography}{}
\end{document}
1
  • 1
    An answer that works with biber would be nice.
    – Toothrot
    Feb 1, 2017 at 0:28

2 Answers 2

5

This can be done using the biblatex package rather easily. While biblatex is not compatible with the cite package, it is quite extensible as to how both the citations and the bibliography items appear, and you are able to implement just about anything you can do with cite.

For this particular problem, you can define a category, exclude, and remove the entries contained in that category when you print the bibliography. This example still uses bibtex as the backend, so you still need latex>bibtex>latex>latex to compile. (The new backend, biber, allows you to do even more, and is worth looking into.)

\documentclass{article}

%\usepackage{cite} % Not compatible with biblatex
\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},
}
% And even more bibliography...
\end{filecontents}

\usepackage[backend=bibtex]{biblatex}
\addbibresource{\jobname.bib}
\DeclareBibliographyCategory{exclude}
\addtocategory{exclude}{C03}

\begin{document}
  Some text citing \textsc{Author}\cite{A01} but not \textsc{Buthor} and \textsc{Cuthor}. Though \textsc{Buthor} (and all other entries -- not shown in this example -- excludig \textsc{Cuthor}) should be in the references.
  Since there are even more entries in the real bibiography, \textbf{\textbackslash{}nocite\{B02\}} will not work. So the best thing to use might be \textbf{\textbackslash{}nocite\{*\}}, but unfortunately this also "cites" \textsc{Cuthor}.

\nocite{*}
% \bibliographystyle{plain} % Not with biblatex
\printbibliography[notcategory=exclude]
\end{document}

The result:

bibliography

3
  • That's a really nice nice solution! I'd have one further question to this answer: Is it somehow possible to have an underscore in the (f.e.) filename of the bibliography? I already tried the "underscore"-package, but this messed up the includegraphics which were including underscores as well.
    – lcnittl
    May 30, 2014 at 21:45
  • I'd recommend asking a new question with your followup; you can refer back to this questions for context. Generally, underscores in the filename of the bib-file itself should not give an error as far as I have observed.
    – cslstr
    May 31, 2014 at 13:14
  • Alright, I'll check if I get it to work, and atherwise make a new question (Might really be a good idea :) ). Thanks
    – lcnittl
    May 31, 2014 at 20:39
0

The option \nocite{*} will include on bibliography all the entries on .bib, even those that were already cited or those you don't want to include on reference. Yes, there are options to exclude those unwanted references from bibliography even haven used \nocite{*}, but, as far as I understand your problem, it would be even more difficult. The options you have are:

  1. Comment out on .bib the references you don't want to see on bibliography, and then use \nocite{*};
  2. Create new commands or edit the citation style to remove from bibliography references you don't want;
  3. Use \nocite{entry} for each reference you want to include on bibliography, but not on text, or use one \nocite{entry1, entry2, ...} at the end of the text.

Your best choices, I think, are 1 or 3.

See the changed MWE below:

\documentclass{article}

\usepackage{cite}
\usepackage{filecontents}

\begin{filecontents}{bibliography.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},
}
@misc{D04,
  author = {Duthor, D.},
  year = {2004},
  title = {Dave},
}
@misc{T05,
  author = {Tuthor, T.},
  year = {2005},
  title = {Tango},
}
\end{filecontents}
\begin{document} 
  Some text citing \textsc{Author}\cite{A01} but not \textsc{Buthor}\nocite{B02} (with \verb|\nocite{B02}| it will not cite on text but include the reference on bibliography) and specially \textsc{Cuthor} (not on text, nor on bibliography). 

    If you find it unpractical to use \verb|\nocite{entry}| for each reference use one \verb|\nocite{entry1, entry2, ...}| at the end of the text. 

    \nocite{B02,D04,T05}

  \bibliographystyle{plain}
  \bibliography{bibliography}{}
\end{document}

The correspondent output is: enter image description here

2
  • Unfortunately 1. does not work for shared or central stored bibliographies. 3. might be very unconvenient, if there are - lets say - about 30 entries in the bibliography. Is 2. considered to be something like @cslstr did in his answer? But maybe these are the only options to get it done with cite-package - unfortunately not very convenient ones... :)
    – lcnittl
    May 30, 2014 at 21:53
  • 1
    yes, 2. would be something like @cslstr proposed, but with cite package. I'd always prefer to mention explicity which author should appear on bibliography rather than include all of them with \nocite, specially if you have many entries in the .bib file. I use to use the same .bib file for almost all my documents (excluding those that I submit for publications) and \nocite seems to me a awful choice (remembering also that include on bibliography references you didn't cite in the text is nothing scientific).
    – Claudia
    May 31, 2014 at 0:00

You must log in to answer this question.

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