I would like to include text like the following in a latex document [2007] EWCA Civ 1042.

Unfortunately if I use \[2007\] EWCA Civ 1042 the number within the square brackets is typeset on a separate line. \[ must mean something I don't know. How do I escape a square bracket?

I realise this may be a stupid question, but the only way to escape things I know of is backslash.

  • 4
    You don't have to escape square brackets in text mode, just write [2007] EWCA Civ 1042. \[ and \] start and end a displayed math equation, similar to \begin{equation*} and \end{equation*}. – sodd Apr 19 '16 at 15:43

You don't escape square brackets in LaTeX if you want them typeset. \[ and \] are basically synonyms for \begin{displaymath} and \end{displaymath}, (or \begin{equation*} and \end{equation*} with amsmath loaded), and will make the enclosed content typeset in a unnumbered displayed math equation on a separate line, which is clearly not what you want.

In conclusion you should simply write

[2007] EWCA Civ 1042

verbatim to get the output

[2007] EWCA Civ 1042

Edit: As noted in the comments, this will not work in the hypothetical special cases where the brackets follow a macro (as in \item [2007] EWA) or if it comes first in a row in a tabular. In these situations one should group the brackets inside braces as {[2007]} EWA.

  • 26
    You need to escape them in some way if it comes after a LaTeX command accepting options. @Qaswed's suggestion, {[ ]}, works nicely then. – Eusebius Aug 21 '17 at 12:37
  • 2
    @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. – sodd Aug 21 '17 at 13:17
  • To whoever downvoted; why? – sodd Aug 22 '17 at 8:30
  • 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. – Ben Crowell Dec 27 '17 at 22:49
  • @Eusebius True, added clarification about this. Thanks :) – sodd Dec 28 '17 at 12:33

You also could try this: {[2007]}

  • 3
    It works, but the braces { and } are redundant unless this comes first in a row of a tabular. – egreg Jul 14 '17 at 12:53
  • 2
    It is also useful after other commands, for instance if you want to add square brackets right after an \item. – Eusebius Aug 21 '17 at 12:35
  • @egreg It does not necessarily have to be the first line of tabular. I’ve encountered this issue with booktabs having [:alnum:] in the second row of the table. – Mr. Tao Jul 15 '18 at 11:18
  • 1
    @Mr.Tao “It comes first in a row”, not “it starts the first row”. – egreg Jul 15 '18 at 11:28

If [ and ] are causing trouble, just switch them out for \lbrack and \rbrack.

  • 1
    Only in math mode! – basseur Apr 8 at 12:53

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.