# How to scale fonts including sections and subsections?

I am trying to scale the fonts in my document with the scalefnt package. However it only affects the body text and not the section or subsection headings, as the following example shows:

\documentclass[a4paper,12pt]{article}

\usepackage[utf8]{inputenc}
\usepackage{fontenc}

\usepackage{scalefnt}

\begin{document}

\begingroup
\scalefont{2}
\subsection*{Test}

Test
\endgroup

\subsection*{Test}

Test

\end{document}


Output:

Is there any way to make this work or another way to scale all fonts including section and subsection headings by the same factor?

If you're only using \normalsize font and standard sectioning commands, then you could use the sectsty package to easily manipulate font sizes of sectional headings in concert with scalefnt.

The following example, with some modifications, is partly taken from Is it possible to change text color for all headings?:

\documentclass{article}
\usepackage{lmodern,scalefnt,sectsty}% http://ctan.org/pkg/{lmodern,scalefnt,sectsty}
\usepackage{xcolor}% http://ctan.org/pkg/xcolor
\sectionfont{\color{red}\scalefont{2}}
\subsectionfont{\color{green!80!black}\scalefont{2}}
\subsubsectionfont{\color{blue!50!white}\scalefont{2}}
\AtBeginDocument{\scalefont{2}}
\begin{document}
\section{A section} Hi there
\subsection{A subsection} Some text
\subsubsection{A subsubsection} Some more text
\small Hi there
\end{document}


As can be seen, \small initiates a different (fixed) font size based on the document class option (10pt default in this case), and therefore doesn't correspond to the \scalefont{2} set \AtBeginDocument; the only caveat.

• Is there a way to use this locally like \begin{scalefont}{2} text text text \end{scalefont}? – Philip May 31 '17 at 20:08
• @Philip: Yes. Use some text {\scalefont{2}text text text} some more text. – Werner May 31 '17 at 20:27
• Thank you, it is kind of working, the result is not as beautiful as when you do a global spacing. – Philip May 31 '17 at 20:32
• @Philip: Yes, because the baseline skip is not updated until it reaches an explicit \par or an empty line. If you're thinking about adding emphasis on certain pieces of text, rather use \emph or {\bfseries ...}. – Werner May 31 '17 at 20:38

You don't say why you want to do that. the document size option 12pt here sets fonts for structural elements like section headings as well as the page size and vertical spacing, you need to change them all together.

Perhaps you want to typeset to a smaller size say [a5paper] then scale the document back up to A4 using a pdf2pdf post process, then fonts and vertical spacing scale together.

• I want to make a transparency for an old style overhead projector. Therefore I want to have a easy control over the scaling of the fonts in the document to improve readability. – student Apr 8 '13 at 21:18