Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

Required fields*

8
  • 65
    You need to escape them in some way if it comes after a LaTeX command accepting options. @Qaswed's suggestion, {[ ]}, works nicely then. Commented Aug 21, 2017 at 12:37
  • 5
    @Eusebius Technically, that's not escaping the square brackets, as they are not special characters. Placing them inside a {} group effectively hides them from the TeX token scanner, which can be necessary in certain situations. But I agree, it's a valid point when it comes to tabular or after macros. Commented Aug 21, 2017 at 13:17
  • 1
    To whoever downvoted; why? Commented Aug 22, 2017 at 8:30
  • 1
    This answer is basically wrong, for the reasons given by Eusebius. If you don't surround the square brackets with curly brackets, you end up with something that may work originally, but then when you make a change (e.g., defining a new command) will end up failing with one of tex's notoriously unhelpful error messages. Commented Dec 27, 2017 at 22:49
  • 2
    I think that stressing out hypothetical and special cases together with putting it in a footnote does not quite reflect solid tangibility of this issue. I’ve hit it just now while trying to typeset regex class [:alnum:] in a tabular environment and I would have missed it here if it would not be for @Eusebius much-upvoted comment. Commented Jul 15, 2018 at 11:13