[Tex/LaTex] Microtype and quote environment leads to different indent of first line

microtypepunctuationquotingspacing

When the microtype package is loaded a quote environment which starts with punctuation marks is inconsistent "indented". The first line in the following minimal example is unaffected, i.e. at the same place as without the package, but the next two lines are pushed to the left. I realize that it is a feature of the microtype package to push punctuation marks into the margin, but here it looks quite ugly because it isn't consistent. The first line is most likely different because of the included \item in \begin{quote}.

Is there a way to get the indention consistent? Can I temporarly disable this feature of microtype just for this environment? I'm having such code in some package manuals where some verbatim code lines which start with "punctuation" like { inside a quote environment.

\documentclass{article}
\usepackage{microtype}
\begin{document}
text text text text text text text text text text text text text text text text
\begin{quote}
    ()\\
    ()\\
    ()
\end{quote}
text text text text text text text text text text text text text text text text
\end{document}

Result

Best Answer

The suggested solution from the author of microtype is this:

\documentclass{article}
\usepackage{microtype}
\makeatletter
\newcommand*\protrudeleft[1]{%
    {\everypar{}%
     \setbox\z@\vbox{\noindent#1}%
     \vbadness=\@M
     \splittopskip=\z@
     \global\setbox\z@=\vsplit\z@ to \baselineskip
     \unvbox\z@ \global\setbox\z@=\lastbox
    }%
    \ifhbox\z@
      \leavevmode
      \kern\leftmarginkern\z@
    \fi
    #1}
\makeatother
\begin{document}
text text text text text text text text text text text text text text text
text
\begin{quote}
    \protrudeleft()\\
    ()\\
    ()
\end{quote}
text text text text text text text text text text text text text text text
text
\end{document}

Attention: You will perhaps have to put the argument of \protrudeleft in braces if is not a like here a simple character.

Related Question