TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Is it possible to load some package from a .sty file only if some option is selected?

(Naive approach \DeclareOption{something}{\RequirePackage{something}} doesn't work.)

share|improve this question
up vote 13 down vote accepted

Use \if... switches, I do something like



I haven't myself completely figured out how the "options" mechanism works, or why your example doesn't, but I guess it has to do with the precise moment when the options are being executed and the state of TeX's context when that happens.

share|improve this answer

Your Answer


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.