1

Sometimes I need to \PassOptionsToPackage under certain conditions. Would it work if I \PassOptionsToPackage multiple times to the same package?

For example, when I write:

\PassOptionsToPackage{option1,option2}{mypackage}
\PassOptionsToPackage{option3}{mypackage}
\RequirePackage{mypackage}

what is it exactly passed to mypackage? option1,option2,option3 or only option3?

1 Answer 1

2

It will load all options. Here is an example.

\documentclass{article}
\begin{filecontents}[overwrite]{mytestpackage.sty}
\PassOptionsToPackage{dvipsnames}{xcolor}
\PassOptionsToPackage{svgnames,x11names}{xcolor}
\RequirePackage{xcolor}
\end{filecontents}
\usepackage{mytestpackage}
\begin{document}
\textcolor{Apricot}{Test Apricot}
\textcolor{AliceBlue}{Test AliceBlue}
\textcolor{AntiqueWhite1}{Test AntiqueWhite1}
\end{document}

enter image description here

1
  • Thanks for pointing out my mistake, I've edited the question.
    – Jinwen
    Commented Mar 15, 2021 at 3:29

You must log in to answer this question.

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