10

Question: What's the difference between \left\lbrack1,2,3\right\rbrack and \left[1,2,3\right]? Why would I use one versus the other?

I recently started using mathlive, a WYSIWYG LaTeX editor, for a web project. I noticed that it uses \lbrack and \rbrack for square brackets. In years of using LaTeX, I've never encountered these commands before and so am curious

Example:

\documentclass{article}

\begin{document}

\begin{equation} \left\lbrack1,2,3\right\rbrack \end{equation} % vs \begin{equation} \left[1,2,3\right] \end{equation}

\end{document}

koleygr
  • 20,105
  • 1
    The definition can be found inside your document via the command \show\lbrack. This way you will get as output"

    > \lbrack=macro:

    ->[.

    No difference at all... It is possible programmatic the reason of this difference for debugging purposes of your WYSIWYG app.

    – koleygr Sep 10 '22 at 16:46

1 Answers1

15

LaTeX defines these via

\def\lbrack{[}
\def\rbrack{]}

so there is no difference in behaviour. However the command forms can be used on keyboard layouts that make [] inconvenient. They can also bee used inside latex optional arguments, or after a command that would otherwise parse [ as an optional argument such as \\ as an alternative to hiding [] in {}.

David Carlisle
  • 757,742
  • 4
    +1. I'd add the case "or after a command that would otherwise parse [ as an optional argument", such as \. (This does not apply to OP's specific example, but is worth mentioning since both the question title and your answer are broad and general) – marquinho Sep 11 '22 at 06:28
  • @marquinho will add, thanks – David Carlisle Sep 11 '22 at 08:45