12

I have noticed that, for example, ClassicThesis config file uses this style:

\PassOptionsToPackage{utf8}{inputenc}
\usepackage{inputenc}

instead of

\usepackage[utf8]{inputenc}.

What is the difference between these two options of passing the options to a package? In other words, what is the goal of supporting both types of syntax for arguments in TeX (or LaTeX?)?

10
  • classicthesis has some interesting features. You have more characters to tyoe in.
    – Johannes_B
    May 26, 2018 at 13:10
  • 2
    I don't really know why the author of classicthesis does like that. There is no point in doing so.
    – egreg
    May 26, 2018 at 22:29
  • 3
    I'll explain: it's because of its use with LyX: when LyX calls its packages, it passes them options inline. When classicthesis then calls the same packages, LaTeX reports option clashes, and, I believe, stops compiling. This seemed like the easiest way out of the situation. Call it the price of technological progress :) May 27, 2018 at 11:04
  • @PhilipPirrip Preventing option clashes. You are the classicthesis expert, please provide the answert :-)
    – Johannes_B
    May 27, 2018 at 11:17
  • 1
    ClassicThesis is just an illustration. Why do these two types of syntax exist in TeX? Obviously, it was not introduced to make LyX work. I've updated the question. May 27, 2018 at 11:33

1 Answer 1

9
\documentclass{beamer}
\usepackage[colorlinks]{hyperref}
\begin{document}

foo

\end{document}

gives an option clash, because a package can be loaded only one time! And that is done for hyperref by beamer itself internally, but without an optional argument. LaTeX marks hyperref as loaded after the first usepackage or RequirePackage and then throughs an error if a package should be loaded a second time with different optional arguments. In such a case a \PassOptionsToPackage helps, or only for beamer one can use hyperref=colorlinks:

 \documentclass[xcolor=table,hyperref=colorlinks,...]{beamer}
 \begin{document}

 foo

 \end{document}

A user often didn't know what packages are already loaded by the documentclass or other packages or by LyX in its defined preamble. Then he/she realizes only by the option-clash error that a package should be loaded more than once.

2
  • In short, to pass argument to a package that already has been declared? May 27, 2018 at 14:08
  • 5
    Not really: \PassOptionsToPackage has to be used before the package will be loaded. The reason why it is often used before \documentclass.
    – user2478
    May 27, 2018 at 17:17

You must log in to answer this question.

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