3

I am trying to understand how \item[ ] works in the itemize environment, and I get confused why \item[[1].] gives

[1 .]

I was assuming \item[whatever it is.] gives

whatever it is.

Could anyone help explain this? Thanks!

1 Answer 1

5

Optional arguments cannot contain ], unless it is braced, without confusing the absorption of the optional argument.

Here I insert a large labelsep so that you can clearly see what is interpreted as the label versus the item. In the first case, the internal ] triggers the end of the optional argument, because balancing of [...] does not occur by default with TeX, since they are catcode-12. Only catcode-1,2 tokens {...} are enforcably balanced during argument absorption.

\documentclass{article}
\usepackage{enumitem}
\begin{document}
\begin{itemize}[labelsep=.5in]
\item[[1].]x 
\item[{[1]}.]x 
\end{itemize}
\end{document}

enter image description here

1
  • Ah I see! Thanks!
    – Fan Ge
    May 11, 2021 at 15:47

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .