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:

test.tex

\documentclass[a4paper,oneside]{mytestclass}
...


mytestclass.cls

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


or

\NeedsTeXFormat{LaTeX2e}
\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.

-
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 –  Herbert Jan 30 '11 at 13:40
Yes, I understand it now. See below. I added it to your answer. Thanks –  Thorsten Jan 30 '11 at 13:46

\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

\documentclass[foo,bar]{baz}


inside the baz.cls there can be a

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


or

\PassOptionsToClass{\CurrentOption}{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 '11 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. –  Juan A. Navarro Jan 30 '11 at 11:16
@Herbert: your code would cause an Two \LoadClass commands error. –  Martin Scharrer Jan 30 '11 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 –  Herbert Jan 30 '11 at 11:25
@Herbert, I thought so, but just wanted to point it out for Thorsten. –  Martin Scharrer Jan 30 '11 at 11:40

The command

\LoadClassWithOptions{class}


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

The command

\LoadClass[options]{class}


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:

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

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


Then myclass.cls:

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


And main.tex:

\documentclass[funny]{myclass}

\begin{document}
\funny
\end{document}


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 '11 at 13:58

From the LATEX2ε for class and package writers guide:

A LATEX class can load one other class as follows:

\LoadClass[<options>]{<class-name>}[<date>]


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.

\LoadClassWithOptions{<class-name>}[<date>]
\RequirePackageWithOptions{<package>}[<date>]


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}?? –  Herbert Jan 30 '11 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. –  Martin Scharrer Jan 30 '11 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 –  Herbert Jan 30 '11 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. –  Martin Scharrer Feb 3 '11 at 20:06