{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}.

learn more… | top users | synonyms (2)

210
votes
8answers
14k 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 ...
143
votes
8answers
7k 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 $ ... $?
86
votes
6answers
108k 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 ...
66
votes
3answers
96k 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...
65
votes
4answers
4k 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 ...
63
votes
8answers
14k 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 ...
61
votes
5answers
2k 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? ...
61
votes
4answers
31k 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 ...
59
votes
3answers
45k 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 ...
59
votes
3answers
19k 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 ...
57
votes
10answers
38k 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 ...
57
votes
4answers
93k 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)} ...
56
votes
5answers
90k views

How to add a matrix to a LaTeX document

How do we add a matrix to a LaTeX document?
55
votes
4answers
46k 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 ...
54
votes
4answers
11k 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 ...
53
votes
4answers
53k views

Command for argmin or argmax?

How can you get the argmin or argmax in Latex? Two solutions I found are: \underset{x}{\operatorname{argmax}} \DeclareMathOperator*{\argmin}{arg\,min} Any other ideas? [1] ...
53
votes
3answers
31k 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 ...
50
votes
2answers
9k 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 ...
49
votes
9answers
4k 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$ ...
47
votes
2answers
5k 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 ...
46
votes
3answers
14k 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 ...
45
votes
1answer
456 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 ...
43
votes
2answers
9k 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 ...
40
votes
4answers
6k 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 ...
40
votes
1answer
2k 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 ...
39
votes
6answers
3k 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 ...
39
votes
6answers
13k 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 ...
39
votes
2answers
7k 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 ...
38
votes
7answers
3k 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 ...
38
votes
3answers
2k 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 ...
37
votes
6answers
6k views

Best way to create an system of equations environment?

I am trying to write a few systems of equations, and I want the terms to be nicely spaced as below 2x + y + 3z = 10 \\ x + y + z = 6 \\ x + 3y + 2z = 13 Now, using ...
37
votes
6answers
3k 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: ...
37
votes
6answers
12k views

How can I write multiple lines in a subscript?

Is there a way to force a line break inside a math mode text? My example: \[ \underbrace{....}_\text{Some long text that should be multiline} \] Trying \text{Some long text that\\ should be ...
37
votes
2answers
2k 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 ...
36
votes
4answers
3k views

What is the Necessity of $…$ Around Numbers?

I typed up an assignment with a lot of numbers in LaTeX and turned it in to my adviser. When he returned it to me with some corrections, one of which was a lot of $ around my numbers. I understand ...
36
votes
6answers
1k 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. ...
36
votes
4answers
18k 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 ...
36
votes
2answers
40k 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?
36
votes
4answers
9k 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 ...
35
votes
4answers
26k views

Show inline math as if it were display math

I'm very familiar with how symbols display differently in inline mode (with $) vs. how display math shows them (with \[ or $$). Two examples would be with limits $\lim_{n\righarrow \infty}f(x)$ ...
35
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 ...
35
votes
2answers
13k views

How to get Beamer Math to look like Article Math

In a LaTeX article, the math characters are more "curvy" than the text characters: \documentclass[12pt]{article} \begin{document} $x^2 + y^2 = z^2$ \end{document} In a beamer presentation, the ...
34
votes
1answer
41k views

Nice looking empty set?

I feel like the standard $\emptyset$ is ugly. By hand, my empty set symbol is a lot rounder, then this "slashed-zero"-type symbol. Two questions: Do people really use it (I mean people who have any ...
34
votes
4answers
53k 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 ...
34
votes
4answers
5k views

Should I \mathrm the d in my integrals?

When writing an integral, it seems like something should be done to separate the "d", as in \int f(x) dx, so as not to confuse it with a variable. I've seen it left as-is, bolded, and straightened. ...
33
votes
1answer
25k views

How to add extra spaces between rows in tabular environment?

I couldn't find any option that lets me expand the vertical space between rows in tabular environment. For example, \begin{tabular}{c c} $f^{(n)}(x)$ & $f^{(n)}(0)$ \\ ...
32
votes
6answers
1k views

How to typeset the house of an algebraic number?

I would like to reproduce the following text but I couldn't find the house symbol neither through Detexify nor by looking through the Comprehensive LaTeX Symbol List. I also tried combining ...
32
votes
4answers
1k views

Is it ever bad to use \left and \right? [duplicate]

For mathematics, is it ever disadvantageous to use \left( and \right) in equations? I can't see any way that doing this would hinder the typesetting, so why isn't () just converted into \left( ...
32
votes
2answers
9k views

Separate long math text under sum symbol into different lines?

I have the following equation, where there is a lot of stuff under the sum symbol: \begin{equation} d(\vec{x},\vec{y})= \sum_{Z_{xy}\in\vec{Z}_{xy},\forall x\in\vec{x},\forall y\in\vec{y}} ...
32
votes
2answers
9k views

Can I get a \widebar without using the mathabx package?

One can use \bar to put a bar over a letter in math mode, but often the bar isn't wide enough. An alternative is \overline, but this isn't an accent, so it doesn't take into account the skew of the ...