14

I am using a custom LaTeX document class for my thesis which is derived from the report class. I'd like to set the default size of the font to 12pt, and still have the option to change it (to 10pt) via the \documentclass command. How can I do it?

2

2 Answers 2

10

12pt is the default. The demo class is baz.cls

\RequirePackage{filecontents}
\begin{filecontents}{baz.cls}
\def\@@ptsize{12pt}
\DeclareOption{10pt}{\def\@@ptsize{10pt}}
\DeclareOption{11pt}{\def\@@ptsize{11pt}}
\DeclareOption{12pt}{\def\@@ptsize{12pt}}
\DeclareOption*{\PassOptionsToClass{\CurrentOption}{report}}
\ProcessOptions\relax
\LoadClass[letterpaper,oneside,onecolumn,final,openany,\@@ptsize]{report}
\end{filecontents}

\documentclass
%[10pt]
%[11pt]
{baz} 
\usepackage{lipsum}

\begin{document}
\lipsum  
\end{document}
0
2

If your modified documentclass file does not involve a \LoadClass call to LaTeX's report.cls file, it likely contains the following instruction shortly before the \ProcessOptions statement:

\ExecuteOptions{letterpaper,10pt,oneside,onecolumn,final,openany}

Change 10pt to 12pt in this instruction, save the documentclass file under a new name, and load this newly-modified documentclass file from now on. The default font size will now be 12pt, but this can be overridden by specifying 10pt -- or, for that matter, 11pt -- as an option. Of course, specifying the 12pt option will now simply duplicate the default behavior of this document class.

Addendum: If the modified class file you're working with executes a \LoadClass call to the report.cls LaTeX document class, you may want to try modifying \LoadClass{report} to \LoadClassWithOptions[12pt]{report}.

16
  • that is a command in the original class and one should do all modifications not int the original class! See Stefans comment ...
    – user2478
    Commented Jan 12, 2012 at 16:32
  • @Herbert: Thanks for this. I would definitely never suggest modifying an original class file. However, the OP's question seemed to indicate that he/she is working with a modified (hacked?!) version of the report document class which -- in all likelihood -- does not perform either a \LoadClass or a \LoadClassWithOptions call to report.cls. However, just in case that this assumption is incorrect, I'll modify my answer to make clear that the OP should save his/her further-customized documentclass file name under a new name.
    – Mico
    Commented Jan 12, 2012 at 16:36
  • \ExecuteOptions does not seem to work! I have put it in my cls file with 12pt option, but it still takes the default value as 10pt. Of course, changing the option in the latex document works. BTW, the option declarations in my cls file appear after the \LoadClass command -- is that a problem? Commented Jan 12, 2012 at 16:46
  • @Mico: I am not modifying the report.cls file. I am using \LoadClass to load report.cls. Commented Jan 12, 2012 at 16:50
  • OK, I see that the modified class file you have doesn't conform to my initial assumptions. See my modified answer for an alternative method.
    – Mico
    Commented Jan 12, 2012 at 16:52

You must log in to answer this question.

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