# [Tex/LaTex] \cite that tolerates whitespace

cite-packagecitingspacing

Is there a package that provides a variant of the \cite command that tolerates arbitrary whitespace? That is, I would like to be able to write something like

\cite{foo, bar, baz}


or

\cite{
foo, bar, baz,
baf, bah, bam
}


without any ill effect.

To keep things interesting, it should work flawlessly with other commonly used packages such as cite, natbib, and hyperref, and it should also work without those packages.

Edit: Examples…

test.bib:

@MISC{bar,
author={Bar Bar},
title={Bar},
year={1988}
}

@MISC{foo,
author={Foo Foo},
title={Foo},
year={1988}
}


test1.tex:

\documentclass{article}
\usepackage[numbers,sort&compress]{natbib}

\begin{document}
\cite{foo, bar }.

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


Here pdflatex test1 works OK but bibtex test1 gives the following error:

White space in argument---line 2 of file test1.aux
: \citation{foo,bar
:                   }
I'm skipping whatever remains of this command


test2.tex:

\documentclass{article}

\begin{document}
\cite{foo, bar }.

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


Again, pdflatex test2 works OK but bibtex test2 produces the following error:

White space in argument---line 3 of file test2.aux
: \citation{bar
:               }
I'm skipping whatever remains of this command


test3.tex:

\documentclass{article}
\usepackage{cite}

\begin{document}
\cite{foo, bar }.

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


This seems to work fine! But naturally it has all the side-effects of the cite package as well, which isn't always compatible with other packages.

Sorry if I'm being stupid, but for me the simple answer is: It works if I use the cite package. (This works flawlessly with cite, but it doesn't work without cite ;-).)