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:
- Give all options that are intended to be local some very verbose names like
<myclass>_<options> - 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:
[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\documentclass[<global options>][<local options>]{myclass}where draft could possibly occur in both and then have the local version encoded inside via\myclass@optionlike for examplekvoptionsdoes. – Hyperplane Oct 03 '20 at 17:21\documentclass{wibble} \wibblesetup{yes=no}like\KOMAoptions{...}in the koma classes. – David Carlisle Oct 03 '20 at 17:26