[Tex/LaTex] Setting font size AFTER \documentclass

document-classesfontsize

I've seen a few related questions, but can't find one that actually answers this question. What I want to do is to specify the font size AFTER \documentclass. I don't want to change the command line, nor have to define something like \def\pointsize{12pt} beforehand, and then use that in the \documentclass[\pointsize] as per Norman's solution to setting class options after documentclass. So, what I am looking for is the definition of \SetFontSize below so that it has the same effect as if I had said \documentclass[12pt]{some_class} in terms of text location and size:

\documentclass{some_class}
\SetFontSize{12pt}{15pt}

I am also not sure that 12,15 are the correct numbers to match with the [12pt] option. I tried the following, but this does not producing identical output as \documentclass[12pt]{article}:

\documentclass{article}
\fontsize{12pt}{15pt}\selectfont

\begin{document}
blah blah
\end{document}

Based on lockstep's link, I believe that the solution is:

  \let\savednewcommand\newcommand
  \let\newcommand\renewcommand
  \makeatletter
  \input{size12.clo}
  \makeatother
  \let\newcommand\savednewcommand

This seems to be working for the {article} class. But according the same link this may not work for all classes.

Best Answer

\documentclass{article}
\let\small\relax
\let\footnotesize\relax
\let\scriptsize\relax
\let\tiny\relax
\let\large\relax
\let\Large\relax
\let\LARGE\relax
\let\huge\relax
\let\Huge\relax
\makeatletter
\input{size12.clo}
\makeatother
\begin{document}

foo

\end{document}