5

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?)?

  • classicthesis has some interesting features. You have more characters to tyoe in. – Johannes_B May 26 '18 at 13:10
  • 1
    I don't really know why the author of classicthesis does like that. There is no point in doing so. – egreg May 26 '18 at 22:29
  • 2
    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 :) – PhilipPirrip May 27 '18 at 11:04
  • @PhilipPirrip Preventing option clashes. You are the classicthesis expert, please provide the answert :-) – Johannes_B May 27 '18 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. – homocomputeris May 27 '18 at 11:33
3
\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 laoded 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.

  • In short, to pass argument to a package that already has been declared? – homocomputeris May 27 '18 at 14:08
  • 2
    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 '18 at 17:17

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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