I have the ISBN stored in two commands (depending of a class option)
\theisbne
\theisbnp
The boolean options of the class are defined using xifthen
\RequirePackage{xifthen}
\newboolean{@sbmcpm@print}
\setboolean{@sbmcpm@print}{true}
\DeclareOption{ebook}{\setboolean{@sbmcpm@print}{false}}
\DeclareOption{print}{\setboolean{@sbmcpm@print}{true}}
I get the selected ISBN by the command
\newcommand{\getisbn}{%
\ifthenelse{\boolean{@sbmcpm@print}}{\theisbnp}{\theisbne}%
}
If I use \psbarcode directly with \theisbne it compiles without error.
\psbarcode{\theisbne}{includetext guardwhitespace}{isbn}
But if I use \getisbn
\psbarcode{\getisbn}{includetext guardwhitespace}{isbn}
I got the following error:
! Argument of \pst@@object has an extra }.
<inserted text>
\par
l.33 ...etisbn}{includetext guardwhitespace}{isbn}
Any idea where to look?
MWE
\documentclass{article}
\usepackage{xifthen}
\usepackage{pst-barcode}
\newboolean{@sbmcpm@print}
\setboolean{@sbmcpm@print}{true}
\newcommand{\theisbne}{978-85-8337-040-6}%
\newcommand{\theisbnp}{978-85-85818-86-9}%
%%% Commands depending the options
\newcommand{\getisbn}{%
\ifthenelse{\boolean{@sbmcpm@print}}{\theisbnp}{\theisbne}%
}
\begin{document}
\psbarcode{\getisbn}{includetext guardwhitespace}{isbn}
%\psbarcode{\theisbne}{includetext guardwhitespace}{isbn}
\end{document}
