1

MWE:

\documentclass{article}
\usepackage{microtype}
\renewenvironment{quote}
{\list{}{\leftmargin0.5cm \rightmargin0cm}
\item\relax\fontsize{9.8pt}{11.4pt}\selectfont}
{\endlist}
\begin{document}
\begin{quote}
    When \\
When
\end{quote}
\end{document}

This leads to unjustified lines/letters:

enter image description here

The problem does not appear if I add \par and move the \fontsize command, but this also slightly affects vertical spaces:

\renewenvironment{quote}{\par
\fontsize{9.8pt}{11.4pt}\selectfont
\list{}{\leftmargin0.5cm\rightmargin0cm}
\item\relax}
{\endlist}

My question is related to much older ones, see here or here or here, and apparently there have been fixes introduced (I use TeX Live 2021) but I'm still not able to figure out a solution. How is the correct way to change the quote environment as I intend to?

johnny7
  • 111
  • 1
    this is fixed in microtype v3.0e, which won't be confused by the font selection commands anymore. – Robert Jul 31 '22 at 02:18

1 Answers1

2

You are adding the space (after the } at the start of the environment) it is not being ignored as you have mis-placed the font change, also for microtype, I think you need \leftprotrusion so that the start of the text is adjusted like the text afer a line break.

enter image description here

\documentclass{article}
\usepackage{microtype}
\renewenvironment{quote}
{\list{}{\leftmargin0.5cm \rightmargin0cm}%
\item\relax\fontsize{9.8pt}{11.4pt}\selectfont\leftprotrusion\ignorespaces}
{\endlist}

\begin{document}

AAAA BBB CCC AAAA BBB CCC AAAA BBB CCC AAAA BBB CCC AAAA BBB CCC AAAA BBB CCC AAAA BBB CCC AAAA BBB CCC AAAA BBB CCC AAAA BBB CCC \begin{quote} When \ When \end{quote} \end{document}

or simpler as noted in comments

\fontsize{9.8pt}{11.4pt}\selectfont\item\relax}

so that microtype can handle the protusion of the characer after \itemwihout being confused by the font change in between.

David Carlisle
  • 757,742
  • When I redefine quote as you suggest, the problem you helped me solve yesterday reappears and the preceding paragraph is squeezed. Is there still a way to redefine it without \par? – johnny7 Mar 30 '22 at 20:33
  • @johnny7 sorry yes, fixed that, actually if you put microtype back you get a slight shift in the secod line, but not the first but I think that's a different issue – David Carlisle Mar 30 '22 at 21:30
  • Unfortunately, adding \ignorespaces to the definition remains without effect for me. – johnny7 Mar 30 '22 at 21:36
  • run the code as posted here and you should get the output shown,. – David Carlisle Mar 30 '22 at 21:42
  • When I reenable microtype, the first line is still indented as in my original code. – johnny7 Mar 30 '22 at 21:44
  • no less, the original code it had a space, but as I say microtype adjusts the W after \\ but not at the start.... ah seems to be a microtype feature, try now, I added \leftprotrusian – David Carlisle Mar 30 '22 at 21:55
  • Yes, the \leftprotrusian does the trick! \ignorespaces is not needed to fix the wrong indent of the first line. Thanks again! – johnny7 Mar 30 '22 at 21:59
  • Page 25 of the microtype documentation mentions a built-in patch for item that addresses the exact problem described here. The fontsize change seems to override this patch. – johnny7 Mar 30 '22 at 22:07
  • 1
    @johnny7 ah try putting the font change just before \item then ending with \item\relax – David Carlisle Mar 30 '22 at 22:12
  • Yes, that makes the \leftprotrusion obsolete! And I thought I had tried every position of the font change... I also saw other examples that gave a font change after \relax. – johnny7 Mar 30 '22 at 22:16
  • @johnny7 I added a note to the answer, thanls – David Carlisle Mar 30 '22 at 22:32