0

My goal is to scale the tt font down starting someplace in the document. I achieved it by using \fontsize{7pt}{11pt}\selectfont:

\documentclass[parskip=half-]{scrreprt}
\usepackage{lmodern}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}

\usepackage[headsepline,plainheadsepline,manualmark]{scrlayer-scrpage}

\begin{document}

\section{Test}

This is a normal text. \large{Large text}

\ttfamily This is a tt family text. \large{Large text}

\fontsize{7pt}{11pt}\selectfont This is a tt family text. \large{Large text}

\end{document}

enter image description here

The problem is that \large is still the same size as before.

How I scale everything?

Michael
  • 197

2 Answers2

2

Not sure what's the motivation for this. Anyway…

\documentclass[parskip=half-]{scrreprt}
\usepackage[T1]{fontenc}
%\usepackage[utf8]{inputenc}
\usepackage{lmodern}

\usepackage[headsepline,plainheadsepline,manualmark]{scrlayer-scrpage}

\DeclareFontFamily{T1}{smallercmtt}{\hyphenchar\font-1 } \DeclareFontShape{T1}{smallercmtt}{m}{n}{ <-9> s[0.7] ectt0800 <9-10> s[0.7] ectt0900 <10-12> s[0.7] ectt1000 <12-17> s[0.7] ectt1200 <17-> s*[0.7] ectt1728 }{}

\begin{document}

\section{Test}

This is a normal text. {\Large Large text}

\texttt{This is a tt family text. {\Large Large text}}

\renewcommand{\ttdefault}{smallercmtt} \texttt{This is a tt family text. {\Large Large text}}

\end{document}

enter image description here

Please, note that \large, like the other size changing commands, does not take an argument but is a declaration whose effect is permanent (obeying the standard scoping rules).

In the example I use \Large just to better show the difference in size.

egreg
  • 1,121,712
0

With fontspec package and TTF/OTF fonts under xelatex/lualatex, the Scale= option can be used:

scaled font

MWE

\documentclass[parskip=half-]{scrreprt}
%\usepackage[T1]{fontenc}
%\usepackage[utf8]{inputenc}
%\usepackage{lmodern}
\usepackage{fontspec}
\setmainfont{Noto Serif}
\setsansfont{Noto Sans}
\setmonofont{Noto Sans Mono}

\usepackage[headsepline,plainheadsepline,manualmark]{scrlayer-scrpage}

\begin{document}

\section{Test} This is a normal text. {\Large Large text} {\tiny Tiny text}

\sffamily This is a sf family text. {\Large Large text} {\tiny Tiny text}

\ttfamily This is a tt family text. {\Large Large text} {\tiny Tiny text}

Scaled: \setmainfont{Noto Serif}[Scale=0.4] \setsansfont{Noto Sans}[Scale=0.4] \setmonofont{Noto Sans Mono}[Scale=0.4]

\section{Scaled Test}

\rmfamily This is a normal text. {\Large Large text} {\tiny Tiny text}

\sffamily This is a sf family text. {\Large Large text} {\tiny Tiny text}

\ttfamily This is a tt family text. {\Large Large text} {\tiny Tiny text}

\end{document}

Cicada
  • 10,129