TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

In a description like


, how do I escape the "]" character?

share|improve this question
I was obviously having some kind of meltdown here, I was reading this question even as I was suggesting \[\]. I blame the lack of coffee. – You Jul 19 '11 at 10:43
In this particular case you don't need any special precaution, of course, since the ] is already protected by braces. In general \item[...{...[]...}...] – egreg Jul 19 '11 at 10:51
up vote 14 down vote accepted

Group only the brackets or the whole expression with additional curly braces.


share|improve this answer
this works, thanks. – ptikobj Jul 19 '11 at 10:41
This is the correct answer which I would have posted as well. I therefore undeleted it. – Martin Scharrer Jul 19 '11 at 10:44
The reason a ] breaks and adding { } works is that optional arguments are not handled like normal ones (which can be cascaded) but are read as part of a macros parameter text from the [ to the very next ]. Placing the ] inside { } effectively hides it from TeX token scanner which is forced to obey the group. Note that macros defined with xparse handle cascaded [ ] correctly (through some extra effort done by that package). – Martin Scharrer Jul 19 '11 at 10:49
@Martin: Thanks. I wasn't sure since \item[\texttt{DoSomething(items[])}:] works as is and doesn't need grouping. Additional braces are only necessary when writing \item[{DoSomething(items[]):}]. – Thorsten Donig Jul 19 '11 at 15:51
@Thorsten: Any braces around ] will do. It doesn't matter if they are part of a macro argument or not. – Martin Scharrer Jul 19 '11 at 15:52

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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