[Tex/LaTex] Wrong protrusion with csquotes and microtype

csquotesmarginsmicrotypeprotrusionpunctuation

I’m experiencing problems using the csquotes package and microtype using protrusion (margin kerning). The problem is that using \enquote I only get margin kerning on the left margin.

\documentclass{minimal}

\usepackage[utf8]{inputenc}
\usepackage[ngerman]{babel}
\usepackage[tracking]{microtype}

\usepackage{csquotes}
\MakeAutoQuote{»}{«}

\begin{document}
\def\blindtext{Dies hier ist ein Blindtext zum Testen, Testen, Testen und Testen von Textausgaben und anderen Zeichen}

\noindent%
„\blindtext.“ \blindtext{} in mehreren Zeilen.\\
\enquote{\blindtext.} \blindtext{} in mehreren Zeilen.\\
»\blindtext.« \blindtext{} in mehreren Zeilen.\\
\end{document}

The first text uses manually set quotation marks which give margin kerning both left and right.

The second and third text snipped only protrude on the left margin.

Any ideas why I have this problem and how I can possibly solve it?

Best Answer

I'd regard this as a bug in csquotes. You can solve it by putting the following code into your preamble, but I can't say if this breaks other things.

\makeatletter
\def\csq@qclose@ii#1{%
  \ifdim\lastkern=\csq@omitmarker
    #1\csq@eqgroup
  \else
    \csq@addkern@close
    \ifodd\csq@qlevel
      \csq@thequote@oclose
      \let\csq@kernchar@i\csq@thequote@oclose
    \else
      \csq@thequote@iclose
      \let\csq@kernchar@i\csq@thequote@iclose
    \fi
    %\csq@setmarker@close                 %%% Here's the change; line commented out
    \ifblank{#1}{}{\expandafter#1}%
    \expandafter\csq@eqgroup
      \expandafter\def
      \expandafter\csq@kernchar@i
      \expandafter{\csq@kernchar@i}%
    \expandafter\csq@fixkern
  \fi}
\makeatother

This works with the most recent version of csquotes. As always, when you hack into the macros of a package, there's no guarantee that the above code works with past or future versions.