# Microtype kerning won't work with quotationmarks

To be clear it is possible to get it working generally and I have got it working in a minimal document. However I just can't get it to work in my actual thesis. I did not succeed in creating a true minimal example of the issue, therefore I'm going to dump a short example with my entire preamble and essentially the whole document structure:

%% LyX 2.2.0 created this file.  For more info, see http://www.lyx.org/.
%% Do not edit unless you really know what you are doing.
\documentclass[12pt,english,ngerman,openany]{book}
\usepackage{helvet}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage[charter,expert]{mathdesign}
\usepackage[a4paper]{geometry}
\usepackage{fancyhdr}
\pagestyle{fancy}
\usepackage{refstyle}
\usepackage{float}
\usepackage{amsmath}
\usepackage{amsthm}
\usepackage[demo]{graphicx}
\usepackage{setspace}
\onehalfspacing

\makeatletter

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% LyX specific LaTeX commands.

\AtBeginDocument{\providecommand\figref[1]{\ref{fig:#1}}}
\AtBeginDocument{\providecommand\eqref[1]{\ref{eq:#1}}}
\AtBeginDocument{\providecommand\subsecref[1]{\ref{subsec:#1}}}
\AtBeginDocument{\providecommand\algref[1]{\ref{alg:#1}}}
\AtBeginDocument{\providecommand\secref[1]{\ref{sec:#1}}}
\AtBeginDocument{\providecommand\tabref[1]{\ref{tab:#1}}}
%% Because html converters don't know tabularnewline
\providecommand{\tabularnewline}{\\}
\floatstyle{ruled}
\newfloat{algorithm}{tbp}{loa}[chapter]
\providecommand{\algorithmname}{Algorithmus}
\floatname{algorithm}{\protect\algorithmname}
\RS@ifundefined{subsecref}
{}
\RS@ifundefined{thmref}
{\def\RSthmtxt{theorem~}\newref{thm}{name = \RSthmtxt}}
{}
\RS@ifundefined{lemref}
{\def\RSlemtxt{lemma~}\newref{lem}{name = \RSlemtxt}}
{}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% Textclass specific LaTeX commands.
\numberwithin{equation}{section}
\numberwithin{figure}{section}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% User specified LaTeX commands.
\usepackage{XCharter}
\usepackage{lipsum}
\usepackage{babel}
\usepackage[tracking,kerning=true,letterspace=60,babel]{microtype}
\usepackage[dvipsnames]{xcolor}
\usepackage{pstricks}
\usepackage{siunitx}
\usepackage{placeins}
\usepackage{mdframed}
\usepackage{csquotes}
\usepackage[width=0.85\textwidth]{caption}
\usepackage{quoting}
\usepackage{varioref}
\usepackage[style=numeric,backend=biber,isbn=false,url=true,doi=true]{biblatex}
\usepackage[toc,page]{appendix}
\usepackage[calcwidth]{titlesec}
\usepackage[unicode=true,pdfusetitle,
bookmarks=true,bookmarksnumbered=false,bookmarksopen=false,
{hyperref}

%%%%%%%%%%%5
%Setup units
%%%%%%%%%%
\sisetup{copy-decimal-marker}
\DeclareSIUnit[number-unit-product=\,]\rpm{rpm}
\captionsetup[figure]{font=small,labelfont=bf,textfont=sl}

%%%%%%%%%%%
%Custom figures
%%%%%%%%%%%%
\let\figoldstart\figure
\let\figoldend\endfigure
\renewenvironment*{figure}[1][btph]{\figoldstart[#1]{}\begin{mdframed}[userdefinedwidth=0.9\textwidth{},align=center]\bgroup\centering}{\egroup\end{mdframed}\figoldend{}}

%%%%%%%%
%Bibliography
%%%%%%%%%%%%%5

%%%%%%%
%Custom section formats
%%%%%%%%%%
%\newcommand{\chapterbreak}{\clearpage}

\titleformat{\chapter}[block]
{\filcenter\Large\scshape}
{\Huge\rmfamily\bfseries\color{Mahogany}\thechapter}
{0.5em}
{}
[{
\begingroup
\setlength{\titlewidth}{0.88\textwidth}
\titleline*[c]{\titlerule[.3pt]}
\endgroup
\begingroup
\color{Mahogany}
\setlength{\titlewidth}{0.44\textwidth}
\titleline*[c]{\titlerule[0.5pt]}
\endgroup
\begingroup
\setlength{\titlewidth}{0.66\textwidth}
\titleline*[c]{\titlerule[.3pt]}
\endgroup
}]
\titlespacing*{\chapter}{0pt}{-1\baselineskip}{\baselineskip}

\newcommand*{\spacedUpCase}[1]{\textls{\MakeUppercase{#1}}}
\titleformat{\section}{\sffamily\large}{{\fcolorbox{White}{Mahogany}{\color{White}\rmfamily\itshape\thesection}}}{0.5em}{\spacedUpCase}%\textls{\MakeUppercase{#1}}}
\titlespacing*{\section}{0pt}{1.5\baselineskip}{1ex}

\newcommand*{\dashafter}[1]{#1\ ---}
\titleformat{\subsection}[block]{\bfseries\centering}{\thesubsection}{0.5em}{}[]
\titlespacing*{\subsection}{0pt}{2ex}{0.5ex}

\titleformat{\subsubsection}[runin]{\itshape}{\thesubsubsection}{0pt}{}[\,{\color{Mahogany}\Large--}]
\titlespacing{\subsubsection}{0pt}{\baselineskip}{1.5ex}
%%%%%%%%%
%Custom references
%%%%%%%%%%%%
\newref{fig}{refcmd={\textsl{Abbildung~\textsf{\ref{#1}}}~\vpageref{#1}}}
\newref{sec}{refcmd={Abschnitt \textbf{\ref{#1}}}}
\newref{subsec}{refcmd={\textsl{Abschnitt~\textsf{\ref{#1}}}}}
\newref{alg}{refcmd={\textsl{Algorithmus~\textsf{\ref{#1}}}~\vpageref{#1}}}
\newref{eq}{refcmd={\textsl{Gleichung~\textsf{\ref{#1}}}}}

\setcounter{errorcontextlines}{9999}

%%%%%%%%%%%%%5
%Custom quotes
%%%%%%%%%%%%
\newcommand*{\boldopenquote}{{\color{Mahogany}\upshape\textbf{,,}}}
\newcommand*{\boldendquote}{{\color{Mahogany}\fontshape{n}\fontseries{b}\selectfont\textquotedblright}}
\quotingsetup{font=itshape,begintext=\boldopenquote,endtext=\boldendquote}
\renewenvironment*{quote}{\begin{quoting}}{\end{quoting}}
\renewenvironment*{quotation}{\begin{quoting}}{\end{quoting}}

%appendix name
\renewcommand*{\appendixpagename}{Anhang}
\renewcommand*{\appendixtocname}{\appendixpagename}

%%%%%%%%%%%%%%
%%%%%%%%%%%%
\newcommand*{\pghdrsetup}[0]{
\fancyhead[RO]{ \textit{\small Max Mustermann }\hspace{2,25mm} \includegraphics[width=15mm, height=8mm]{logo}}
\fancypagestyle{plain}{\pghdrsetup}

%%%%%%%%%%%%%%%%
%prevent empty pages
%%%%%%%%
\let\cleardoublepage\clearpage

%%%%%%%%%%%%
%microtype extra settings
%%%%%%%%%%
\SetExtraKerning[inputenc=utf8]{encoding={*}, family={bch}}{„={,1000},\textquotedblright={1000,}}

\makeatother

\usepackage{babel}

\begin{document}
\raggedbottom{}\newgeometry{left=3cm,right=3cm,top=2cm,bottom=2cm}\begin{titlepage}
\begin{center}
\includegraphics[width=4cm]{logo}\bigskip{}
\par\end{center}

\begin{center}
\par\end{center}

\vspace*{1.5em}

\begin{singlespace}
\begin{center}
{\large{}Max Mustermann}
\par\end{center}{\large \par}

\begin{center}
\textsf{\large{}\today}
\par\end{center}{\large \par}
\end{singlespace}

\vfill{}

\begin{center}
\includegraphics[width=7.5cm]{something}
\par\end{center}

\medskip{}

\begin{singlespace}
{\centering\large\textls[250]{\textsc{Thesis}}\par}
\end{singlespace}

\medskip{}

\vfill{}

\end{titlepage}\restoregeometry{}

\frontmatter\lipsum[1]

\newpage{}

\lipsum[1]\newpage{}

%\pagestyle{plain}
%\pagenumbering{Roman}

\tableofcontents{}

\pagebreak{}

\mainmatter
\pagestyle{fancy}
\pghdrsetup

\chapter{A frustraing excercise in Latex}

\section{Why won't this freaking work?}

\subsection{Lo and behold}

\lipsum[1]

\selectlanguage{english}%
\begin{quotation}
Some quotation goes here, not that short in size either\@. Not long enough to use lipsum however\@. Unfortunately kerning doesn't work\@.
\end{quotation}
\selectlanguage{ngerman}%
\lipsum[1]
\noindent %\backmatter
\printbibliography

\appendix
\pagebreak{}

\appendixpage

\end{document}


On the other hand in this minimal example it seems to work just fine

\documentclass[english,ngerman]{book}
\usepackage[charter]{mathdesign}
\usepackage{babel}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{XCharter}
\usepackage[kerning,babel]{microtype}
\usepackage[dvipsnames]{xcolor}
\usepackage{quoting}
\newcommand*{\boldopenquote}{{\color{Mahogany}\upshape\textbf{,,}}}
\newcommand*{\boldendquote}{{\color{Mahogany}\fontshape{n}\fontseries{b}\selectfont\textquotedblright}}
\quotingsetup{font=itshape,begintext=\boldopenquote,endtext=\boldendquote}
\SetExtraKerning[inputenc=utf8]{encoding={*}, font={bch}, series={b}}{„={,1000},\textquotedblright={1000,}}
\begin{document}
\selectlanguage{english}%
\begin{quoting}
lorem ipsum
\end{quoting}

\end{document}


I just can't figure out what the problem is in my actual document. I'm using the most up to date MikTex. I'd be very grateful for any pointes.

• Please note that the kerning in the working example is exeggerated for demonstrative purposes. – Daniel Sep 16 '16 at 9:37
• You got lost in your font setup. The family active at the quotation is XCharter-TLF and not bch. – Ulrike Fischer Sep 16 '16 at 10:59
• Which engine are you using? Because you must be using either TeX or pdfTeX (rather than XeTeX or LuaTeX) , given your font configuration and use of inputenc. But your microtype configuration suggests you are not using TeX. That leaves pdfTeX. But then you are loading pstricks (without doing anything special), which won't work properly with pdfTeX and will cause some other things to break. – cfr Sep 17 '16 at 1:27

You are using font={bch} in your working example. This is the wrong syntax for the key and it leads to a warning and is actually ignored:
Package microtype Warning: family axis is empty in font specification
(microtype)                bch////'. Using XCharter-TLF' instead on input line 38.

In the non-working example you are using the correct key family but with the wrong value bch. Correct would be family=XCharter-TLF.