# Writing Tips

## Usage of "Any" in Math

One must be careful when using the word “any” in mathematical writing because in certain contexts, “any” is ambiguous and can mean both “every” and “at least one”. Consider the following question:

Does $x^2 = 0$ hold for

any$x \geq 0$?

There are two correct answers:

- We can rewrite the question as, “does there exist
*at least one*$x \geq 0$ such $x^2 = 0$?” The answer is “yes” because $x = 0$ satisfies $x^2 = 0$. - Alternatively, we can rewrite the question as, “does
*every*$x \geq 0$ satisfy $x^2 = 0$?” The answer is “no.” If $x = 1$, then $1^2 \neq 0$.

Thus, do not use “any” when what you mean is “all.” Use “for all” or “for each” instead.

## The Best Notation is No Notation

As P.R. Halmos wrote, “the best notation is no notation.” If you can avoid introducing a new symbol, then the text is often more clear and the reader has one less thing to remember. A rule of thumb is to never use a letter only once. Consider the following definition:

A function $f$ is called a

homeomorphismif it is continuous and has a continuous inverse.

The symbol $f$ serves no purpose since it is not used elsewhere in the definition. Thus, it can be omitted.

*Reference: P.R. Halmos in "How to Write Mathematics", section 15, p. 40. Nicholas J. Higham in "Handbook of Writing for the Mathematical Sciences", p. 28.*

## Make Your Document Color Accessible

When creating documents, make sure that graphs and uses of color are legible when viewed without color. Roughly 1 in 20 people are color-blind. And, regardless of a person’s ability to see color, it’s common to print papers in black and white. If your paper requires color to be understood, then you will lose readers!

For slides, color can play a more important role. You should make presentations accessible to color-blind people, but complete color-blindness is very rare. Most color-blind people are either unable to distinguish between red and green or between blue and yellow, but otherwise distinguish between other colors. Thus, if you pick your colors carefully, they can be seen by almost everybody.

See also:

## Don't Use Reuse Mathematical Symbols for Different Meanings

One of the surest sources of confusion in mathematical writing is to use one expression to mean multiple things. Authors often make this mistake with functions. To illustrate, consider a function $f$ from $\mathbb{R}$ to $\mathbb{R}$. The expressions “$f$” and “$f(x)$” have different meanings. The statement “$f(x)$ is monotonically decreasing” is meaningless because “$f(x)$” is a constant real number. Instead, write “$f$ is monotonically decreasing” or “$x \mapsto f(x)$ is monotonically decreasing”. The latter form is useful if you want to talk about the composition of functions without introducing a new symbol: “$x \mapsto f(1 + x^3)$ is monotonically decreasing”.

### When is it OK to reuse a symbol?

A complete ban on reusing symbols in a mathematical text would cause you to quickly run out of symbols, especially in long texts. Similar to variables in a programming language, symbols have a particular scope.

The tightest scope is what I will call a *bound symbol*.
A bound symbol is defined and used only in a single expression.
The symbol $x$ is a bound variable in the following expressions: “$\forall x\ P(x)$”, “$\exists x\ P(x)$”, and “$x \mapsto f(x)$.”
It is OK to immediately use the same bound symbol in multiple expressions, such as, “Consider the functions $x \mapsto f(x)$ and $x \mapsto g(x)$.”
To aid the reader, however, each time a bound symbol is reused in a section of text, it should have the same type of meaning.

Symbols introduced in a proof should be restricted to that proof (many readers skip proofs on their first read of a text), so we can treat a proof as a symbol scope. If we introduce “$\varepsilon > 0$ and $\delta = 2\varepsilon$” in the proof of Theorem 1, then it is OK to define “$\delta \in (0, 1)$ and $\varepsilon = \sqrt{\delta}$” in the proof of Theorem 2.

Symbols introduced in definitions and theorems are not scoped in the same way.

## Don't Start a Sentence With a Mathematical Expression

Don’t start a sentence with a mathematical expression (numerals, variables, or equations). Instead, start every sentence with a word. Consider, for example, that you have a set $A$. It’s confusing to say: “$A$ is …” because the symbol “$A$” looks like the word “A”. Similar confusion can ensue if a sentence ends with a mathematical expression and the next starts with one. For example, “The value of $X$ is $2$. $5$, $6$ and $7$ are numbers.” It looks, at first blush, that $X = 2.5$. When a clause ends with a mathematical expression followed by a comma, avoid placing another mathematical expression immediately after the comma.

There are several ways to avoid starting with a mathematical expression.

- Say the type of the object before the symbol: “The set $A$ is…,” “The expression $\sigma(2 + x)$ represents…”, “The inequality $a^2 \leq b^2$ holds for…”.
- Say the name of the object or short description: “The empty set $\emptyset$ is…”, “The union $A \cup B$…”.
- Reorder the sentence.

*Reference: P.R. Halmos in "How to Write Mathematics", section 16, p. 44.*

## Correctly Format Text in Equations

When writing a mathematical equation that contains a word or other string of characters that is a unified block, place those characters inside a `\text{...}`

macro.

