TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I would like to perform some string manipulation (using the xstring package) on the result of a \cite{} (the bib package is given to me, and wouldn't allow what I want to do without a major rewrite). However, I can't find a way to assign the result of the \cite{} to a variable. \edef doesn't work, nor does \protected@edef. Any suggestions?

share|improve this question
Welcome to tex.stackexchange! You can format inline code in your question with backticks (`). – Caramdir Jan 3 '11 at 15:34
The \cite macro is not expandable, and so you cannot do what you want in the way you want. Perhaps you might explain a bit more what manipulation you need to carry out? – Joseph Wright Jan 3 '11 at 15:52
I would like to take the result, such as "[Author et al. 2005]" and transform it to "Author et al. [2005]". For instance, natbib supports this directly (via \citet), however, the one I have to use (for a publication) doesn't allow this (it's not using \citeauthoryear internally). – J Witherspoon Jan 3 '11 at 15:59
Maybe you want to instead look at the the aux or bbl files? – Matthew Leingang Jan 3 '11 at 17:23
If it is for a publication, maybe you shouldn't tamper too much with the style of citations? (the journal might want uniformity) – Bruno Le Floch Jan 3 '11 at 18:26

If I'm understanding your comment correctly, what you really want is the output of \citet but without the parentheses around the year. In that case, you want to use \citealt.

If you want a different behavior, you should add more details.

share|improve this answer

Your Answer


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