1

I've met today a bad interaction between microtype, csquotes autoquotes, and the itemize environment, essentially leading to a "forgotten \endgroup" error.

A MWE:

\documentclass{article}

\usepackage{microtype}

\usepackage{csquotes}
\MakeAutoQuote{“}{”}

\begin{document}

\begin{itemize}
\item “foo”
\end{itemize}

\end{document}

Which leads to error:

./document.tex:11: Extra }, or forgotten \endgroup.
<recently read> }
                 
l.11 \item “
              foo”
./document.tex:12: Missing } inserted.
<inserted text> 
                }
l.12 \end{itemize}

I can only reproduce when both packages are loaded and the active quote immediately follows \item (passing an empty optional argument to it does not change things).

Am I missing something, or is this really a bad interaction between the packages? (I'm pretty sure this used to work, but my memory is known to have failed in similar instances...). If it is indeed, I suppose a report is due. I'd gladly do it, but I'm not sure whom to with this. Pointers in that regard are welcome. As is some temporary workaround.

2
  • 2
    your memory doesn't fool you, this is a new bug in microtype. A temporary workaround would be to add `\microtypesetup{nopatch=item} (either for the whole document or just around the itemize environment). See chapter 9 of the doc. Commented Nov 5, 2021 at 14:55
  • @Robert It seems to be it. Thank you very much! If you'd like to elaborate it as an answer, I'd be happy to accept. I'll prepare a bug report for microtype later on. Commented Nov 5, 2021 at 15:54

1 Answer 1

4

EDIT: This has been fixed in microtype version 3.0a.


Beginning with version 3.0, microtype applies some patches to improve protrusion at "inner margins", e.g. at the beginning of \items (see chapter 9 of the microtype doc). This requires some gymnastics, and here the active character from csquotes interferes. A quick fix would be to prevent the patching with \microtypesetup{nopatch=item}, either for the whole document or only the problematic case. A better fix (which will be included in the next version) would be to patch the pertinent microtype command:

\documentclass{article}

\usepackage{microtype}

\usepackage{csquotes}
\MakeAutoQuote{“}{”}
\usepackage{etoolbox}

\begin{document}

\begin{itemize}
\microtypesetup{nopatch=item} 
  \item “foo” some more text\\ “another quote”
\end{itemize}

\makeatletter 
\patchcmd\MT@get@prot{\noindent}{\noindent\@disablequotes}{}{}
\makeatother
\begin{itemize}
  \item “foo” some more text\\ “another quote”
\end{itemize}

\end{document}

(In a real document, you'd move the \MT@get@prot patch to the preamble, of course.)

output

3
  • Thank you very much! I have opened an issue: github.com/schlcht/microtype/issues/1, but considering the phrasing of your answer, I suppose "R" stands for Robert, in which case, feel free to just close there. :) Commented Nov 5, 2021 at 18:34
  • @gusbrs Thanks, and yes, your guess is right. Commented Nov 5, 2021 at 18:51
  • One more reason to thank you, then. I'm looking forward to the next version (with no hush). Commented Nov 5, 2021 at 19:03

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.