{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)

193
votes
8answers
12k 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 ...
141
votes
8answers
6k 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 $ ... $?
35
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: ...
59
votes
4answers
3k 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 ...
48
votes
4answers
10k 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 ...
26
votes
5answers
6k views

Define additional math operators to be typeset in roman

Mathematical operators, such as function names, should be set in roman type, not italics. Latex already has commands for some operators, including \max, \min, and \log. How can I define additional ...
31
votes
4answers
22k 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)$ ...
21
votes
4answers
8k views

How to make \left, \right pairs of delimiter work over multiple lines?

I have a very long equation that must be separated into two lines, and it has several pairs of nesting \left \right delimiters. Unfortunately, it seems that they need to be on the same line in order ...
77
votes
6answers
88k 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 ...
31
votes
2answers
7k 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}} ...
56
votes
4answers
78k 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)} ...
23
votes
4answers
4k views

How to draw arrows between parts of an equation to show the Math Distributive Property (Multiplication)?

there is a part of my paper where I use the distributive property and it's not that clear for the reader to see (I'm using in proposional logic for a proof). The logic equation (part of) is: (l_{1}) ...
38
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 ...
26
votes
2answers
8k 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 ...
17
votes
3answers
2k views

Vertically asymmetric size variation for parentheses

One of the difficulties I have with writing formulas in LaTeX is that the standard sizing tools for the variable-size operators (parentheses, etc.) do not account for "high" symbols and "low" symbols ...
29
votes
2answers
6k 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 ...
21
votes
3answers
5k views

Overlay symbol with another

Is it possible to overlay a symbol with another? I want to write an equal sign with a question mark overlayed (or the other way around). Note I don't want \stackrel{?}{=} I want the question ...
47
votes
3answers
21k 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 ...
8
votes
1answer
142 views

Measuring align

From what I read it seems that align environments are processed twice: the first time for measuring, the second time for actual typesetting. My question is whether one can get access to these ...
62
votes
3answers
80k 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...
28
votes
1answer
1k views

xelatex problem: Missing chars in TeXLive 2013 / \textfont XXX is undefined errors in miktex

I'm trying to track down the source of a problem with the new xetex binary in miktex. I think it is related to the following problem in TeXLive 2013: \documentclass{article} \usepackage{unicode-math} ...
16
votes
4answers
1k views

Is there a test for the different styles inside maths mode?

Is there a test for the different styles within maths mode? What I really want is to be able to save the current style to reinvoke it later on, but a \if along the lines of \ifmmode would work just ...
8
votes
3answers
1k views

use of tikzpicture matrix in align or gather environment

So far I have found using the matrix command in the TikZ package is the only way of drawing a T-shape around the bottom row and middle column of entries in a matrix. I now need to use this matrix in ...
33
votes
3answers
5k 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 ...
29
votes
2answers
10k 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
6answers
9k 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 ...
13
votes
2answers
2k views

How do I lower the \widetilde accent, i.e., move it closer to the variable?

I sometimes find that the \widetilde accents sits too high above the math letter it is applied to. An example: To me it looks as if the first tilde is sitting just in between the two lines; it is ...
6
votes
4answers
878 views

How can I define a math operator behaving like \lim or \sum with limits?

I want to define \ext to behave exactly like \lim. I tried \newcommand{\ext}{{\mathrm{ext}}\,} but that doesn't behave exactly like \lim.
61
votes
8answers
12k 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 ...
42
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 ...
37
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 ...
50
votes
4answers
44k 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] ...
22
votes
5answers
18k views

Lowercase \mathcal

The standard font used for \mathcal does not include any lowercase characters. The Comprehensive LaTeX Symbols List suggests redefining \mathcal to use Zapf Chancery. However I do not particularly ...
17
votes
2answers
1k views

Make mathfont respect the surrounding family

How can one make the math mode change its font according to the surrounding text? I have to use (pdf)latex. xelatex, luatex etc. are not possible alternatives in this case. \documentclass{scrartcl} ...
17
votes
4answers
2k views

Subscripts for primed variables

When I add a subscript to a primed variable, the subscript is rendered lower than when it is a subscript to an unprimed variable. For example, when I compile $l_x l'_x l_x l'_x l_x l'_x$ I get ...
5
votes
2answers
117 views

Can I tab inside of align environment?

I currently have this ugly equation: The green alignment is just like I want it. The Red one is what I would like to get, but I don't know how. Here is my MWE: \documentclass[a4paper]{scrartcl} ...
19
votes
2answers
1k views

The mysteries of \mathpalette

I would like to make a macro, \vfrac, which output would look like: $$\displaylines{ \displaystyle\raise.25ex\hbox{$\displaystyle1$}\!/\!\lower.5ex\hbox{$\displaystyle2$} \cr ...
53
votes
4answers
40k 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 ...
58
votes
4answers
27k 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 ...
23
votes
4answers
2k views

Can I have a flexible partial derivative macro?

I was thinking about writing a partial derivative macro that has a similar syntax to the Mathematica D function. (example) The syntax could be like this: \D{f}{x} expands to \frac{\partial ...
18
votes
2answers
2k views

How to change default for spacing around binary relations?

In TeX and LaTeX, the math binary relations (like =, \parallel, <, \le ...) have a default (rubber-length) spacing to either side, which is too large for my liking. How can reduce it?
16
votes
2answers
743 views

Difference of the \dots*

I came to wonder, what is the difference between the following? \dotsc \dotso As well as between: \dotsb \dotsi \dotsm
16
votes
3answers
2k views

Nice-looking p-th roots

When I take the pth root, the bottom of the p comes very close to the \sqrt symbol. In the New Century Schoolbook font (which I am using), the p actually intersects the \sqrt symbol, which looks even ...
48
votes
3answers
34k 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 ...
35
votes
4answers
15k 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 ...
45
votes
3answers
12k 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 ...
21
votes
5answers
2k views

Macro for \left( and \right)

I know there has been discussion about this topic, but I haven't seen a working solution. Is it possible to define a macro within LaTeX, such that inside math mode, ( would produce \left( and ) would ...
35
votes
6answers
11k 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 ...
24
votes
4answers
3k views

Using display style fraction in a matrix environment

I'd like use the \dfrac command in a bmatrix environment as follows: \documentclass{article} \usepackage{amsmath} \begin{document} \[ \begin{bmatrix} \dfrac{\partial f}{\partial x} \\ ...
28
votes
5answers
4k views

How to present a vertical multiplication/addition

How do I present vertical (columnar) multiplication and addition in LaTeX. Like this: http://mathworld.wolfram.com/LongMultiplication.html 3 8 4 x 5 6 --------- 2 3 0 4 1 9 2 0 --------- 2 ...