Can anyone tell me the difference between those two commands?

Edit: Thanks for the answers, but I didn't get the clue yet. Here's an example:




\ProvidesClass{testclass}[2011/01/30 v0.1 testclass]


\ProvidesClass{testclass}[2011/01/30 v0.1 testclass]

In both examples the options a4paper and oneside are passed to book. So, I don't see any difference in the result.

  • 1
    it is not the same! Try \documentclass[a4paper,oneside,openany]{mytestclass} openany is not valid with \LoadClass. Insert two \chapter commands in the test doc
    – user2478
    Jan 30, 2011 at 13:40
  • Yes, I understand it now. See below. I added it to your answer. Thanks
    – Thorsten
    Jan 30, 2011 at 13:46

4 Answers 4


\LoadClass[options]{name} load class name with the listed options \LoadClassWithOptions{name} load class name with the same options of the current class. For example


inside the baz.cls there can be a

\LoadClassWithOptions{book}% is loaded with options `foo` and `bar`


\LoadClass[default options]{name}
  • Oh, I see. So there's only a difference when I use \LoadClassWithOptions inside a .tex file. When I use one of those commands insde a .cls file I get the same result. Right?
    – Thorsten
    Jan 30, 2011 at 10:57
  • No, even if you use it inside a .cls, \LoadClassWithOptions will load the class using the options specified in the \documentclass of the main .tex file. Jan 30, 2011 at 11:16
  • @Herbert: your code would cause an Two \LoadClass commands error. Jan 30, 2011 at 11:22
  • The question is only if you want to pass the options to the loaded class or not. There is also a command \PassOptionsToClass{..}{...} and both are used inside the baz.cls
    – user2478
    Jan 30, 2011 at 11:25
  • @Herbert, I thought so, but just wanted to point it out for Thorsten. Jan 30, 2011 at 11:40

The command


will load the class using the options specified in the main document.

The command


will load the class using the specified options and does not include the options of the main document.

In your example you probably don't see much difference because the options specified in the \documentclass are probably the defaults for scrbook anyway.

But consider this example of a file baseclass.cls:

\ProvidesClass{baseclass}[2011/01/30 v0.1 baseclass]

\def\funny{Is not funny}
\DeclareOption{funny}{\def\funny{Is funny!}}

Then myclass.cls:

\ProvidesClass{myclass}[2011/01/30 v0.1 myclass]

And main.tex:



Even if you specify the funny option, it won't be applied in baseclass. But it will be applied if you use the command \LoadClassWithOptions in myclass.cls.

  • Thank you for your answer. I've got it now. Unfortunately I cannot accept more than one answer.
    – Thorsten
    Jan 30, 2011 at 13:58

From the LATEX2ε for class and package writers guide:

A LATEX class can load one other class as follows:


The following commands can be used in the common case that you want to simply load a class or package file with exactly those options that are being used by the current class.


You cannot use \LoadClass or \LoadClassWithOptions inside a main document after \documentclass, only in the .cls loaded with it. This would cause an error. However, you can, if you really want it, use this macros before the \documentclass. In this case no main class option are set yet, so \LoadClassWithOptions would not make sense at all.

  • how can you use \LoadClass{article} before a \documentclass{book}??
    – user2478
    Jan 30, 2011 at 11:41
  • I couldn't tell you a usecase for it. I simple tested the different combinations and found out that it works without an error. It doesn't make much sense IMHO. Jan 30, 2011 at 11:58
  • The \LoadClass{article} before a \documentclass{book} causes an error ...or with any other combination of existing classes which define for example the font size with \newcommand
    – user2478
    Jan 30, 2011 at 12:11
  • @Herbert: You are right, this combination doesn't make sense and doesn't work most the time. I just mentioned it as theoretical possibility without thinking much about it if it makes sense. I tested it with minimal loaded before article and it worked. Note that I tested the internal avoid-two-classes mechanism of \LoadClass and \documentclass, not if two classes really work which each other. Feb 3, 2011 at 20:06

Just went through the experience myself. To add to the existing answers a more concrete answer.



If you always want to use the options a4paper,11pt and want to ignore the user options specified in \documentclass in main.tex, then myclass.cls:


If you want the user options specified in \documentclass in main.tex and no more than that, then myclass.cls:


That's why \LoadClassWithOptions has no optional argument [<options-list>]

If you always want to use the option a4paper, and the user can specify other options in \documentclass in main.tex, then myclass.cls:


Source: Sections 3.2-3.6 of https://www.latex-project.org/help/documentation/clsguide-historic.pdf

You must log in to answer this question.

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