(click anywhere to close)

[LaTeX] Math Spacing & Special Text

category: Writing | course: LaTeX Math | difficulty:

Before I start throwing all existing symbols at you, there are some slight details to be discussed. Within math environments, you can use the same spacing commands as anywhere else in LaTeX, but those are often too rough – within formulas, it’s about millimetres of added or removed space. That’s why there are some special spacing commands for mathematics.

General Spacing

These commands can be placed anywhere to add (or remove) spacing.

 Command Description \, Thin space \: Medium space \; Thick space \! Negative thin space. The only command that removes white space, to bring things closer together.

Operator & Symbol Spacing

When it comes to mathematical operators, relations and symbols, LaTeX follows a complex set of rules to determine how much spacing is around everything. For example, a minus symbol is always pushed against the symbol it belongs to, while the equals sign has lots of space around it. Most of the times, this works fine and everything looks great, but you can define your own way of spacing if you want with these commands:

 Command Description \mathrel{…} Spacing as with binary relations (such as equals, or greater than) \mathbin{…} Spacing as with binary operations (such as plus, or minus) \mathop{…} Less spacing on the right than on the left. Asymmetric, unlike the other two commands.
$x \mathop{=} y$\\
$x \mathbin{=} y$\\
$x \mathrel{=} y$


Special Text Styles

It won’t happen too often, but sometimes you need to emphasize or format text in between a bunch of math. For this, the same commands as with regular text are available, but with math instead of text.

 Command Description \mathrm{…} Roman font (default) \mathit{…} Italic \mathbf{…} Bold \mathsf{…} Sans-serif \mathtt{…} Teletype
$x = x \; \mathbf{Wowza}, that \; was \; \mathrm{so \ unexpected!}$

CONTINUE WITH THIS COURSE
Do you like my tutorials?
To keep this site running, donate some motivational food!
Crisps
(€2.00)
Chocolate Milk
(€3.50)
Pizza
(€5.00)