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?

  • Welcome to tex.stackexchange! You can format inline code in your question with backticks (`). – Caramdir Jan 3 '11 at 15:34
  • 1
    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
  • 1
    Maybe you want to instead look at the the aux or bbl files? – Matthew Leingang Jan 3 '11 at 17:23
  • 5
    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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy