# Two different text outputs depending on some parameter definition

I am using the astronomy and astrophysics class aa.cls. I use it with either of the two options: structabstract or referee.

The first produces 2-column text, the second one-column text.

I have some figures that change appearance when I switch options.

I would like to know if it is possible to do something like this:

IF (optional argument equals structabstract) THEN

{...commands to have the figure of a certain size}

ELSE (if optional argument equals)

{...commands to have the figure of another size}

END IF


Could you help me please?

-
Related question (no exact duplicate, though): How do I conditionally execute something based on a documentclass option? – diabonas Mar 7 '12 at 11:16
The easiest way might be to define the figure width in terms of \columnwidth: \includegraphics[width=.8\columnwidth]{filename}, for instance. – egreg Mar 10 '12 at 10:56

## 2 Answers

The referee option in your class is set up as

\DeclareOption{referee}{\let\if@referee\iftrue}


So you can test is with

 \makeatletter
\if@referee TRUE CODE \else FALSE CODE \fi
\makeatother


structabstract is set up as

 \DeclareOption{structabstract}{\@oldversionfalse}


So you could use \if@oldversion ...\else ...\fi. The options oldversion and traditabstract change this switch too. I didn't check the default of the switches.

-

I prefer an alternate method that I have been using and is adapted from this answer to setting class options after documentclass, which has a few advantages:

• does not rely on the internals of the class, so will work with any document class
• allows you to change the options on the command line via latex '\def\MyClassOptions{referee}\input{doc}'

## Code:

\expandafter\ifx\csname MyClassOptions\endcsname\relax
\def\MyClassOptions{draft,twosided}
\fi
\documentclass[MyClassOptions]{article}
\usepackage{xstring}
\begin{document}
\IfSubStr{\MyClassOptions}{draft}{%
DRAFT option was used.%
}{%
DRAFT option was not used.%
}%
\end{document}

-
This is suited to personal use only. Please don't create a package for users in this way. – Ahmed Musa Mar 11 '12 at 2:42
@AhmedMusa: I don't see anything in the question indicating that the question is for creating a package. – Peter Grill Mar 11 '12 at 5:24