# How can i change the fontsize with KOMA-script?

I need to change the fontsize to 11pt inside a table environment. The default setting of the document is 12pt using scrartcl, but I need to change this to exact 11pt in the float (the reason is that there are dozens of tables that have been created to fit exactly 11pt before).

I use KOMA's \changefontsizes{11pt} to do this, but this generates dozens of warnings:

Using fallback calculation to setup font sizes for basic size '11pt' on input line...

This is a bit confusing, because if I change the whole document to 11pt these warnings go away, hence 11pt should exist. I thought the changefontsizes command was created for exactly this purpose. So if anyone could tell me how to do this properly I would be grateful.

\documentclass{scrartcl}[12pt]

\usepackage{lipsum}

\begin{document}

\lipsum[1]

\begin{table}\centering
\changefontsizes{11pt}\footnotesize
\begin{tabular}{|c|c|c|}
\hline
1 & 2 & 3 \\
4 & 5 & 6 \\
7 & 8 & 9 \\
\hline
\end{tabular}
\end{table}

\end{document}

-
Should be noted, that the correct way to do this is \KOMAoption{fontsize}{11pt}. 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:19

You mention "tables that have been created to fit exactly 11pt before". If you didn't receive "dozens of warnings" then, I suppose you created those tables using the (default) 11pt document class option. This option, however, is not identical to issuing \changefontsizes{11pt}:

• With the 11pt option, you load the file scrsize11pt.clo which, among other things, includes the definition of the various font size switching commands. (\normalsize, BTW, issues \@setfontsize\normalsize\@xipt{13.6}, with \@xipt translating into 10.95, not 11pt.) All those commands use point sizes which are available in the (non-scalable) default font Computer Modern.

• With \changefontsizes{11pt} OTOH, \normalsize features a point size of exactly 11pt, and the point size of all other switching commands is calculated based on that of \normalsize. Because of that, size substitutions become necessary with Computer Modern, and this is what the "dozens of warnings" are about.

The solution is to use a scalable font (e.g., Latin Modern) instead of Computer Modern. This will relase you from all but one warning (from the class, "Using fallback calculation to set up font sizes"). (If you're daring, issue \makeatletter\input{scrsize11pt.clo}\makeatother inside floats, but .clo files weren't designed to be loaded mid-document, so no guarantees.)

-
I forgot to mention that I use libertine-type1 as my font. With an (apparently) non-scalable font is the input of the 'clo' my best chance to make that work properly? – Jörg Oct 10 '12 at 15:31
@Jörg If all your tables were created using \footnotesize, you could copy the scrsize11pt.clo definition of \footnotesize to a new macro (say, \xifootnotesize) and issue this macro inside table environments. – lockstep Oct 10 '12 at 15:34
Also loading fix-cm solves the problem. – egreg Oct 10 '12 at 16:15
I think the idea to create a custom macro that uses the 11pt clo does the trick. At least for my document it works perfect even inside a float. Thanks! – Jörg Oct 10 '12 at 16:25

\changefontsizes is not really explained in the documentation, but is definitely in the experts section. So, hands off.

The correct way to change the size is to use the interface \KOMAoption{fontsize}{11pt}. Or if you are feeling funny you can choose 10.999999 pt. KOMA will look for an existing file with predefined settings, and if it doesn't find one, it uses \changefontsizes. You can read more about the mechanism in Clemens' good answer to Using fallback calculation to setup font sizes.

What happens with \changefontsizes? It takes one argument, the desired font size for \normalsize and does some calculations. In theory, you can put in any number, even non integers, the algorithm of scrextend does its job, calculates the relative sizes as well and uses those values as the now default ones. The command issues a warning that it now uses fallback calculations.

One thing we see as well is that not every font is available in every fontsize. LaTeX then decides to use next best font. I guess we all have seen warning like

LaTeX Font Warning: Font shape OT1/cmr/m/n' in size <3.7699> not
available
(Font)              size <5> substituted on input line 47.


One thing we need to remember: Use the interface the documentation describes, do not use internal or low-level or package author commands to do your every days work.

\listfiles
\documentclass[11pt]{article}
\usepackage{scrfontsizes}

\makeatletter
\newcommand{\currentsize}{{\par current text size: \f@size pt\par}}
\newcommand{\currentfnsize}{{\par\footnotesize current footnote size: \f@size pt\par}}
\newcommand{\currentlargesize}{{\par\large current large size: \f@size pt\par}}
\makeatother

\newcommand{\explain}[1]{\bigbreak\emph{ #1:}}

\begin{document}
\explain{global option 12 pt}
\currentsize \currentfnsize \currentlargesize
\explain{Using the KOMA-interface}
\KOMAoption{fontsize}{11pt}\currentsize
\currentsize \currentfnsize \currentlargesize

\explain{\texttt{changefontsizes 11 pt}}
\changefontsizes{11}
\currentsize \currentfnsize \currentlargesize
\explain{You can even do
\texttt{changefontsizes 11.375 pt}}
\changefontsizes{31.375}
\currentsize \currentfnsize \currentlargesize
\KOMAoption{fontsize}{3.141596pt}
\currentsize \currentfnsize \currentlargesize
\end{document}


If the need for the use of a non standard size exists, it is better to generate a clo file and not calculate the values every single time. You can also change that file and make adjustments where you see fit. Package scrfontsizes helps you achieving this task.

\documentclass{minimal}%ok just this time
\usepackage{scrfontsizes}
\generatefontfile{texsx}{11bp}
\begin{document}\end{document}


You can now use the new font size, but need to define the prefix (in our case texsx) fix.

\makeatletter
\newcommand*{\@fontsizefilebase}{texsx}
\makeatother
\documentclass[fontsize=11bp]{scrartcl}
\usepackage{blindtext}
\begin{document}
\blindtext
\end{document}
`
-