jbezos / enumitem

Customize enumerate, itemize and description
MIT License
48 stars 5 forks source link

enumerate* is losing spaces when guarded by a brace group #13

Closed FrankMittelbach closed 5 years ago

FrankMittelbach commented 5 years ago

This shows the problem: extra set of braces is needed to keep the spaces:

\documentclass{article}

\usepackage[inline]{enumitem}

\newlist{inenum}{enumerate*}{1}

% ok
\setlist[inenum]{label=(\alph*),before={{\unskip: }},
                 itemjoin={{; }},itemjoin*={{ and }}}

% bad
\setlist[inenum]{label=(\alph*),before={\unskip: },
                 itemjoin={; },itemjoin*={ and }}

\begin{document}
\ldots\ text before
\begin{inenum} \item one \item two \item three
                    \end{inenum} and more text.
\end{document}
jbezos commented 5 years ago

This is the default behavior of keyval. I thought this changed recently, but the the outer braces are still stripped off. So, I've added a warning in the docs (on p 3).

FrankMittelbach commented 5 years ago

My understanding is that the default behavior of keyval is to strip spaces if not in {...}. But I find it surprising that it needs 2 level of braces ... that sounds to be like a bug and I haven't seen that elsewhere before!

jbezos commented 5 years ago

Sorry, but I can't see where the bug is. Compare with:

\usepackage{keyval}
\makeatletter
\define@key{test}{a}{\def\toshow{(#1)}\show\toshow}
\setkeys{test}{a={{; }}, a={; }, a={{ and }}, a={ and }}

Which shows:

->(; ).
->(;).
->( and ).
->(and).
FrankMittelbach commented 5 years ago

ok, then it is a keyval (mis)feature. I opened up a report there.