1

I am using BibTeX with natbib. My style file orders my bibliography in the order in which articles were cited. Occasionally, however, I want an \cite to be ignored for the purposes of the bibliography order, but fully working otherwise.

Minimal working example:

\documentclass{article}
\usepackage[square,numbers,sort]{natbib}
\begin{document}
\cite{c} % Want to cite, but ignore for purpose of bibliography order.
\cite{a}
\cite{b}
\cite{c}
\bibliographystyle{unsrt}
\bibliography{ex}
\end{document}

with ex.bib:

@article{a, author="a"}
@article{b, author="b"}
@article{c, author="c"}

results in:

enter image description here

as expected. I want to replace that first citation with a new command, say \ignorecite so that the order is a,b,c, and so that the order in the main document is 3,1,2,3

2

All you have to do is remove the capability to write a citation to the .aux file. This is achieved by momentarily setting \@fileswfalse:

\newcommand{\ignorecite}[1]{{\@fileswfalse\cite{#1}}}%

With the entire \cite command still in tact, hyperlinks and formatting functions as usual.

enter image description here

\documentclass{article}

% Write bibliography items to file
\usepackage{filecontents}% http://ctan.org/pkg/filecontents
\begin{filecontents*}{ex.bib}
@article{a, author="a"}
@article{b, author="b"}
@article{c, author="c"}
\end{filecontents*}

\makeatletter
\newcommand{\ignorecite}[1]{{\@fileswfalse\cite{#1}}}%
\makeatother
\usepackage[square,numbers,sort]{natbib}% http://ctan.org/pkg/natbib
\usepackage{hyperref}% http://ctan.org/pkg/hyperref
\begin{document}
\ignorecite{c} % Want to cite, but ignore for purpose of bibliography order.
\cite{a}
\cite{b}
\cite{c}
\bibliographystyle{unsrt}
\bibliography{ex}
\end{document}
  • That's exactly what I wanted, thanks a lot. Smart solution. – innisfree Sep 10 '13 at 13:34

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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