# Citation on a range of bibitems is possible?

Say I want to cite a range of authors like this:

[3-11]

When I write \cite{bibitem3-bibitem11} then it does not compile in LaTeX, so I write \cite{bibitem3,bibitem4,...,bibitem11}. But this is very big and not nice. How I should do the range of citations?

-
Welcome to tex.SE Narek. I’ve added some formatting to your otherwise excellent question. Feel free to look at the source code of the question (there’s a little “edit” link below the question which lets you look at the code) to see how to apply these formattings yourself. – Konrad Rudolph Jan 28 '11 at 11:36

You should not name your references bibitemn, but use a short but meaningful key, like author + year. There is no real nice way to avoid long \cite{...} calls in your text. There are no packages I know of for this case, because no one uses that naming scheme.

If you really want to do it you could use a for loop for it, e.g. the one provided by pgffor. It allows the use of ... to define ranges. See the pgf manual for the full syntax:

\documentclass{article}

\usepackage{pgffor}
\makeatletter
\newcommand*\rcite[1]{%
\def\@gtempa{}%
\foreach \n in {#1} {%
\edef\@tempa{,bibitem\n}%
\expandafter{\@tempa}%
}%
\edef\@gtempa{{\expandafter\@gobble\@gtempa}}%
\expandafter\cite\@gtempa
}
\makeatother

\begin{document}

% 3-10
\rcite{3,...,10}

% 2, 5-10
\rcite{2,5,6,...,10}

% 3, 5, 7, 9
\rcite{3,5,...,10}

\end{document}

-