Stack Exchange Network
Stack Exchange network consists of 182 Q&A communities including
Stack Overflow
, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.
Visit Stack Exchange
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It only takes a minute to sign up.
Sign up to join this community
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
Learn more about Teams
From the LaTeX kernel (
latex.ltx
):
\DeclareRobustCommand{\{}{\ifmmode\lbrace\else\textbraceleft\fi}
\DeclareRobustCommand{\}}{\ifmmode\rbrace\else\textbraceright\fi}
Thus differences:
\{
and \}
work in both text and math mode, \lbrace
and \rbrace
only in math mode. The latter macros trigger an error in text mode.
\{
and \}
are shorter (two characters instead of seven).
\{
and \}
are robust commands. For the discussion of the robustness of
\lbrace
and \rbrace
, see below.
\{
and \}
might be better supported by editors (matching support, see comment of jjdb).
Similarities:
In math mode both variants execute \lbrace
and \rbrace
.
The same math spacing.
\lbrace
and \rbrace
are defined in fontmath.ltx
, also part of the LaTeX kernel (see source2e.pdf):
\DeclareMathDelimiter{\lbrace}
{\mathopen}{symbols}{"66}{largesymbols}{"08}
\DeclareMathDelimiter{\rceil}
{\mathclose}{symbols}{"65}{largesymbols}{"07}
They are defined as (\show\lbrace
/\show\rbrace
):
\def\lbrace{\delimiter "4266308 }
\def\rbrace{\delimiter "5267309 }
And \delimiter
is a unexpandable TeX primitive. It is followed by "
and a number, both with catcodes 12
(other, unexpandable). And the space at the end is not expandable either. If the characters are reread, e.g. in the table of contents, then the quote character "
might cause trouble, if it is used as active character. For example, if someone defines a babel
shorthand "4
or "5
.
Answer to the comment of egreg
referring to his answer to an index question. The quote character "
has a special meaning for index entries.
(With the default meaning "4
or "5
become 4
or 5
in the index, the
quote character gets lost.) This can happen if \index
is used in an argument of another command. Otherwise \index
reads its argument with verbatim catcodes,
thus macros are not expanded.
–
–
–
–