18

I would like to use KOMA script with a fontsize of 13pt (see very much related question here: Koma Script and real 13pt). Consider the following document:

\documentclass[fontsize=13pt,DIV=12]{scrartcl}

\usepackage{lmodern}
\usepackage[T1]{fontenc}

\begin{document}
test
\end{document}

I get the following warnings:

Class scrartcl Warning: Using fallback calculation to setup font sizes
(scrartcl)              for basic size `13pt' on input line 1564.

LaTeX Font Warning: Font shape `OT1/cmr/m/n' in size <13> not available
(Font)              size <12> substituted on input line 1564.

LaTeX Font Warning: Font shape `T1/cmr/m/n' in size <13> not available
(Font)              size <12> substituted on input line 100.

While I absolutely understand the first warning (I'm okay with calculated font sizes) I don't see why LaTeX is complaining about missing font shapes in the computer modern font (I understand cmr stands for computer modern roman?).

I can get rid of the font shape warnings by using \RequirePackage{fix-cm} before the documentclass, but that seems strange to me (I want to use lmodern, not computer modern).

I guess that it is save to ignore the warnings (the PDF does not include cm), but I would still like to understand what's going on. I tried to defer the change in fontsize until after lmodern has been loaded, but it did not help.

[ Related question in german with an answer by Markus Kohm, suggesting to use lmodern: http://www.komascript.de/node/1137 ]

18

The warning is due to the fact that Computer Modern fonts are only available at “discrete” sizes. The problem is that, apparently, Koma classes process the fontsize option too early, when Computer Modern is still the default font.

You can remove the spurious warning by loading fix-cm before starting:

\RequirePackage{fix-cm}
\documentclass[fontsize=13pt,DIV=12]{scrartcl}

\usepackage[T1]{fontenc}
\usepackage{lmodern}

\begin{document}
test
\end{document}

You'll only get

Class scrartcl Warning: Using fallback calculation to setup font sizes
(scrartcl)              for basic size `13pt' on input line 1564.

that's unavoidable unless you use the silence package to remove it:

\RequirePackage{fix-cm}
\RequirePackage{silence}
\WarningFilter{scrartcl}{Using fallback}

\documentclass[fontsize=13pt,DIV=12]{scrartcl}
\usepackage[T1]{fontenc}
\usepackage{lmodern}


\begin{document}
test
\end{document}

A different strategy would be

\documentclass[DIV=12]{scrartcl}
\usepackage[T1]{fontenc}
\usepackage{lmodern}
\normalfont
\KOMAoption{fontsize=13pt}
\recalctypearea

\begin{document}
test
\end{document}

but I don't recommend it.

  • The last part is very interesting. The \normalfont command is what I was missing... I was expecting the lmodern package to set the defaults somehow (but I guess that only happens at the beginning of the document). So why would you not recommend it? Because \normalfont should not be used in the header? – shark.dp Apr 28 '15 at 9:47
  • 1
    @shark.dp Yes, \normalfont is issued at \begin{document} and issuing it in the preamble is not the best thing to do, but it depends on several factors. The Koma classes should try doing the size computations at that place (after \normalfont is issued). Or just live with the warnings. ;-) – egreg Apr 28 '15 at 9:50
  • 3
    If you set the font later using KOMAoption, additionally add recalctypearea as the fontsize is as well given to package typearea. – Johannes_B Apr 28 '15 at 9:56
  • 1
    @shark.dp Additional reading: How can i change the fontsize with KOMA-script? – Johannes_B Apr 28 '15 at 9:58
8

If you modify your example to

\documentclass[fontsize=13pt,DIV=12]{scrartcl}

\stop
\usepackage{lmodern}
\usepackage[T1]{fontenc}


\begin{document}

test
\end{document}

You see the warning about cmr comes before lmodern is loaded. So the class sets up some fonts which are over-ridden later but still generate some warnings.

It's probably safe to do this (although I don't think I've tried this before:-)

You get no warnings from

\renewcommand\familydefault{lmr}
\renewcommand\encodingdefault{T1}
\selectfont
\DeclareErrorFont{T1}{lmr}{m}{n}{10}
\documentclass[fontsize=13pt,DIV=12]{scrartcl}


\usepackage{lmodern}
\usepackage[T1]{fontenc}


\begin{document}

test
\end{document}
  • That is why I tried to defer the change in fontsize by using \KOMAoption{fontsize}{13pt} until after I loaded lmodern, but it does not change anything. Is it KOMA that sets up computer modern or is it just LaTeX (by default)? – shark.dp Apr 28 '15 at 9:34
  • 1
    @shark.dp latex certainly sets OT1 encoding and cmr family as defaults, I don't know the details of koma internals, but I added a warning free version that might work.... – David Carlisle Apr 28 '15 at 9:43
  • Very interesting. I think this is similar to egreg's version below, using \normalfont. It just looks weird to set the defaults before loading the package.. but this could be changed with \KOMAoption. – shark.dp Apr 28 '15 at 9:49
  • 1
    @shark.dp If you set the font later using KOMAoption, additionally add recalctypearea. – Johannes_B Apr 28 '15 at 9:54

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.