To understand why this is important, suppose you have defined \(a,\) \(n,\) and \(t\) as real numbers.
What does the expression \(tan(a)\) mean? Anybody experienced with trigonometry, would read this as the tangent of \(a,\) but because juxtaposition indicates multiplication, the expression is ambiguous—it could also be read as \(t\) times \(a\) times \(n\) times \(a.\)
To avoid this ambiguity, write \(\tan(a)\) (`$\tan(a)$`

or `$\operatorname{tan}(a)$`

).

The particular way that you format a string depends on the context.

`\operatorname{}`

to define functions like $\sin$ and $\cos$ that consist of several characters. Based on the context,`\operatorname{}`

inserts the proper spacing before the text.`\text{}`

to insert plain text that matches the formatting of the surrounding text environment, such as`\text{if } ...`

`\text{otherwise} ...`

in a`cases`

environment.`\textup{}`

to insert upright text. Useful for equations that appear in italicized environments, like theorems.`\texttt{}`

to format programming variables and other code-like text.`\textsc{}`

to format text using “small caps”.

If the string of characters appears repeatedly, define a macro to make it easier to typeset.

*Reference: Nicholas J. Higham in "Handbook of Writing for the Mathematical Sciences", p. 32.*

## Initial Value Notation

When writing the initial value of a dynamic system, the initial value should be typeset using a subscript zero (“`0`

”) not the letter oh (“`O`

”) or (“`o`

”).
To illustrate, the initial value of a state \(x(t)\) should be written as \(x_0\) (“`x_0`

”) not as \(x_O\) (“`x_O`

”) or \(x_o\) (“`x_o`

”).

## Dashes for Parenthetical Statements

When emphasizing a parenthetical statement, an m-dash should be used. In LaTeX, an m-dash is typeset using three hyphens: `---`

. There should not be spaces around the m-dash.

Incorrect: `This is a sentence --- but I stop to make a parenthetical statement.`

\(\text{This is a sentence — but I stop to make a parenthetical statement.}\)

Correct: `This is a sentence---but I stop to make a parenthetical statement.`

\(\text{This is a sentence—but I stop to make a parenthetical statement.}\)

Be careful when writing an m-dash at the end of a line of LaTeX code because LaTeX will inject a space at each line break. You can suppress the added space by ending the line with “`%`

” immediately after “`---`

”:

```
% Incorrect
This is a sentence---
but I stop to make a parenthetical statement.
% Correct
This is a sentence---%
but I stop to make a parenthetical statement.
```

## Presenting a Sequence of Manipulations to an Expression

When presenting a series of operations performed on an expression, it can be clearer to state the step-by-step recipe of how to perform the manipulations, than to show only the results of each step. The clearest, of course, would be to provide a step-by-step guide that shows the result from each step. Unfortunately, space constraints often prohibit such spacious exposition.

Suppose we want to solve \((a + x)/2 = 3\) for \(x.\) In the following table, the left shows a purely symbolic approach, which leaves the reader to fill in the gaps. The right column describes what is required but does not show the result of every step.

Symbolic Manipulation | Description |
---|---|

$$\begin{aligned} &\frac{a + x}{2} = 3 \\ &a + x = 6 \\ &x = 6 - a \end{aligned}$$ | Multiply both sides by \(2,\) and subtract \(a\) from both sides. The result is \(x = 6 - a.\) |

*Reference: P.R. Halmos in "How to Write Mathematics", section 15, p. 42-43.*

## "Minimize" vs. "Min" in Optimization Problems

When writing an optimization problem, write “minimize” and “subject to” instead of “min” and “such that” or “s.t.”.

Correct | Incorrect |
---|---|

\[\begin{aligned} \operatorname{minimize} \quad & f(x) \\ \operatorname{subject to} \quad & Ax = b, \end{aligned} \] | \[ \begin{aligned} \operatorname{min} \quad & f(x) \\ \operatorname{s.t.} \quad& Ax = b. \end{aligned} \] |

The problem with writing “$\operatorname{min} f(x)$” instead of “$\operatorname{minimize} f(x)$” is that the expression “$\operatorname{min} f(x)$” represents the minimal *value* of $f$ whereas “$\operatorname{minimize} f(x)$” is a statement of the *goal* of the optimization problem.

We use the following code when writing optimization problems.
In the preamble, we define `\minimize`

, `\maximize`

, and `\subjecto`

macros, as follows:

```
% Usage: \minimize{\x \in \reals}
\newcommand*{\minimize}[1]{\operatorname*{minimize}_{#1}\quad}
% Usage: \maximize{\x \in \reals}
\newcommand*{\maximize}[1]{\operatorname*{maximize}_{#1}\quad}
\newcommand{\subjectto}{\textup{subject to}\quad}
```

The starred version of the `\operatorname`

macro causes subscripts to be placed below the text in display equations.

In the document body, we write an optimization problem as

```
\begin{align*}
\minimize{x \in \reals^n} & f(x) \\
\subjectto & Ax \leq 0 \\
& Bx = 0.
\end{align*}
```

If space is a concern, you may abbreviate “subject to” as “subj. to” (`\textup{subj.\ to}`

).

