Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

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?

share|improve this question
3  
If your package is loaded after xcolor the table option will not be passed to xcolor. –  egreg Nov 17 '11 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. –  Ulrike Fischer Nov 17 '11 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 '11 at 13:50

1 Answer 1

up vote 1 down vote accepted

try

\RequirePackage{colortbl}
\RequirePackage{xcolor}

instead. xcolor does the same with the option table

share|improve this answer
    
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? –  Matthias Pospiech Nov 17 '11 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 –  Herbert Nov 17 '11 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. –  Ulrike Fischer Nov 17 '11 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 –  Herbert Nov 17 '11 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). –  Ulrike Fischer Nov 17 '11 at 14:59

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.