Inside a 12pt document I like to switch in an environment to a font size of 10pt. The macros like \normalsize, \large, \small etc. should all work like in a 10pt document. I'm aware that this isn't good typography and might look bad in general. I'm planning to use it for the labels inside a tikzpicture.

The task (I don't like to call it a "problem") is that I have some standalone tikzpicture documents which are using 10pt when compiled standalone, but can be also inserted into 12pt documents where the text does not fit any more in some places. I know it could be fixed by changing all distances to one of the font size specific units em or ex, but don't like to change several figures and maybe add this as a feature to the standalone package.

up vote 13 down vote accepted
\let\savednewcommand\newcommand
\let\newcommand\renewcommand
\makeatletter
\input{size10.clo}
\makeatother
\let\newcommand\savednewcommand

Or implement the contents of size10.clo yourself.

  • Thanks, this looks very interesting. I forgot that the font sizes are set by .clo files. – Martin Scharrer Apr 14 '11 at 15:46
  • It was difficult to call which answer to accept. I was choosing this one because it's includes the full code required to change the font size at the begin of an environment. – Martin Scharrer Apr 18 '11 at 14:49
  • 1
    Thanks again. This is now part of standalone v1.0 and is used to apply the used class font size option of subfiles even if they are included in a main document. See the obeyclassoptions option of the standalone package. – Martin Scharrer Dec 21 '11 at 16:26
  • I tried applying this after a tikzpicture environment, and before some text. However, it changed the size of the text in the tikzpicture too. – Faheem Mitha Feb 7 '14 at 8:45
\documentclass{article}

\begin{document}
abc {\large abc} 
{\makeatletter\let\newcommand\renewcommand\input{size12.clo}
abc \large abc} 
abc
\end{document}

But it won't work with every class/fontsize. E.g. with book you will have to input book12.clo, and the koma classes computes some fontsizes.

  • Thanks. The files in question will be standalone files, i.e. just single picture environments. The article class is used for that. The main document might be book or a koma class, but I like to actually switch to the "normal" 10pt style of the article class, so size10.clo should do it. – Martin Scharrer Apr 14 '11 at 15:43
  • I can't find a book12.clo file but there is a bk12.clo file, which looks like it. – Martin Scharrer Apr 14 '11 at 16:03
  • I am sorry, but is there a difference between your approach and this: normal-font text {\fontsize{10}{12}\selectfont text to change its font locally} continue normal-font text? – Diaa May 10 '17 at 6:11
  • 1
    @DiaaAbidou You are simply switching to 10pt, Martin wanted to redefine all size commands to give a bit smaller font. – Ulrike Fischer May 10 '17 at 7:01
  • I see. The question title confused me. Thanks for your explanation. – Diaa May 10 '17 at 7:55

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

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