{math-mode} is about typesetting mathematical content, e.g. tweaking the appearance of spacing and symbols in a formula, or producing specific mathematical constructs. For questions about "wrapper" environments like equation or align, consider the tag {equations}.
141
votes
7answers
6k views
Why is \[ … \] preferable to $$ … $$?
I've heard that you should use \[ ... \] for displayed equations instead of $$ ... $$, but why is that?
I'd assumed that it's so that you can more easily tell which are starting and which are ending ...
118
votes
8answers
4k views
Are \( and \) preferable to dollar signs for math mode?
Along the lines of Why is \[ ... \] preferable to $$?, what reasons are there (if any) to favor \( ... \) over $ ... $?
51
votes
8answers
7k views
How to typeset $:=$ correctly?
I like to use $:=$ for "is defined to be equal to", but this is never typeset with the symmetry one would like, as the colon is always too low relatively to the equals sign. Is there any way of ...
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?
...
44
votes
9answers
3k views
LaTeX/Math jokes [closed]
Lighten up a bit guys. How about the following
\documentclass{article}
\usepackage{graphicx}
\begin{document}
If~~$\displaystyle\lim_{x\rightarrow8}\frac{1}{x{-}8}=\infty$
...
42
votes
1answer
352 views
Is it always best practice to not include text punctuation in inline math mode?
It has been pointed out on this site, e.g. here by egreg, that text punctuation doesn't belong to the formula in inline math. I've been following this practice for a long time, so I write for all ...
41
votes
3answers
2k views
Spacing around \left and \right
Why does the addition of a \left and \right introduces an extra space around the formula? Specifically, why do $\cos(\theta)$ and $\cos\left(\theta\right)$ render differently?
Is there a way to use ...
40
votes
6answers
31k views
How can I get bold math symbols?
To make Latin-letter variables bold I can use e.g. \mathbf{a}, but while putting Greek letters or symbols such as \nabla inside \mathbf doesn't cause any errors or warnings, it also doesn't do ...
39
votes
4answers
19k views
“(” or “\left(” parentheses?
What is the difference between ( and \left( in LaTeX? Sometimes, when the content is small, it does not seem to matter which pair I use.
What is the best practice when it comes to which parentheses ...
39
votes
4answers
5k views
When not to use \ensuremath for math macro?
I have gotten into the habit of using \ensuremath around math components in every macro that I define, so that I can use the same macro inside and outside of math mode. But egreg's comments in ...
37
votes
5answers
45k views
37
votes
3answers
8k views
What's the difference between \mathrm and \operatorname?
I apparently can't see the difference in a compilation (pdflatex) between \mathrm and \operatorname. So, as in the title the question is: is there a difference? Which one is preferable in what ...
37
votes
2answers
28k views
Absolute Value Symbols
What is the "best LaTeX practices" for writing absolute value symbols? Are there any packages which provide good methods?
Some options include |x| and \mid x \mid, but I'm not sure which is best...
36
votes
4answers
12k views
\mid, | (vertical bar), \vert, \lvert, \rvert, \divides
What's the difference between the different vertical bars?
$S = \{\, x \mid x \not= 17 \,\}$
$a \vert b$ implies $a \leq b$ when $b \ne 0$
$a|b$ implies $a \leq b$ when $b \ne 0$
$\lvert x \rvert$ is ...
36
votes
2answers
8k views
Allowing line break at ',' in inline math mode?
In the inline math mode ($...$), if the formula is too long, LaTeX will try to break it on operators, e.g.
very long text followed by a very long equation like $a+b+c+d+e+f+g+h+i+j+k+l$ etc
may be ...
34
votes
3answers
1k views
Which command should I use for displayed equations?
A number of related questions have already been asked about this issue:
align vs equation
which is preferable to
what to do with this hyperref note on amsmath
and even eqnarray vs align
But I'm ...
34
votes
1answer
525 views
What is the advantage of using $f^\prime$ instead of $f'$?
Although the two outputs look quite similar, what is the advantage of using $f^\prime$ instead of $f'$?
By the way, here is my code:
\documentclass{article}
\begin{document}
\[ f^\prime ...
34
votes
2answers
2k views
automatic size adjustment for nested parentheses
As I prefer outer parentheses to grow larger in nested expressions, I happen to insert \bigl and \bigr and its larger cousins a lot. I have always wondered whether there is a way to do this ...
33
votes
4answers
3k views
Latex: Nice abs
I have this expression: |x-|x-|x-4|||
Now, every | sign has the same size, but I'd like to make the outward pairs bigger.
Is it possible to do it automatically, or do I have to define the size of ...
33
votes
2answers
4k views
“Closed” (square) root symbol
I found a cool trick in the LaTeX wikibook which allows the square root sign to be altered such that it "closes" over its contents.
Here's an example:
("closed" root on the left, normal one on the ...
32
votes
6answers
2k views
Automatic left and right commands
Is it possible to automatically "add" \left and \right commands in front of all brackets? The source code should be left intact, but LaTeX should interpret every pair of brackets as if they were ...
32
votes
4answers
30k views
How can I split an equation over two lines
I am having the following equation:
\begin{equation}
Q(\lambda,\hat{\lambda}) = -\frac{1}{2} P(O \mid \lambda ) \sum_s \sum_m \sum_t \gamma_m^{(s)} (t) \left( n \log(2 \pi ) + \log \left| C_m^{(s)} ...
32
votes
2answers
1k views
Is there a tikz style for putting math in all nodes?
I'm finally trying out TikZ and am already infected with its programmatic philosophy. I would like to be able to do something like
every node/.style = {math mode}
(which is wrong) so that I can ...
31
votes
7answers
17k views
What is the best symbol for vector/matrix transpose?
What is the best or most popular symbol for vector/matrix transpose? I have used simply ^T, for example $c^T x$. I think it is ugly, mainly because it is a little too big compared with vector ...
31
votes
2answers
4k views
Two letter variable names
In math mode, TeX assumes "hidden multiplication" (so that two variable names put nearby have invisible multiplication between), so that, AFAICT, expressions like $ABC$ are rendered with small ...
30
votes
6answers
2k views
Writing readable LaTeX
Lets say I have the following LaTeX code
\subsection{Convex sets}
A set \( \mathcal{S} \)
in \( \mathbb{R}^n \)
is said to be convex if
\[ \mathbf{x}_1, \mathbf{x}_2 \in \mathcal{S} \implies \lambda ...
29
votes
3answers
1k views
Beyond Bringhurst: mathematical typesetting
I've been reading The Elements of Typographic Style and I was wondering whether there was a similar resource for specifically mathematical typesetting.
Is there a book or other document that sets ...
28
votes
5answers
865 views
How to make a plus sign with arrowheads on each of the four endpoints?
There is a common operation in the sparse-direct literature (see pg. 7) called an "extend-add", and it is usually denoted with a particular symbol that looks like a large plus sign with arrowheads on ...
28
votes
3answers
4k views
What are all the font styles I can use in math mode?
As can be seen in above picture, there are lots of fonts or font styles that can be used in math mode.
What are all the fonts or font styles I can use in math mode, and which packages are required ...
28
votes
1answer
3k views
Using \colon or : in formulas?
I noticed that in many documents you encounter $f: X \to Y$ instead of $f \colon X \to Y$. Another example are quantified expressions: $\forall x: P (x)$ versus $\forall x \colon P(x)$. I find the ...
27
votes
3answers
2k views
\subseteq + \circ as a single symbol (“open subset”)
I'm trying to create symbols \opn for "open subset" and \cls "closed subset". I want them to look like this:
My current solution is:
...
26
votes
5answers
860 views
Microtypography on equations
Is there a way to make all three lines of math in the code below take up the same amount of length by use of font expansion? I know too little about microtype to even see if it could offer a solution. ...
26
votes
3answers
2k views
How to have overlapping under-braces and over-braces
I am trying to typeset an equation that has overlapping over and under braces as per the image below:
I have managed to typeset it using a sort of a hack, by typing the equation twice, once using ...
25
votes
2answers
1k views
How do I write a recurring decimal in LaTeX?
Title says it all. Since I am a newbie, I don't know how to do this.
Any help?
25
votes
4answers
5k views
When one should use spacing line \quad or \,
In general, in most places, it is said that using TeX defaults is the best. However, TeX does provide things like \, and \quad etc. When one should use them? Both in general and in math mode in ...
25
votes
2answers
3k views
Difference between \big[ and \bigl[
What is the difference between \big[ (or equivalently \big() and \bigl[? Is it always necessary to mention l (left) and r (right)?
25
votes
1answer
341 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 ...
25
votes
1answer
374 views
What exactly is a “single character” or “symbol” in math mode?
There are at least three instances where single symbols in math mode receive a special treatment by the TeX engine: 1. when accents are placed, 2. when a math operator is created with ...
24
votes
5answers
6k views
What's a good way to write “x does not divide y”?
The way I currently do it is $x \not | y$, which looks awful. There's got to be something better available.
24
votes
4answers
1k views
When to use math mode?
In my document, the numbers inside math mode appear differently than those numbers out. Sometimes, I have numbers like "10 squared" within a paragraph, so it seems useful to use $10^2$. However, maybe ...
24
votes
4answers
2k views
Should subscripts in math mode be upright?
In one-letter subscripts, like $x_i$, the subscript is usually typeset italic.
Is this the typographically right thing to do?
Consider this case:
The Boltzmann constant is often written as $k_B$, ...
24
votes
3answers
2k views
What is the “correct” way of embedding text into math mode?
Lets say I have something like:
\[ Let x = number of cats \]
(This is a contrived example, but pretend we are actually inside a long align environment block...) "Let" and "number of cats" need to ...
23
votes
6answers
6k views
Prevent LaTeX to break an inline math equation
I hope this question was not asked before. At least I haven't found it. I have an inline math equation and LaTeX is breaking it into two parts. In this case I'd prefer to have the whole and short ...
23
votes
2answers
3k views
What is the difference between \mathbin vs. \mathrel?
These seem to be very similar as they both separate two operands.
When would one be used over the other?
Is there any difference in the math spacing surrounding them?
How would the spacing in these ...
23
votes
6answers
1k views
Bad positioning of math accents for the beamer standard font
With a recent TeX distribution, the easy answer to this question is "load the sansmathaccent package" (which is Ariel's implementation of my answer). Actually, the corrected font should be loaded ...
23
votes
4answers
28k views
How can I change the font size in math equations?
I find that whenever I'm typing some equations into a document, and the equation gets a bit complex (let's say a fraction in a parentheses, squared, inside a square root, inside a fraction), the ...
22
votes
4answers
753 views
What does \right. do?
I have tried searching for \right. in many places but have not been able to decipher its magical properties. Many texts use the arcane symbol but none that I have found explain it. The composition of ...
22
votes
3answers
2k views
What are the differences between $$, \[, align, equation and displaymath?
I once learnt, that it is uncool to use $$, but why is that? Why does \[ not act as a abbreviation to \begin{align}? I noticed, that there is a difference, since one cannot use & and \\ inside a ...
22
votes
6answers
581 views
Is it possible to write all mathematical formulas in a separate file and add them in main file on-demand?
Consider this scenario:
I have a report to write and I want to write all mathematical formulas in a separate file and then add them in the main report file on demand (i.e. include/import/add/call a ...
22
votes
3answers
511 views
Why are so many symbols restricted to math mode?
A common beginner's mistake is to forget \(...\)/$...$ around symbols that require math mode.
Why doesn't (La)TeX let people use isolated symbols in text mode by default?
I am sure there are at ...

