General\cite command in \tabular

LaTeX specific issues not fitting into one of the other forums of this category.
Post Reply
davidcollins001
Posts: 4
Joined: Fri Jun 20, 2008 11:02 am

\cite command in \tabular

Post by davidcollins001 »

Hi,

I was not sure if this should go here or in the bibtex section, so if
it is in the wrong place I apologise.

I am trying to make a table with a column of references using the \cite
command. Everything works find until I have a reference with an & in it. I
backslash escape it, which works fine in the text but causes latex to fail in
the tabular environment with the following error

! Missing \endcsname inserted. <to be read again>
\& l.8 ...
&\cite{2009A\&A...494L..21P}
&none &- \\

I have done some googling and I understand this is a tex error because it is
trying to expand the '\' in the cite or something like that. I can't find a
solution to this and I am reluctant to remove all the '&'s from my
references (I have quite a few). I have also tried \protect, but it fails in
the same way.

Does anyone have any idea how I can get around this, or even if a solution
is not possible? Here is a working example. It works when the line starting
0.8 is commented, but not otherwise.

----------8<--------------
documentclass{article}
\begin{document}
\begin{tabular*}{\textwidth}{c@{\extracolsep{\fill}}cll}
0.5 &\cite{2008ApJ...689.1199N} &1.2 &- \\
0.8 &\cite{2009A\&A...494L..21P} &none &- \\
\end{tabular*}
\end{document}
--------->8-----------

By the way I am using pdfTex
Thanks David

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org

NEW: TikZ book now 40% off at Amazon.com for a short time.

Stefan Kottwitz
Site Admin
Posts: 10345
Joined: Mon Mar 10, 2008 9:44 pm

\cite command in \tabular

Post by Stefan Kottwitz »

Hi David,

try grouping with braces:

Code: Select all

...&{\cite{2009A&A...494L..21P}}&...
Stefan
LaTeX.org admin
Post Reply