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

0

2 Answers 2

4

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}
2
  • That's exactly what I wanted, thanks a lot. Smart solution.
    – innisfree
    Sep 10, 2013 at 13:34
  • Is there a similar solution when using biblatex? Oct 31 at 11:36
0

Similar to Werner's answer, this one by Frank Mittelbach proposes a command that takes the citation call itself:

\makeatletter
\def\ignorecitefornumbering#1{%
     \begingroup
         \@fileswfalse
         #1%                     % do \cite comand
    \endgroup
}
\makeatother

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.