2

Why the command below don't change the size of the font? I have copied it from book.cls

\documentclass{book}

\makeatletter
\renewcommand*\@ptsize{2}
\makeatother

\newlength{\hallo}
\settowidth{\hallo}{m}

\begin{document}

Hallo World

\the\hallo

\end{document}

Could I have some problem with this way? For example if I put the \@newglobalfontsize{} command after some packgaes in the preamble?

\documentclass{book}

\makeatletter
\DeclareRobustCommand*{\@newglobalfontsize}[1]
{
    \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{bk#1.clo}
    \makeatother
}
\makeatother

\makeatletter
\@newglobalfontsize{10}
\makeatother

\newlength{\hallo}
\settowidth{\hallo}{m}

\begin{document}

Hallo World

\the\hallo

\end{document}

UPDATE

To avoid all problems this is the best way for me:

\documentclass{scrreprt}

\makeatletter

\DeclareRobustCommand*{\@newglobalfontsize}[1]{\changefontsizes[\dimexpr#1*1.2\relax]{#1}}

\@newglobalfontsize{8pt}

\makeatother


\begin{document}

test

\end{document}
9

By the time you modify \@ptsize the document class already set up the font sizes, so the change is not realized. Using

\documentclass[12pt]{book}

is the preferred way. More specifically, the document class options are set up (with some defaults) and then processed, followed by the appropriate font setup (reading bk1\@ptsize.clo, for example) inside the document class (book.cls and the like).

From book.cls (with comments added):

128: ...
129: \ExecuteOptions{letterpaper,10pt,twoside,onecolumn,final,openright}% Defaults
130: \ProcessOptions% Process options passed by user + defaults
131: \input{bk1\@ptsize.clo}% Read/setup font-specific information
132: ...

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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