3

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}
lockstep
  • 250,273
Stefan Müller
  • 6,901
  • 3
  • 29
  • 61

1 Answers1

3

I recommend putting the conditional outermost, so defining the \citekeyshortlong conditionally:

\usepackage{etoolbox}
\newtoggle{jl}
\toggletrue{jl} %% Use short refs

\iftoggle{jl}{%
     \newcommand{\citekeyshortlong}[2]{#1}}{%
     \newcommand{\citekeyshortlong}[2]{#2}}

(substituting etoolbox for ifthenelse as recommended by Peter Grill - though this will work with ifthenelse).

Charles Stewart
  • 21,014
  • 5
  • 65
  • 121