3

I am writing a package which requires the xcolor package with table option. It is loaded in the package with

\PassOptionsToPackage{table}{xcolor}
\RequirePackage{xcolor}

which works if my package is loaded after the user loaded xcolor itself. However if my package is loaded before the user loads xcolor, the user gets an option clash.

I can not load xcolor at the beginning of the document. In that case more or less the whole package can only be loaded at the beginning of the document.

How can/should this be solved?

3
  • 3
    If your package is loaded after xcolor the table option will not be passed to xcolor.
    – egreg
    Nov 17, 2011 at 13:38
  • Are you sure it works if the user load xcolor before your package? I would have expected the table-option to be ignored in this case. Nov 17, 2011 at 13:45
  • I tried to make it clearer in your question that you're talking about writing a package, in order to make it more helpful and more findable for other users; hope that's ok.
    – doncherry
    Nov 17, 2011 at 13:50

1 Answer 1

2

try

\RequirePackage{colortbl}
\RequirePackage{xcolor}

instead. xcolor does the same with the option table

7
  • what happens if the user loaded colortlb after xcolor? Then both of my commands will be ignored, but xcolor does not know colortlb was loaded, or am I wrong? Nov 17, 2011 at 13:55
  • As I alread wrote, xcolor does nothing else than a RequirePackage{colortbl}. It is not important when colortbl is loaded, by the user or by your package
    – user2478
    Nov 17, 2011 at 14:04
  • 1
    According to the documentation colortbl should not be loaded after xcolor. So you should use \RequirePackage[table]{xcolor}. This can give option clash errors, but all other possibilies mean that your user can load the package(s) in the wrong order without getting any warning. Nov 17, 2011 at 14:10
  • The reason why I load it explicitely before xcolor and do not need the optional argument. If a user loads both the other way round before, then there is already no chance to change the behaviour
    – user2478
    Nov 17, 2011 at 14:14
  • 1
    ? I'm not getting it. Above you make the impression that loading colortbl and xcolor independently is the same that using the option table. But this is simply not true. \rowcolors is only defined if you use table. Also it is still unclear if the loading order xcolor (by user) colortbl (by package) gives the same result than colortbl xcolor (both by package). Nov 17, 2011 at 14:59

You must log in to answer this question.

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