*Reference: Professor Stephen P. Boyd, at Stanford, in Lecture 5 of his Convex Optimization course, around the 13-minute mark.*

## Use Nonbreaking Spaces

In LaTeX, the character `~`

inserts a non-breaking space.
As a rule of thumb, use `~`

in the following situations:

- between a number and its unit of measure:
`1000~miles`

,`183~billion`

- before each citation (e.g.,
`...as was shown by Smith~\cite{smith_2020}`

) - before the last word of a paragraph to prevent it from being placed on a line by itself, especially if the word is short.

To prevent line breaks in the middle of an equation, place curly brackets “`{...}`

” around the equation. For example `${a \in A}$`

will always be displayed on one line, whereas `${a^2 + b^2} = {c^2 + d^2}$`

may have a line break at the equal sign but nowhere else.

## "So That" vs. "Such That"

Despite sounding similar, the phrases “so that” and “such that” have different meanings.
Using the wrong phrase can cause mathematical statements to be incorrect.
The phrase “so that” indicates *motivation* whereas “such that” imposes a *constraint*.

We may, for example, say, “Pick \(x \in (-5, 5)\) *so that* \(x^2 < 25\).”
In this case, we are alerting the reader to the fact that it is important that \(x^2 < 25\) but not adding any new information.
In other words, replacing the sentence with “Pick \(x < 5\)” does not change the meaning.
If, instead, we wrote, “Pick \(x \in (-5, 5)\) *such that* \(x^2 < 25\)”, the mathematical meaning changes to “Pick \(x\) such that \(x \in (-5, 5)\) *and* \(x^2 < 25\).”
This, of course, is equivalent, but may confuse readers.

The consequence of using “such that” when we mean “so that” is—at worst—moderate confusion, but the result of using “so that” instead of “such that” is logically incorrect statements.
For example, suppose we write, “Pick \(x, y \in \mathbb{R}\) *such that* \(x + y > 0\).”
This imposes a constraint on \(x\) and \(y\); namely, their sum must be positive.
The sentence “Pick \(x, y \in \mathbb{R}\) *so that* \(x + y > 0\)” is mathematically incorrect because picking \(x, y \in \mathbb{R}\) does not always result in a positive sum.

Often, readers can figure out your intended meaning if you mix up the two phrases, but doing so forces them to do extra work to infer what you, as the author, should have made explicit.

## Size of Spaces of a Period

When LaTeX sees a period followed by a space, “. “, it assumes that the period is the end of a sentence, so it makes the space wider. When using a period that is not at the end of a sentence, the following space should be typeset using “\ “ instead of a normal space “ “. This ensures size of the space after the dot is correct.

Correct | Incorrect |
---|---|

$$\text{My name is P.}\ \text{Wintz}$$ | $$\text{My name is P. Wintz}$$ |

The difference is subtle and the actual spacing will depend on the settings for a particular document, but the difference helps readers discern whether a period ends a sentence.

*Reference: TeX StackExchange*

## Best Practices for Formatting Tables

- Eliminate unnecessary rules (lines) between columns and rows.
- Don’t repeat information. If some expression (such as units) occurs in every cell in a column or row, move it to the header.
- Don’t use a table if a plot would be better. If you have a large amount of information and readers are not interested in exact values, it is often better to display it graphically.
- Round aggressively. Readers rarely need more than one decimal point.
- Consider rearranging or transposing the table. If readers are likely to compare two quantities, place them in adjacent columns (it is slightly easier to compare elements between columns than between rows).
- Include a reference to the table in the text of the document and highlight important features.

*Reference: N. J. Higham, "Handbook of Writing for the Mathematical Sciences", Section 6.10*

## Use Precise References to Locations in Documents

LaTeX is a powerful tool for cross-referencing.

Use it.

Instead of saying, “In a later section…”, “In the next section…”, or “Below…”, say, “In Section 4…”.
This allows readers to quickly pinpoint the thing you are referencing.
If you have TeX configured correctly (using `hyperref`

), then references will automatically include a internal link to the given place in the document, allowing readers to immediately jump there.

This advice also applies when citing other works.
If a citation is, say, an entire book, then the reader must spend time searching through it to find what you were talking about.
When citing in TeX, the `\cite`

macro has an optional argument for giving a locator.
For example, to cite Theorem 3.4 in `khalil_nonlinear_2014`

, use `\cite[Theorem 3.4]{khalil_nonlinear_2014}`

.

## Some examples

- “Results presented in the next section…” \(\implies\) “Lemma 3 in Section 4…”
- “In the above inequality…” \(\implies\) “In inequality (4)…”
- “This theorem is given by Kahlil in [4]” \(\implies\) “This theorem is given by Kahlil in [Theorem 3.4, 4]”.

## Including Links

% Add support for mixing colors, such as "black!30!blue" \usepackage{xcolor} % Enable hyperlinks \usepackage[]{hyperref} \hypersetup{ final, % Include links even if document is in 'draft' mode. hidelinks, % Prevent boxes from being drawn around links in some editors. colorlinks=true, linkcolor=black, % TOC, links to labeled equations and environments urlcolor=black!30!blue, % URLS including links in references citecolor=black!30!blue, % In-line citations }