[texhax] The Optional usage of the Packages

Lars Madsen daleif at imf.au.dk
Thu Aug 16 15:45:24 CEST 2007


zoran.nikolic at ubs.com :

>
> Hello Folks,
>
> I really apologize to contact you directly
> but I realy went over everything I found on the web about my issue...
>
> The aim:
> Depending on the options passed to my class, I'd like
> a various packages to be used or not used - checkout what I tried...
>
> \NeedsTeXFormat{LaTeX2e}
> \ProvidesClass{sciencearticle}[2007/08/15 The Science Article Class]
>
> \DeclareOption{chem}
>  {
>    \typeout{Providing packages for the Chemistry}
>    \RequirePackage[version=3]{mhchem}
>  }
> \DeclareOption{chemext}
>  {
>    \typeout{Providing packages for the Chemistry - Extended}
>    \RequirePackage[version=3]{mhchem}
>    \RequirePackage{epic}
>    \RequirePackage{chemstr}
>    \RequirePackage{carom}
>    \RequirePackage{hetarom}
>    \RequirePackage{hetaromh}
>    \RequirePackage{lowcycle}
>    \RequirePackage{ccycle}
>    \RequirePackage{hcycle}
>    \RequirePackage{aliphat}
>    \RequirePackage{locant}
>    \RequirePackage{polymers}
>    \RequirePackage{methylen}
>    \RequirePackage{fusering}
>    \RequirePackage{sizeredc}
>  }
>
> \ProcessOptions\relax
> \LoadClass[a4paper, twoside, 11pt]{article}
>
> This is not working and the message is:
> ! LaTeX Error: \RequirePackage or \LoadClass in Options Section.
>
> Could somebody please help me on how to bind the packages
> optionally.
>
> Many thanks in advance
>
> Zoran Nikolic
>
>

create switches, i.e. if constructions, use the option deplarations to set 
the vaiable to 'true' and then later do a

\ifchemext
...load packages...
\fi


/daleif


More information about the texhax mailing list