# How to fix scrlayer-scrpage / microtype kerning issue?

I am experiencing a weird interaction between scrlayer-scrpage package from Koma Script and a custom microtype setting. I am using scrartcl class together with Minion Pro font and scrlayer-scrpage. I also use microtype to increase the kerning between apostrophe glyphs as the default kerning is a bit too narrow to my taste.

Here is a MWE:

\documentclass{scrartcl}

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

\usepackage[french]{babel}
\PassOptionsToPackage{babel, kerning=true}{microtype}
\usepackage[loosequotes]{MinionPro}

\usepackage{scrlayer-scrpage}

\SetExtraKerning[ name     = french-custom,
context  = french,
unit     = space   ]
{ encoding = *}
{
' ={100,200},
’ ={100,200}
}

\begin{document}

l'éléphant \textit{l'éléphant}

\newpage

l'éléphant \textit{l'éléphant}

\newpage

l'éléphant \textit{l'éléphant}

\newpage

l'éléphant \textit{l'éléphant}

\end{document}


Here is what I am getting with pdfTex: in the first page, the kerning is correct on both fonts, regular and italic.

However, on the following pages, the kerning correction is not added to the italic font despite being applied to the regular font.

The issue disappears if I remove the package scrlayer-scrpage. However I really need scrlayer-scrpage to achieve a specific layout so this would be nice if there is a way to make it compatible with the kerning correction.

How can I fix this issue ? Thank for your help!

The problem is not restricted to the usage of scrlayer-scrpage (or any other KOMA-Script package or KOMA-Script class). It also occurs after any temporary usage of \slshape, e.g.:

\documentclass{article}

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

\usepackage[french]{babel}
\PassOptionsToPackage{babel, kerning=true}{microtype}
\usepackage[loosequotes]{MinionPro}

\SetExtraKerning[ name     = french-custom,
context  = french,
unit     = space   ]
{ encoding = *}
{
' ={100,200},
’ ={100,200}
}

\begin{document}

l'éléphant \textit{l'éléphant}

\newpage

{\slshape}% temporary and local usage of \slshape
l'éléphant \textit{l'éléphant}

\newpage

l'éléphant \textit{l'éléphant}

\newpage

l'éléphant \textit{l'éléphant}

\end{document}


or

\documentclass{article}

\usepackage[T1]{fontenc}
\usepackage[french]{babel}
\PassOptionsToPackage{babel, kerning=true}{microtype}
\usepackage[loosequotes]{MinionPro}

\SetExtraKerning[ name     = french-custom,
context  = french,
unit     = space   ]
{ encoding = *}
{
' ={100,200},
’ ={100,200}
}

\pagestyle{headings}% for headings article also uses \slshape, which is replaced by an italic shape automatically
\begin{document}

l'éléphant \textit{l'éléphant}

\newpage
l'éléphant \textit{l'éléphant}

\newpage
l'éléphant \textit{l'éléphant}

\newpage
l'éléphant \textit{l'éléphant}

\end{document}


have the same issue with

from the second page, but do not use any KOMA-Script package or class. It seems, that this is related to the font warning:

LaTeX Font Info:    Font shape T1/MinionPro-OsF/m/sl' in size <10> not available
(Font)              Font shape T1/MinionPro-OsF/m/it' tried instead on input line 25.


scrlayer-scrpage uses \slshape as a default for the page head and foot (see element pageheadfoot in the manual). However, as there is no slanted, you can explicitly replace the usage of the slanted font in scrlayer-scrpage by the usage of an italic font:

\documentclass{scrartcl}

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

\usepackage[english]{babel}
\PassOptionsToPackage{babel, kerning=true}{microtype}
\usepackage[loosequotes]{MinionPro}

\usepackage{scrlayer-scrpage}

\SetExtraKerning[ name     = english-custom,
context  = english,
unit     = space   ]
{ encoding = *}
{
' ={100,200},
’ ={100,200}
}

\begin{document}

l'éléphant \textit{l'éléphant}

\newpage

l'éléphant \textit{l'éléphant}

\newpage

l'éléphant \textit{l'éléphant}

\newpage

l'éléphant \textit{l'éléphant}

\end{document}


Note: This does not really solve the \slshape issue in general but the occur of this issue in using scrlayer-scrpage, because it avoids the implicit replacement of the slanted font by an italic one.

• This is a very good dissection and (at least to me) surprising in two aspects: KOMA-script uses slanted?! And second: This is a bug of microtype, isn't it? – Keks Dose Jan 16 '19 at 8:01
• @KeksDose Yes, KOMA-Script uses slanted. As you understand German, see the note about the usage of \slshape in komascript.de/faq-voreinstellung. I do not known whether this is a bug in microtype, but IMHO it is an issue of microtype and LaTeX's font replacement mechanism. – Schweinebacke Jan 16 '19 at 8:19
• This has been fixed in microtype v2.7d. – Robert Nov 19 '19 at 0:15