I want an option in a package I'm writing to activate all other options. What I want is something like \usepackage[all]{mypackage} which will activate all options in mypackage (including options added later). Is there an easy way to do this? Currently, my best way to do this is to create an if for every option and setting all the ifs to true for the all option. However, this means I cannot activate the options that don't use ifs. Here is a MWE:



\newcommand{\mycommand}{\LaTeX\ }
% Some options:
\DeclareOption{option3}{\renewcommand{\mycommand}{\LaTeX\ is \textit{awsome}}}
% Activate all options:
% Unknown options:
\DeclareOption*{\PackageWarning{mypackage}{No option ‘\CurrentOption’}}



    \newcommand{\foo}[1]{\textit{#1}\par \lipsum[2]}




This is a test.

\foo{dummy text:}



As you can see, I can activate option 1 and 2 this way since they use ifs, but not option 3. Is there a way to activate option 3 without having to use an if? Also; is there a way to automaticually include new options? Say I write a new option 4:


Is there a way to automaticually activate this when using all without having to manually adjust the \if@all like this:

\@fourthoptiontrue % added this line manually

Also related: Say you want an option to activate most options, but not all options. Is it possible to activate all options with the exeption of one or more options? For example: say I want a package option most which is eqvivalent to all options (including options added in the future) except the first option. \usepackage[most]{mypackage} = \uspackage[option2,option3,option4]{mypackage}. Is this feasable?

I realised that some options might not be comatible with each other. Lets say that the fourth option is:

\newcommand{\bazbaa}{Hello there!}

which would clash with option 2 (in this case the clash can be avoided by using \providecommand instead, but you may not be able to fix all options clashes easaly). Is there a way to not include options that would clash with other options? Perhaps by an if or something?

  • 3
    \DeclareOption{all}{\ExcuteOptions{option1,option2,option3,option4}} ? Nov 24, 2022 at 13:36
  • Thanks @DavidCarlisle ! Is there maybe a way to do some sort of for loop to automaticually include the options? I was thinking something like: for option: \ExecuteOptions{option} Then maybe I can tag options that clash in some way as to not include them in the for loop?
    – Vebjorn
    Nov 24, 2022 at 13:50
  • or write a local wrapper for DeclareOption that adds to the list you declare. Nov 24, 2022 at 13:53
  • How do you write a local wrapper @DavidCarlisle ? I've not heard about it before.
    – Vebjorn
    Nov 24, 2022 at 16:01
  • 1
    @Vebjorn \newcommand\myopt[2]{\xdef\myoptlist{\ifx\myoptlist\@empty\else\unexpanded\expandafter{\myoptlist},\fi\unexpanded{#1}}\DeclareOption{#1}{#2}} and then do \expandafter\ExecuteOptions\expandafter{\myoptlist}.
    – Skillmon
    Nov 24, 2022 at 23:06

1 Answer 1


I found the comment from David Carlisle very helpful. I did something like:


You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .