Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

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.

share|improve this question
add comment

2 Answers

up vote 7 down vote accepted

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}
share|improve this answer
add comment

The KOMA-Script classes allow to change font sizes mid-document. The command syntax is \changefontsizes[(new "normalsize" baselineskip)]{(new "normalsize" fontsize)}. The default value for the new baselineskip is 1.2 * fontsize.

\documentclass[10pt]{scrartcl}

\usepackage{blindtext}

\begin{document}

\section{foo}

\blindtext

\changefontsizes{12pt}

\section{bar}

\blindtext

\changefontsizes[18pt]{12pt}

\section{gnu}

\blindtext

\end{document}
share|improve this answer
    
Nice, I didn’t know this feature yet. –  domwass Dec 9 '10 at 12:11
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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