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

2 Answers 2

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

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}
share|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 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 at 12:53
    
Thanks for clarifying :-) –  Johannes_B Jan 17 at 14:11

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.