0

I am writing a custom class and want to use some option keywords (such as draft) that are also shared by some packages that I need to import, which leads to unintended results. This is because, by default, all options provided to a class are considered global and passed on to all imported packages.

This seems to me to be an incredible design flaw.

How, as a mere mortal, non-omniscient person writing a class am I supposed to know the options of all packages that exist and will ever exist in order to avoid a name clash?

Currently, I am aware of 2 possible resolutions:

  1. Give all options that are intended to be local some very verbose names like <myclass>_<options>
  2. Delete the options from the global options list right after processing them. Very hacky! (cf. egreg's answer)

Neither of those is really satisfactory, so in the words of Raymond Hettinger: There must be a better way!

PS: I am using kvoptions to process options

Related Questions:

  • you may not like the design but that is the design and I think is wrong to change it. If your class included graphicx and the user uses [draft] the user has a right to expect that graphics get processed in draft mode. If you delete it from the global options they ave no easy way to load graphics in draft mode as your class is force loading it in final mode. – David Carlisle Oct 03 '20 at 17:15
  • 1
    @DavidCarlisle I agree, but that could have been easily solved by having something like \documentclass[<global options>][<local options>]{myclass} where draft could possibly occur in both and then have the local version encoded inside via \myclass@option like for example kvoptions does. – Hyperplane Oct 03 '20 at 17:21
  • 2
    possibly but we had to design this interface right at the start of 2e before there were more than 3 or 4 classes , and also got to the point that fi we added anything something would have to go (there were less than 100 csnames left to fit latex+amsmath into emtex....). It is what it is. If it is causing issues don't use the global options use a separate setup command, as in \documentclass{wibble} \wibblesetup{yes=no} like \KOMAoptions{...} in the koma classes. – David Carlisle Oct 03 '20 at 17:26

0 Answers0