2

The relsize package offers convenient ways to scale text in a document. The \textscale command allows to use arbitrary text sizes beyond the usual switches such as \large and \small. When KOMA script classes are used, however, the resulting size is messed up sometimes.

The following MWE should produce the letter M scaled from 10% to 99% of the current font size, 12pt, in steps of one percent.

% https://tex.stackexchange.com/q/4824/77970
\RequirePackage{fix-cm}
%
\documentclass{scrartcl}
\usepackage{relsize}
\KOMAoption{fontsize}{12}
\begin{document}

\renewcommand\RSpercentTolerance{0}
\newcount\foo
\foo=10
\loop
\textscale{0.\the\foo}{M}
\advance \foo +1
\ifnum \foo<100
\repeat

\end{document}

However, some of the letters are out of place, smaller letters following after larger letters. For instance, \textscale{0.75}{M} produces a larger M than \textscale{0.76}{M}, while it should be the other way around. Is there a solution to this issue?

1 Answer 1

2

It seems that there is some incompatibility between the KOMA font size selection and the relsize package, although I cannot say what precisely. The issue is solved by simply loading the relsize package after setting the font size with \KOMAoption{fontsize}{12} as illustrated by the following MWE:

% https://tex.stackexchange.com/q/4824/77970
\RequirePackage{fix-cm}
%
\documentclass{scrartcl}
\KOMAoption{fontsize}{12}
\usepackage{relsize}
\begin{document}

\renewcommand\RSpercentTolerance{0}
\newcount\foo
\foo=10
\loop
\textscale{0.\the\foo}{M}
\advance \foo +1
\ifnum \foo<100
\repeat

\end{document}

As expected, now \textscale{0.75}{M} produces a smaller M than \textscale{0.76}{M}. This solution appears to work smoothly wihtout any other side-effects.

1
  • It is recommended to set fontsize=12pt in the class options: \documentclass[fontsize=12pt]{scrartcl}.
    – esdd
    Nov 5, 2019 at 20:28

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.