Closing bracket in math mode causes error in description item and leaves a space in text mode. What can I do?
This gives error
\documentclass{article}
\begin{document}
\begin{description}
\item[$[0,1]$]
\end{description}
\end{document}
l.6 \end{description}
?
! Missing $ inserted.
<inserted text>
$
l.6 \end{description}
?
And this code leaves a space before the closing bracket
\documentclass{article}
\begin{document}
\begin{description}
\item[[0,1]]
\end{description}
\end{document}

\item[$[0,1]so the argument has an unclosed math mode, use\item[{$[0,1]$}]– David Carlisle Mar 23 '24 at 19:25]unlike{}tex does not match[]the argument for\item(and all classical latex optional arguments) ends at the first]– David Carlisle Mar 23 '24 at 19:31\item[$[0,1]$]not\item[$[0,1]], so I thought I did close the math mode, and I still get error about missing $. The label stands for the 0-1 closed interval. But I'll use grouping from now on... – Máté Wierdl Mar 23 '24 at 21:28