8

I use the same tex file to create several different layouts with basically the same content. I have several switches and \ifthenelse constructs to control the layouts. Normally, I just have to set one or two boolean variables to activate a specific layout.

Some layouts require typeface size 10pt, some 11pt. Is it possible to change the size after \documentclass{article}? E.g., in a constuct such as:

\ifthenelse{\boolean{layoutA}}
  {\setlength{\typefacesize}{10pt}}
  {\setlength{\typefacesize}{11pt}}

Obviously, there is no \typefacesize. I would like to avoid having to change the typeface size in \documentclass all the time.

7

It's possible, but I don't know exactly what the ramifications would be. Use at your own risk:

\documentclass[10pt]{article}

\makeatletter
\newcommand\resetfontsize[1]{%
  \let\small\@undefined
  \let\footnotesize\@undefined
  \let\scriptsize\@undefined
  \let\tiny\@undefined
  \let\large\@undefined
  \let\Large\@undefined
  \let\LARGE\@undefined
  \let\huge\@undefined
  \let\Huge\@undefined
  \makeatletter
  \input{size#1.clo}
  \makeatother
}
\makeatother

\usepackage{lipsum}
\begin{document}
\lipsum[1]
\section{abc}
\lipsum[2]

\resetfontsize{12}
\lipsum[1]
\section{abc}
\lipsum[2]

\end{document}
| improve this answer | |
7

The KOMA-Script classes allow to change font sizes mid-document. The command syntax is either \KOMAoption{fontsize}{(new "normalsize" fontsize)} or, should you need a non-standard baselineskip, \changefontsizes[(new "normalsize" baselineskip)]{(new "normalsize" fontsize)}. The default value for the new baselineskip is 1.2 * fontsize. For details see this answer by Johannes_B.

\documentclass[10pt]{scrartcl}

\usepackage{blindtext}

\begin{document}

\section{foo}

\blindtext

\KOMAoption{fontsize}{12pt}

\section{bar}

\blindtext

\changefontsizes[18pt]{12pt}

\section{gnu}

\blindtext

\end{document}
| improve this answer | |
  • Nice, I didn’t know this feature yet. – domwass Dec 9 '10 at 12:11
  • 1
    Should be noted, that the correct way to do this is \KOMAoption{fontsize}{12pt}. changefontsizes is for calculating relative sizes like footnotesize for non-standard base sizes. Meaning the calculated values overwrite the default/standard values. – Johannes_B Jan 17 '15 at 11:15
  • Can you please change the part of the answer? I wrote some additional information at Change fontsize inside float in KOMA class – Johannes_B Jan 17 '15 at 12:53

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.