[texhax] Changing \DeclareOption of some other packages

Heiko Oberdiek heiko.oberdiek at googlemail.com
Sat Jun 11 16:59:14 CEST 2011


On Sat, Jun 11, 2011 at 11:40:10PM +1000, Vafa Khalighi wrote:

> Say a package has:
> 
> \DeclareOption{rightcaption}{\def\right{right}}
> 
> but in my package, I want to change that:
> 
> \@ifpackageloaded{...}{\DeclareOption{rightcaption}{\def\right{Left}}{}
> 
> How can you do that?

You can't. If the package is loaded then the package options are processed
and will not be executed later anymore.

But you can test, if the package was loaded with the option:

\@ifpackagewith{otherpackage}{rightcaption}{%
  \renewcommand*{\rightcaption}{Left}%
}{}

In case of global option, you can catch the option yourself in the
package.

Yours sincerely
  Heiko Oberdiek


More information about the texhax mailing list