# KOMA-Script:: interference between T1 fontenc and chapterformat

I do no manage to obtain using pdflatex bold font for Chapter Name, prefix and number when \usepackage[T1]{fontenc} is loaded. The rendering is changing due to this package and the command \bfseries has no effect.

with the T1 fontenc package:

without the T1 fontenc package:

I found following related topics on the forum but was not able to find a solution to my issue. I would be very greatful for your help.

Note: I want to use only KOMA-Script command because of the known incompatibilities between titlesec package and scrbook documentclass.

\documentclass[fontsize=12pt,a4paper, headings=twolinechapter]{scrbook}

\usepackage{xcolor}
\usepackage{graphicx}
\usepackage{lipsum} % just to generate text for the example

\usepackage[T1]{fontenc}
\usepackage[utf8, latin1]{inputenc}

% the chapter format:
\KOMAoption{chapterprefix}{true}

\renewcommand*{\chapterformat}{%
\raggedright%
\mbox{\chapappifchapterprefix{\nobreakspace}%
\scalebox{2.5}{\bfseries\color{gray}\thechapter\autodot}}\\}

\renewcommand*{\chapterheadendvskip}{%
\vspace{-12pt}\noindent{\setlength{\parskip}{0pt}\Huge\hrulefill\par}%
\vspace{\baselineskip}
}

\addtokomafont{chapter}{\raggedleft\Huge\bfseries}

\begin{document}

\chapter{Title of the First Chapter}
\section{Title of the Section}
\subsection{Title of the Subsection}
\lipsum[1-2]
\chapter{Title of the second Chapter}
\lipsum[1-2]

\end{document}

• Welcome to TeX.SX! Add \usepackage{lmodern}. Unrelated, but important: give inputenc just one option; either utf8 or latin1, according to your file's encoding. – egreg Oct 21 '14 at 18:10
• Thanks a lot for the quick reponses. Both solutions are working fine. Because I am not able to understand the second solution, I will prefer the use of the lmodern package even if no full documentation is available. I hope I do not produce new trouble somewhere else using this package. – ChrisDE Oct 21 '14 at 18:47

## 2 Answers

They are both using bold but the T1 font is available in more design sizes so is considerably thinner at large size, the OT1 font is only available in 10pt and gets scaled.

You can force the T1 font to do the same, just using the 10pt scaled by adding

\makeatletter\input{t1cmss.fd}\makeatother
\DeclareFontShape{T1}{cmss}{bx}{n}%
{<5><6><7><8><9><10->ecsx1000}{}


to the preamble.

• Why not {<->ecsx1000}? – egreg Oct 21 '14 at 19:29
• @egreg because I started to copy the OT1 fd file exactly but changed my mind half way through. – David Carlisle Oct 21 '14 at 19:31

The font is indeed bold, as the following test file shows

\documentclass{article}
\usepackage[T1]{fontenc}

\newcommand{\test}[1]{%
normal: {#1test} --- bold: {#1\bfseries test}\par\medskip
}

\begin{document}
\sffamily

\test{\normalsize}
\test{\large}
\test{\Large}
\test{\LARGE}
\test{\huge}
\test{\Huge}

\fontencoding{OT1}\selectfont

\test{\normalsize}
\test{\large}
\test{\Large}
\test{\LARGE}
\test{\huge}
\test{\Huge}

\end{document}


As you see in the top half, the difference in weight is sensible between medium weight and boldface.

Typographically speaking, the bottom half is wrong, because the font scales linearly, becoming too much heavy at large sizes.

The Latin Modern fonts have the same defect as the Computer Modern, in that the largest optical size available is 17pt, while the European Modern fonts (used by default with T1 encoding) have more optical sizes available.

You get a much better result with the European Modern fonts; load the type1ec package that enables all the optical sizes with minimum amount of scaling for having every size available.

\documentclass[fontsize=12pt,a4paper, headings=twolinechapter]{scrbook}

\usepackage{xcolor}
\usepackage{graphicx}
\usepackage{lipsum} % just to generate text for the example

\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage{type1ec}

% the chapter format:
\KOMAoption{chapterprefix}{true}

\renewcommand*{\chapterformat}{%
\raggedright%
\mbox{\chapappifchapterprefix{\nobreakspace}%
\scalebox{2.5}{\bfseries\color{gray}\thechapter\autodot}}\\}

\renewcommand*{\chapterheadendvskip}{%
\vspace{-12pt}\noindent{\setlength{\parskip}{0pt}\Huge\hrulefill\par}%
\vspace{\baselineskip}
}

\addtokomafont{chapter}{\raggedleft\Huge\bfseries}

\begin{document}

\chapter{Title of the First Chapter}
\section{Title of the Section}
\subsection{Title of the Subsection}
\lipsum[1-2]
\chapter{Title of the second Chapter}
\lipsum[1-2]

\end{document}


Don't trust low resolution displays, look at the printed output or at a big magnification, staying far from the screen. Sans serif is already blacker than serif, it shouldn't be too heavy.