I'm pretty new to advanced LaTeX coding and therefore may not have a perfectly specific question. I hope you can help me anyway: I want to maintain different preambles at once. They can be seen as templates for different styles. So I wanted to create a package(?) with options that executes the given template. My Idea was to call this Package with e.g. \RequirePackage{templates}[Wissenschaft]. I tried following code for the package templates:

\ProvidesPackage{templates}[28.05.2021 templates.sty]

\DeclareOption{Wissenschaft}{ \setboolean{Wissenschaftbool}{true}}

\DeclareOption{template1}{ \setboolean{template1bool}{true}}




My problem is, that both options are always executed. If I comment one option, the code only executes one options, exactly as I want it to. Can someone help me getting the code fixed, so that only the given options gets executed?

  • You are \Execute-ing both options, so you are setting them true. Remove the two \ExecuteOptions and then only the ones that will be in \RequirePackage[options]{package} will be true
    – Rmano
    May 31, 2021 at 8:50

1 Answer 1


You seem to want \ProcessOptions.

\ProvidesPackage{templates}[2021/05/28 templates]






The user will call


to load the Wissenschaft option.

If the structure of the package has a core subdirectory, you don't need to specify it in the \RequirePackage call, because TeX systems generally do recursive search. But there's no need to use such structure. It's better to use specific names, like in the code above.

By the way, the release date should be specified in the form




otherwise LaTeX will not be able to extract it.

  • I can't edit the typo \iftemplate@templateone to \iftemplates@templateone. But for the rest: Thank you very much! Now it works!
    – Titanlord
    May 31, 2021 at 9:22
  • 1
    @Titanlord Sorry for the typo, which I've fixed.
    – egreg
    May 31, 2021 at 9:27

You must log in to answer this question.

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