0

This question already has an answer here:

By default, my system produces A4 documents. If I want to set the paper size to US Letter, I can pass the letterpaper option to scrartcl:

\documentclass[letterpaper]{scrartcl}
\begin{document}
Hello, World!
\end{document}

But if I create my own class that extends scrartcl, I can't pass the letterpaper option in the class file. E.g., this doesn't work (the resulting document has A4 paper dimensions):

mcve.ltx

\documentclass{mcve}
\begin{document}
Hello, World!
\end{document}

mcve.cls

\NeedsTeXFormat{LaTeX2e}
\ProvidesClass{mcve}

\LoadClass[letterpaper]{scrartcl}

This does work if I replace scrartcl with article (although I then also have to load the geometry package in both cases to make the PDF paper size match). Even more interestingly, this also works:

mcve.ltx

\documentclass[letterpaper]{mcve}
\begin{document}
Hello, World!
\end{document}

mcve.cls

\NeedsTeXFormat{LaTeX2e}
\ProvidesClass{mcve}

\LoadClassWithOptions{scrartcl}

How can I set the letterpaper option in my class file?

marked as duplicate by Schweinebacke, Stefan Pinnow, Mensch, Mico, esdd koma-script Dec 8 '17 at 12:54

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

  • Again? Search for papersize liadclass and typearea on rhis site. – Johannes_B Sep 8 '17 at 5:15
  • 2
    letterpaper is not an option of scrartcl but of typearea. \LoadClass does not set global option like \documentclass but a class only option. So you have to pass the option to typearea instead. – Schweinebacke Sep 8 '17 at 10:51
0

As @Schweinebacke said, letterpaper is an option of typearea, not of scrartcl. Options passed to \documentclass become global options, which are propagated to all classes and packages that are loaded after the \documentclass declaration, whereas options passed to \LoadClass become local options, which are only passed to the class file being loaded, not to the packages and classes it loads.

To fix this, I needed to set the letterpaper option for the typearea package explicitly in my class file:

\NeedsTeXFormat{LaTeX2e}
\ProvidesClass{mcve}

\PassOptionsToPackage{letterpaper}{typearea}
\LoadClass{scrartcl}

More information can be found in Section 4.7 of LaTeX2e for class and package writers and in this answer.

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