# Compare \CurrentOption with a string

I encountered a problem that I want to compare the \CurrentOption with a string.

In the .tex file I have a code below.

\usepackage[en-ver]{cufestatletter}


Then I want to use \ifx to determine whether I use en-ver option or not. This is the code I use now.

\ifx \CurrentOption \en-ver
\else
\fi


I have declared the option en-ver using:

\DeclareOption{en-ver}{\def\cufestatlogo


However, this \ifx code doesn't work at all.

-
Welcome to TeX.SE! Sounds like an interesting question :) Do you think you could turn your snippets into a MWE It'll really help folks who wish to look at your problem. Welcome :) – cmhughes Dec 9 '12 at 21:33

There are several ways to test for the option en-ver:

• Testing the effect that \cufestatlogo will be defined by the option:

\let\cufestatlogo\relax % initialization
\DeclareOption{en-ver}{\def\cufestatlogo{...}}
...
\ifx\cufestatlogo\relax
% option en-ver not used
\else
% option en-ver used
\fi


\newif\ifcufestatlogo
\DeclareOption{en-ver}{%
\def\cufestatlogo{...}%
\cufestatlogotrue
}%
...
\ifcufestatlogo
% option en-ver used
\else
% option en-ver not used
\fi

• LaTeX's \@ifpackagewith{<package name>}{<option list>}{<then>}{<else>}:

\@ifpackagewith{cufestatletter}{en-ver}{%
% option en-ver used
}{%
% option en-ver not used
}

-
Hi, Heiko, It works. Thank you. – Xiaoxiao Sun Dec 10 '12 at 0:26