Microtype and quote environment leads to different indent of first line

Main microtype features can be enabled or disabled on the fly using the \microtypesetup command. In this case we need to locally disable character protrusion:

\documentclass{article}
\usepackage{microtype}

\newenvironment{example}{\microtypesetup{protrusion=false}%
  \begin{quote}}{\end{quote}}

\begin{document}
text text text text text text text text text text text text text text text text
\begin{example}
    ()\\
    ()\\
    ()
\end{example}
text text text text text text text text text text text text text text text text
\end{document}

This will, of course, have effect on all characters, be it () or any other symbol. An interesting task would be to selectively disable this feature if it should be kept enabled for symbols other than ().


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.


I'd define my own microtype-safe environment to consistently have protrusion everywhere. Adjust the 3em to your needs:

\documentclass{article}
\usepackage{microtype}
\newenvironment{mtsafequote}
    {\par\bgroup\leftskip=3em\rightskip=3em\noindent\ignorespaces}
    {\par\egroup\noindent}
\begin{document}
text text text text text text text text text text text text text text text text
\begin{mtsafequote}
    ()\\
    ()\\
    ()
\end{mtsafequote}
text text text text text text text text text text text text text text text text
\end{document}