7

I want to put a set of square brackets only around custom item labels. The default labels should remain unchanged.

See the following code:

\documentclass{article}

\begin{document}

\begin{itemize}
\item First
\item [12] Second
\item Third
\end{itemize}

\begin{itemize}
\item First
\item [[12]] Second
\item Third
\end{itemize}


\end{document}

In the first list, the item label 12 appears bare. I want it to appear as [12]. In the second list, if the custom label is put with an extra of pair of brackets, the effect is almost achieved but we get a redundant space before the right bracket.

The ideal solution would be a global one, may be putting some command or key value along with \begin{itemize}, which would not require the forced extra pair as in the second list.

(I was under the impression that enumitem would be my savior, but somehow I failed to locate the solution.)

7

Your example solved:

\documentclass{article}
\begin{document}
    \begin{itemize}
        \item First
        \item [{[12]}] Second
    \end{itemize}
\end{document}

And for automatisation I would define a new command that would than apply the brackets like that. (But there may be a more elegant way to integrate it in the default \item command.)

\documentclass{article}
\newcommand\citem[1]{\item[{[#1]}] }
\begin{document}
    \begin{itemize}
        \item First
        \citem{12} Second
    \end{itemize}
\end{document}

The result in both cases:

enter image description here

  • Thanks for the solution. I will want to wait for a couple of days to see whether a solution with more automation comes up before I accept this. – Masroor May 14 '17 at 15:15

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.