Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

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

share|improve this question
    
Originally I thought this has to do with the missing italic correction of the originally used font (tex.stackexchange.com/questions/13340/…) but after minimizing the file it turns out that is font independent. –  Martin Scharrer Mar 16 '11 at 19:00
2  
A local \microtypesetup{protrusion=false} works for me. –  Andrey Vihrov Mar 16 '11 at 19:14
    
@Andrey: This is what I was looking for! Please add it as answer. I don't know the microtype very well and didn't even know that this feature is called protrusion. It's not that obvious for an non-native speaker. –  Martin Scharrer Mar 16 '11 at 20:18
1  
I'd say that it's only a workaround to locally disable the protrusion. For your use case it might be OK, but in general it's not good to have inconsistent protrusion. –  Hendrik Vogt Mar 16 '11 at 21:01
    
@Hendrik: I agree, that it the reason I didn't accepted Andrey's answer yet. I still think the \item in the quote is the clue. The protrusion doesn't work there. –  Martin Scharrer Mar 16 '11 at 21:07
add comment

4 Answers

up vote 7 down vote accepted

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.

share|improve this answer
1  
The drawback of this solution is that you have to remember to put the \protrudeleft. What would interest me: I'm not too sure about my own answer, does it also have disadvantages? It would be great if you can tell me. –  Hendrik Vogt Mar 17 '11 at 9:41
1  
Your environment will not work as expected if the content contains lists. Include e.g. an itemize in the middle and see what happens. Also the protrusion problem affects all lists, e.g. an itemize and \protrudeleft helps there too. –  Ulrike Fischer Mar 17 '11 at 10:56
1  
@Ulrike: Ah, I see, thanks. Could microtype solve this by patching the list environment so that it automatically starts with \protrudeleft if appropriate? –  Hendrik Vogt Mar 17 '11 at 11:08
2  
Robert sent once a patch for the verse environment (in comp.text.tex, "character protruding and verses"), but said that it is rather fragile, that problems are to be expected and that "pdftex really needs a primitive to simulate line beginnings/ends". –  Ulrike Fischer Mar 17 '11 at 11:29
    
"pdftex really needs a primitive to simulate line beginnings/ends": Yes, indeed, this sounds like the Way to Go. –  Hendrik Vogt Mar 17 '11 at 12:58
show 1 more comment

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 ().

share|improve this answer
add comment

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}
share|improve this answer
    
Thanks Henderik, for my very specific application this seems to be the way to go. I added something like this to ydoc now. As Ulrike states this seems to note suite for general quote like environments. –  Martin Scharrer Mar 17 '11 at 11:42
add comment

Martin, here is the kernel of what is needed. I think you are better qualified than I am to wrap this up into a nicely robust redefined quote environment (or maybe fix it at the list, \item level):

\begin{quote}
    \quitvmode\kern\dimexpr-0.001em*\the\lpcode\font`(\relax()\\
    ()\\
    ()
\end{quote}
share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.