5

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?

5

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.

0

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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.