Conventionally { and }; used to delimit groups or arguments in (La)TeX code.
50
votes
4answers
1k views
{(x+y)}^2 or (x+y)^2?
This expression is just an example, of course.
My question is: should one always specify the quantity being exponentiated by surrounding it with braces, or is it acceptable to drop those braces?
...
46
votes
6answers
1k views
How bad for TeX is omitting braces {}, even if the result is the same?
Sometimes writing braces and omitting them produces the same result:
\tilde{\psi} \mathrm{e}^{\mathrm{i} \pi}
vs
\tilde \psi \mathrm e^{\mathrm i \pi}
Or (taken from Werner's comment below)
...
33
votes
5answers
13k views
Adding a large brace next to a body of text
I'm writing a short document listing some chronological events. I want to pick out a period with a big brace. Here's a quick mockup:
What's the best way to do this? Can I set the size declaratively ...
31
votes
8answers
2k views
Why do people use unnecessary braces?
I often see people creating new macros where the macro token is surrounded by braces. For example,
\newcommand{\foo}{foo}
This is unnecessary and I find the extra braces make it harder to read. Why ...
25
votes
1answer
350 views
\{ & \} vs \lbrace & \rbrace
Surprisingly I haven't found a question, so if this is duplicate, I will remove the question.
So, what is the difference in using \{ and \} to using \lbrace and \rbrace?
Which one is preferred, and ...
23
votes
2answers
721 views
Asymmetric overbrace
This question led to a new package:
abraces
How can I control the position of an overbrace's spike?
e.g. I want:
/------^----------------------\
aksdj ajksdnkajs ajsdknakjsnd jaknd
As ...
23
votes
5answers
1k views
Showcase of brace tricks: }, \egroup, \iffalse{\fi}, etc.
There have been a few questions about braces recently, specifically about when to use them (see this and that question). Note: I had mistakenly stated that SamB was the author of both questions.
But ...
20
votes
3answers
418 views
Why are text format commands used inside braces?
Most commands in Latex are written with the arguments inside braces following the command: \command{arguments}. But text formatting options, like \em, or \scriptsize are usually written inside the ...
20
votes
3answers
728 views
Why does TeX remove braces around delimited arguments?
On pp. 203–204 of the TeXbook, Knuth describes how TeX absorbs macros' arguments: delimited go until the first appearance of the delimiter, and undelimited go until the next token, in both cases ...
17
votes
1answer
184 views
Brackets around matrices in TikZ
I'm writing a custom package for labeled matrices using TikZ. I noticed an inconsistency in TikZ. This is best illustrated with the following MWE:
\documentclass{standalone}
\usepackage{tikz}
...
15
votes
2answers
130 views
How do extra braces impact the placement of items in the document?
I am placing some of my document through some outside BASH scripts, but want to protect some information such that the scripts will not change them. The simplest option for me is to put { and } around ...
14
votes
2answers
10k views
How can I get text underneath an underbrace?
I am looking to do something of the following:
To get text underneath the underbrace. Is it involving \stackrel or some sort of similar command?
13
votes
3answers
2k views
How to put a brace on the right, not left, to group cases?
How can I get a brace on the right, not the left, to group cases, using cases? (I know actual cases look better with the brace on the left, but the items I need to group are not literally cases. They ...
13
votes
3answers
4k views
Aligning across 'aligned' equation blocks
I'd like to format two groups of equations such that all their equal signs line up and such that I can put a big brace to the right of each block to annotate that block. The last part is easily ...
12
votes
2answers
220 views
necessity of braces for accent commands
Many resources on LaTeX teach that "é" and "ä" are typeset with (respectively) \'{e} and \"{a}; and it is similar for other accent symbols. Are the braces really needed? Aren't \'e and \"a shorter but ...
11
votes
2answers
130 views
Differences in vertical positioning of superscripts and subscripts depending on grouping (`{ }`): Why? Caveats? Workarounds?
This question about {(x+y)}^2 vs (x+y)^2 drew my attention to the slightly different vertical positioning of super- and subscripts for such expressions. Compare (x+y)^8_8 (left) and {(x+y)}^8_8 ...
11
votes
3answers
686 views
whitespace/brace/indentation conventions for LaTeX programming
This question is not about formatting the text/markup of a document. I'm really focused on the programming aspect of LaTeX. I'm working on a fairly large set of document classes and packages, and ...
10
votes
1answer
160 views
Straight Braces
Can I make a variant of Latex Braces? In some equations system, I'd like to use a left brace like in this picture:
10
votes
2answers
575 views
Side brace around image with underbrace
I have an image and I want to put a side brace on the left and an underbrace on the bottom. The underbrace works fine, but the left becomes twice the image height for some reason. I'm sure the image ...
10
votes
1answer
172 views
Curly brackets around a table
I would like to have braces on the left side of a table (either that or on the right side) and bellow the same table.
What I have got is
$
m-Mal
\underbrace{
...
10
votes
1answer
162 views
Treating < and > as synonyms for the curly braces { and }
I am exporting photo metadata from a software which seems to be unable to export curly braces correctly. Is there any way to tell LaTeX to treat < as {, and > as }, to keep me from having to go ...
9
votes
2answers
331 views
How can I draw annotated braces over and under math expressions?
What LaTeX markup would one have to write to produce a result similar to the image below?
Please excuse my Paint-and-mouse drawing skills. :-)
9
votes
2answers
2k views
Put a curly brace under an ellipsis in a math setting?
so I have $m\times n = n + n + \dots + n$ in my text right now, but I would like to put a curly brace under the \dots to emphasize that there are m n's involved. How would I do this?
9
votes
1answer
106 views
Using xy-pic, how do you label an arrow with a curly brace that spans the length of the arrow, and can be offset arbitrary distances?
I'm trying to figure out how to label the arrows with curly braces that span the length of the arrow, and to make it all very pretty. More specifically, I'm trying to make
...
8
votes
1answer
4k views
Double square braces like these ⟦exp⟧?
How do I create mathematical equation double square braces like these ⟦exp⟧ in latex? I failed to find it on google (I created these using word 2010 equation editor). I would like these to be of ...
8
votes
1answer
2k views
Adjusting vertical alignment of underbraces
Is there a way to align multiple underbraces so that they sit on the same horizontal line?
For example, the following code
\[
\biggl(
\underbrace{0,1}_{A},
\underbrace{\frac{1}{2},\frac{1}{3}}_{B}
...
8
votes
1answer
77 views
Brace from {cases} environment disappears after rowcolors*{1}{…}{…}
I use rowcolors*{1}{...}{...} to color a table, then I use it again (with white as arguments) to reset the color. After that, braces look weird (they disappear slightly).
If I use scrbook, book, ...
8
votes
2answers
2k views
A lateral brace to group a set of equations with labels
I have a set of equations that I'd like to display together (as an example, the Maxwell's equations).
Requirement #1: I'd like to have them labelled like in an align environment
\begin{align}
...
7
votes
1answer
178 views
How to adjust brace size for nested braces?
How can I adjust the size of the outer braces to make the following equation neater?
\documentclass[a4paper]{scrreprt}
\usepackage{amsmath}
\begin{document}
\[
M = \left\{ x \in X :
...
7
votes
1answer
125 views
typesetting material to the left of a big curly brace
\documentclass{article}
\newcommand*{\LeftWidth}{3.0cm}%
\newcommand*{\RightWidth}{\dimexpr\linewidth-\LeftWidth-2em\relax}%
\newcommand{\AlignedBrace}[2]{%
\medskip\par\noindent%
...
7
votes
3answers
784 views
Brace and text in side margin
Within a text, I would like to emphasize one or two paragraphs by placing a curly brace in the left side margin, and next to it some short text vertically centred around the brace's centre.
The ...
7
votes
1answer
2k views
natbib: Error when citing paper with similar authors and same year
I get a strange error when I try cite two certain papers in the same document, when I use the natbib package (with numbers option enabled). If I trim the author list or change the year of either ...
7
votes
1answer
965 views
Annotating individual math terms with braces
I am trying to annotate individual terms of a mathematical expression, as depicted below.
The problem I get is that the comment seems to be taken as part of the fraction, which unnecessarily extends ...
7
votes
1answer
4k views
Aligning the right parts in multiple \begin{cases}
Is there an intelligent way to left-align the parts right of & of the two cases environments shown below (if x >= 0, otherwise, if y < 0, otherwise). I wonder if there is a better way than ...
6
votes
3answers
91 views
How do I handle a closing brace in a 'character scanning' macro?
Problem
I need to define a command that grabs all numerical digits following it and leaves the rest alone. Eventually I came up with this:
First Solution
\RequirePackage{xstring} % for \IfInteger
...
6
votes
2answers
196 views
Underbrace in Tikz
I'm trying to add an underbrace to a graph in tikz but when i compile run PDFLaTeX and View PDF, the underbrace doesn't look correct. Instead of curling down and inwards at the ends, it goes outwards ...
6
votes
3answers
105 views
How can I calculate the length of the longest word in a node?
I would like to create an inline brace command \inline{} for xelatex using TikZ. The difficult part is calculating the text width for the node without hardcoding it into the tikzpicture environment.
...
6
votes
2answers
815 views
\underbrace symbol is wrong
Hey guys, I tried to google the solution, but I didn't find any solution to this. I am using beamer,xelatex to prepare a slide. When I use \underbrace, the brace doesn't show, instead, a crappy symbol ...
6
votes
1answer
3k views
Adding underbrace in tikz
I have this code to draw a mass on a spring and now I want to have a curly brace below the spring to denote the distance: x_0. How do I do this?
\begin{tikzpicture}
...
6
votes
4answers
533 views
Dynamically sized brackets/parentheses for text
I'd like to have a large bracket that shows a relationship from one set of text to another, like this:
Nam dui ligula, fringilla a, )
euismod sodales, sollicitudin )
vel, wisi. Morbi auctor ...
6
votes
1answer
121 views
Labeling non axis parallel braces in tikz
Given two points, the following code draws a brace connecting them and labels it.
\documentclass{standalone}
\usepackage{tikz}
\usetikzlibrary{calc,decorations.pathreplacing}
\begin{document}
...
6
votes
1answer
976 views
Using braces to label parts of an equation
Given an equation, say Bayes' rule,
$P(X \mid O) \propto P(X)P(O \mid X)$
how do I label the different parts of the equation using curly braces?
6
votes
1answer
98 views
Can I use \begingroup \endgroup as delimiter of \detokenize, instead of {}?
I would like to use other delimiters than {} for the argument of \detokenize. E.g. something like
\detokenize\begingroup a lot of stuff \com \mycom \endgroup
but it does not work. Am I really ...
6
votes
1answer
220 views
Adjusting \underbrace “cursor” at horizontal axis
Given is following formula:
\[
\begin{split}
\sum\limits_{k=-n}^k c_ke^{ikx}=\frac{a_0}{2}+&\underbrace{\sum\limits_{k=1}^n\left(c_ke^{ikx}+c_{-k}e^{-ikx}\right)}\\
...
6
votes
1answer
640 views
Side braces - can somebody make sure I'm reading this right?
After some trial and error, and a little help from this stack overflow question I was able to put together this code:
\documentclass{article}
\usepackage{tikz}
...
6
votes
1answer
335 views
how to remove additional space around \underbrace and justify the text under it
How do I
remove the additional space around \underbrace
justify the text under it, if the latter is longer than the text above it?
To illustrate the issue:
\documentclass{article}
...
5
votes
2answers
57 views
Whole word as a macro argument when macro called without braces
I have a macro:
\newcommand{\sEmph}[1]{\textbf{\textcolor{NavyBlue}{#1}}}
Then I can do:
Some text is in \sEmph{blue}, and some in black.
with this result:
But if I omit the braces only the ...
5
votes
3answers
171 views
slim braces in a table
We need to make clear that certain data is the same in several rows. An underbrace taken from math-mode does the job quite well, but is unfortunately way too prominent in the table, especially in ...
5
votes
2answers
2k views
large braces for specifying values of variables by condition
How do I typeset something like, X = 0 if a=1, 1 otherwise, using those huge left braces and specifying each condition in a line?
5
votes
1answer
107 views
Unnecessary braces versus speed compilation process
Could the use of many unnecessary braces speed down the compilation process?
I'm asking because I use many many alert commands, defined by
\def\alert#1{\textcolor{red}{#1}}
So when I want to ...

