I have seen that I cannot require a package twice. How can I have an option that activates the availability of colour names


But if the option is missing the style file uses this instead

  • 1
    you have two answers but as already previously explained you would be better to not use the options, or your package will give errors if loaded after xcolor Oct 7, 2023 at 7:37
  • I activate xcolor because I want to use colours in my style file. Is there a more appropriate way to do this ?
    – Veak
    Oct 7, 2023 at 12:55
  • 1
    It's not like you have not been warned of option clashes before tex.stackexchange.com/questions/697769/… tex.stackexchange.com/questions/659029/… tex.stackexchange.com/questions/660440/… Oct 7, 2023 at 13:30
  • 1
    specifically for those options there is not a lot of point in using more than one, and within a package you should mostly avoid forcing options as it restricts the end user from loading the package directly. If you just have RequirePackage{xcolor} you can use colours in your package and the end user can use whatever options to xcolor he or she wants by loading xcolor first with suitable options. Oct 7, 2023 at 13:48
  • 1
    The problem is not lack of internals, it's just a bad design of your package to over-constrain the use of other packages. Oct 7, 2023 at 13:50

2 Answers 2


Any number of ways. Use a classic option or pick the key-value interface of your choice. Here's expl3's:

\ProvidesPackage{veak}[veak v0.1]
\keys_define:nn { veak }
  colour ~ names .bool_set:N = \l_veak_colour_names_bool,
  colour ~ names .default:n = true,
  colour ~ names .initial:n = false,
\ProcessKeyOptions { veak }
\bool_if:NTF \l_veak_colour_names_bool
  • Beat me to it! I was just about to paste the same. (I think you just want veak not veak.sty in the second line, though.)
    – Alan Munn
    Oct 7, 2023 at 2:12
  • @AlanMunn Sorry about that and thanks. All my files have \ProvidesPackageSVN{}[] so I almost never have to think about a regular first argument and subversion, naturally enough, includes the .sty.
    – cfr
    Oct 7, 2023 at 2:36

One way to do this is to conditionally call the command


before loading the package. It also lets you combine multiple options that add different options to xcolor. This technique is also useful for fixing up an option clash inside a .cls file.

You must log in to answer this question.

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