14

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.

2 Answers 2

13
\let\savednewcommand\newcommand
\let\newcommand\renewcommand
\makeatletter
\input{size10.clo}
\makeatother
\let\newcommand\savednewcommand

Or implement the contents of size10.clo yourself.

4
  • Thanks, this looks very interesting. I forgot that the font sizes are set by .clo files. Apr 14, 2011 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. Apr 18, 2011 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. Dec 21, 2011 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. Feb 7, 2014 at 8:45
11
\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.

5
  • 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. Apr 14, 2011 at 15:43
  • I can't find a book12.clo file but there is a bk12.clo file, which looks like it. Apr 14, 2011 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, 2017 at 6:11
  • 1
    @DiaaAbidou You are simply switching to 10pt, Martin wanted to redefine all size commands to give a bit smaller font. May 10, 2017 at 7:01
  • I see. The question title confused me. Thanks for your explanation.
    – Diaa
    May 10, 2017 at 7:55

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.