Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

Here's the problem.

I have the main text of a document which includes a citation late in the document, say \cite{ref20}.

One of my figure captions has in it, the \cite{ref20}. What happens is that the number given to ref20 is now entirely dependent upon the location of the figure in the document.

What I want is the numbering to be the same regardless of the position of the figure, so that a version with all figures grouped at the end has the same numbering.

Any ideas?

share|improve this question
1  
Although I can't test this myself at the moment, how about adding \nocite{ref20} outside (say, before) the figure environment? –  Werner Feb 14 '12 at 16:50
    
You don't seem to be constrained in the way your references are sorted. Can you simply use alphabetic sorting of the references? That should take care of it. –  Michael Palmer Feb 14 '12 at 20:02
add comment

1 Answer

If the BibTeX style orders the citations by first appearance then what you have to ensure is that this first appearance is in the order you want. In theory this could be done by using \nocite, but in the worst possible scenario that means that you have to put \nocitedeclarations for all cites in the right order into the preamble . So that is most likely not a good option.

As an alternative you could ensure that a certain cite is simply not seen by BibTeX, in other words does not produce an entry in the .aux file. Of course that only works if that cite is at least once cited in a regular way somewhere in the document, but according to your problem that is the case.

So here is the code to do just that:

\documentclass{article}

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

\begin{document}
\cite{foo}
\ignorecitefornumbering{\cite{bar}}
\cite{baz}
\cite{bar}
\end{document}

In the argument of \ignorecitefornumbering you place the citation command you want to use. Of course you could change that to even include the \cite command internally, but then you either need to take care of the optional argument or have non available. Also in that case alternate citation commands (from natbib, for example) wouldn't work. So I guess the above is actually the better approach.

If you run this, then your .aux file will contain

\relax 
\citation{foo}
\citation{baz}
\citation{bar}

i.e., the first reference to bar does not show up.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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