My biggest enemy is the page limit. I use short versions of my BibTeX entries in order to keep the list of references short. I now have a situation where I include the file in the journal article and also in a book. I want to use the long reference in the book and the short in the journal. I defined a boolean that is set to true if we are in the journal tex files and then defined a command that is supposed to return the short or long key depending on the value of the boolean. But somehow this does not work. Is there a way to reach my goals?
\documentclass{article}
\usepackage{natbib}
\usepackage{ifthen}
\provideboolean{jl}
\setboolean{jl}{true}
% cite alternate between the long and short citation key
\newcommand{\citekeyshortlong}[2]{\ifthenelse{\boolean{jl}}{#1}{#2}}
\begin{document}
\citet[\page 48]{\citekeyshortlong{XY-short}{XY-long}}
\end{document}
etoolbox(which I prefer as its syntax seems simpler to me) you should use a toggle:\newtoggle{jl}\toggletrue{jl}, and then\newcommand{\citekeyshortlong}[2]{\iftoggle{jl}{#1}{#2}}. – Peter Grill Nov 14 '12 at 08:42\ifthenelseis not expandable, whereas\iftogglefrometoolboxis, hence why Peter's suggestion works and yours does not. See eg Why is the ifthen package obsolete? – cyberSingularity Nov 14 '12 at 09:19