[Tex/LaTex] Change the fontsizes of an existing documentclass

fontsize

I really like the tufte-book document class, but I really don't like how tiny the fonts are on screen.

I would like to redefine the font sizes to be a bit larger. I thought that editing the following in tufte-common.def (lines 341 – 380) would do the trick, but when I rerun pdflatex… no dice.

%%
% Set the font sizes and baselines to match Tufte's books
\renewcommand\normalsize{%
   \@setfontsize\normalsize\@xpt{14}%
   \abovedisplayskip 10\p@ \@plus2\p@ \@minus5\p@
   \abovedisplayshortskip \z@ \@plus3\p@
   \belowdisplayshortskip 6\p@ \@plus3\p@ \@minus3\p@
   \belowdisplayskip \abovedisplayskip
   \let\@listi\@listI}
\normalbaselineskip=14pt
\normalsize
\renewcommand\small{%
   \@setfontsize\small\@ixpt{12}%
   \abovedisplayskip 8.5\p@ \@plus3\p@ \@minus4\p@
   \abovedisplayshortskip \z@ \@plus2\p@
   \belowdisplayshortskip 4\p@ \@plus2\p@ \@minus2\p@
   \def\@listi{\leftmargin\leftmargini
               \topsep 4\p@ \@plus2\p@ \@minus2\p@
               \parsep 2\p@ \@plus\p@ \@minus\p@
               \itemsep \parsep}%
   \belowdisplayskip \abovedisplayskip
}
\renewcommand\footnotesize{%
   \@setfontsize\footnotesize\@viiipt{10}%
   \abovedisplayskip 6\p@ \@plus2\p@ \@minus4\p@
   \abovedisplayshortskip \z@ \@plus\p@
   \belowdisplayshortskip 3\p@ \@plus\p@ \@minus2\p@
   \def\@listi{\leftmargin\leftmargini
               \topsep 3\p@ \@plus\p@ \@minus\p@
               \parsep 2\p@ \@plus\p@ \@minus\p@
               \itemsep \parsep}%
   \belowdisplayskip \abovedisplayskip
}
\renewcommand\scriptsize{\@setfontsize\scriptsize\@viipt\@viiipt}
\renewcommand\tiny{\@setfontsize\tiny\@vpt\@vipt}
\renewcommand\large{\@setfontsize\large\@xipt{15}}
\renewcommand\Large{\@setfontsize\Large\@xiipt{16}}
\renewcommand\LARGE{\@setfontsize\LARGE\@xivpt{18}}
\renewcommand\huge{\@setfontsize\huge\@xxpt{30}}
\renewcommand\Huge{\@setfontsize\Huge{24}{36}}

I tried changing @xpt{14} to 16, and so on. Is there a way to add +2 to all font sizes in the class with a few lines in a tex document? That would be preferable to editing the source of the package.

Best Answer

If the class doesn't support different font size settings then the best solution is indeed to write yourself a small package in which you place all necessary settings and overwrite what is in the class.

Historically LaTeX has a good number of abbreviations to save space (and processing time in certain cases). While they aren't really necessary any longer they are still around and used in may places. But it is aboslutely essential to tread them as constants and not try to adjust something by modifying \p@ or \@xpt -- this is likely to break horribly.

Instead replace the definitions and settings with "normal" values, e.g.,

\renewcommand\normalsize{%
   \@setfontsize\normalsize{10}{14}%
   \abovedisplayskip 10pt \@plus 2pt \@minus 5pt
   ...
}
\renewcommand\small{%
   \@setfontsize\small{10.95}{12}%
   ...
}
\renewcommand\scriptsize{\@setfontsize\scriptsize{7}{8}}
\renewcommand\tiny{\@setfontsize\tiny{5}{6}}
\renewcommand\large{\@setfontsize\large{10.95}{15}}
\renewcommand\Large{\@setfontsize\Large{12}{16}}
\renewcommand\LARGE{\@setfontsize\LARGE{14.4}{18}}
\renewcommand\huge{\@setfontsize\huge{20.74}{30}}
\renewcommand\Huge{\@setfontsize\Huge{24}{36}}

Now important to realize here is that in the above definitions the first number is the font size and the second is the used baselineskip. So you probably have to adjust both to fit (and it the fonts you use). Thus no surprise is you only changed the second but left \@xpt that the font didn't change.

Also those constants like \@xipt are not necessarily whole numbers, their definition in the LaTeX is:

 \def\@vpt{5}
 \def\@vipt{6}
 \def\@viipt{7}
 \def\@viiipt{8}
 \def\@ixpt{9}
 \def\@xpt{10}
 \def\@xipt{10.95}
 \def\@xiipt{12}
 \def\@xivpt{14.4}
 \def\@xviipt{17.28}
 \def\@xxpt{20.74}
 \def\@xxvpt{24.88}

to fit the sizes offered by Computer Modern fonts. If you use other fonts that are in continuous sizes then you can use other numbers, such as 11 or 13.

Finally, other dimensions like those that are set up as part of \normalsizeor \small may visually depend on the font sizes you use, so it does make sense to consider them all in relation to each other.

Related Question