# Reference to a entry in bibliography without generating it

In review articles it often happens that a figure is taken from another document which is mentioned in the \caption by a \cite macro. If such a caption preceeds the first occurence of the corresponding \cite in the text, the number is increased when the caption is processed by TeX. Since the reader does not read the caption first, but will proceed with the main text until the next paragraph or headline, the numbering in the text has a gap.

Thus, I would like to reference an entry in the bibliography without creating it. a simple \ref does not work. Any ideas?

Update: The following exmaple produces the desired numbering in the text, but no citation in the caption. As soon as I use the comment version in the \caption, the numbering is not as I want it. (Don'T forget to re-run bibtex while testing).

\begin{filecontents}{./mybib.bib}
@misc{foo,
author={Foo},
title={Foo},
}
@misc{bar,
author={Bar},
title={Bar},
}
@misc{baz,
author={Baz},
title={Baz},
}
\end{filecontents}

\documentclass{article}
\usepackage[super]{natbib}
\bibliographystyle{unsrtnat}
\begin{document}

\begin{figure}
\caption{Taken from Foo\ref{foo}}
%  \caption{Taken from Foo\cite{foo}}
\label{fig:foo}
\end{figure}

Bar\cite{bar} and baz\cite{baz} have done some fascinating research,
which is best summarized as shown in Figure~\ref{fig:foo} (originally
by Foo\cite{foo}).

\bibliography{./mybib}
\end{document}

• I have updated the example to make it more clear what I want to achieve. (Remember to re-run bibtex). The numbering of the citations in the text is now as I want, but as soon as I use the \cite in the \caption, it changes. (Again, re-run bibtex). Sep 29, 2017 at 23:19

Here is a solution that works with natbib when loaded with the super option; another one that works with standard LaTeX, as well as with natbib and the numbers option, is at the bottom.

\begin{filecontents}{./mybib.bib}
@misc{foo,
author={Foo author},
title={Foo title},
}
@misc{bar,
author={Bar},
title={Bar},
}
@misc{baz,
author={Baz},
title={Baz},
}
\end{filecontents}

\documentclass{article}
\usepackage[super]{natbib}
\bibliographystyle{unsrtnat}

% we patch the \bibcite macro to store the number of the
% citation
\usepackage{xpatch,xstring,etoolbox}
\makeatletter
\xapptocmd{\bibcite}{%
\StrLeft{#2}{1}[\knall]%
\StrRemoveBraces{\knall}[\peng]
\global\csedef{defcite@#1}{\peng}
}{}{}

% the \deferredcite macro calls up the number stored above, if available;
% it does not itself cause a citation to be created.
\newcommand{\deferredcite}[1]{%
\ifcsdef{defcite@#1}{\textsuperscript{\csuse{defcite@#1}}}{?}}
\makeatother

\begin{document}

\begin{figure}
\caption{Taken from Foo\deferredcite{foo}}
\label{fig:foo}
\end{figure}

Bar\cite{bar} and baz\cite{baz} have done some fascinating research,
which is best summarized as shown in Figure~\ref{fig:foo} (originally
by Foo\cite{foo}).

\bibliography{./mybib}
\end{document}


Here a solution for standard LaTeX without natbib. Output is identical, except that in-text citations are in brackets rather than as superscript.

\documentclass{article}
\bibliographystyle{ieeetr} % to sort in order of appearance

\usepackage{etoolbox}
\makeatletter
\let\oldbibcite\bibcite
\renewcommand{\bibcite}[2]{%
\oldbibcite{#1}{#2}%
\global\csedef{defcite@#1}{#2}}

\newcommand{\deferredcite}[1]{~[\ifcsdef{defcite@#1}{\csuse{defcite@#1}}{?}]}

\makeatother

\begin{document}

\begin{figure}
\caption[Taken from Foo]{Taken from Foo\deferredcite{foo}}
\label{fig:foo}
\end{figure}

Bar~\cite{bar} and baz~\cite{baz} have done some fascinating research,
which is best summarized as shown in Figure~\ref{fig:foo} (originally
by Foo~\cite{foo}).

\bibliography{./mybib}
\end{document}

• I've upvoted your answer. You may want to clarify, though, that the first solution expects natbib to be loaded with the option super. The second solution appears to work just fine with natbib if the package is loaded with the option numbers.
– Mico
Sep 30, 2017 at 3:49
• I have accepted your answer since it works for the example I've provided. However, the example was slightly oversimplified. If you change the author of the foo bibentry to author={Foo, F and Bar, B and Baz, B} it will no longer work since \StrRemoveBraces fails. Sep 30, 2017 at 8:28
• @PatrickHappel - I just tried it, and it works for me. In the aux file, I see \bibcite{foo}{{3}{}{{Foo et~al.}}{{Foo, Bar, and Baz}}}. From this line, \StrLeft should extract {3}, and the \StrRemoveBraces should strip the braces from this part only. Can you post the corresponding line from your aux file? Sep 30, 2017 at 12:16
• @MichaelPalmer: It depends on the bibliographystyle. Im my case, et al. is surrounded by \emph, which makes \StrRemoveBraces fail. Oct 1, 2017 at 20:05
• @PatrickHappel - I just don't see how that works. Can you update your question so as to show the non-working example? Oct 1, 2017 at 22:23