Equation etiquette

Mathematics can be beautiful. Equations are an important component of technical writing, but getting their presentation correct can be tricky. There are many rules about their formatting, and these can seem somewhat arbitrary. Just like starting with the outermost knife and fork at a fancy dinner, or passing the port to the left, these can seem rather ridiculous when you first learn them, but there is some logic to them. Here, I give a short guide to the proper etiquette of including equations in your writing.

0 Make introductions

The simplest rule: explain what your symbols mean. The dinner-party equivalent would be to introduce your guests, so that everyone knows whom they have to attempt conversation with. For an equation to be of any use, people need to know what it means. This can be especially important as some symbols are commonly used for different quantities. Introduce your readers to your symbols promptly, so that the equation makes sense. For example,

“Ohm’s law says that the voltage across a resistor is

V = IR,

where I is the current flowing through the resistor and R is the resistance of the resistor.”

Here, I left the definition of V implicit, but hopefully everyone’s now acquainted, so we can chat (probably about electronics) until the soup is ready.

Depending on your audience, there are some things you can get away without introducing. The mathematical constant \pi is always referred to as pi, so you can usually skip the definition of it being the ratio of a circle’s circumference to its diameter. \pi is the superstar guest that needs no introduction. If you are using the symbol for something else, make sure to make that clear!

Pi pie!

Pi pie! Perfect for any mathematical dinner party. Technically, there’s 2\pi of pie here. Credit: Tasty Retreat

While not as famous as \pi, the mathematical constants e, the base of the natural logarithm, and i = \sqrt{-1}, the imaginary unit, can sometimes be left undefined. They are dinner-party regulars, so as long as your guests have been invited along a few times before, they should have met. Unlike \pi, e and i are frequently used for other quantities, so if there’s chance of there being some confusion, play it safe and make the introduction (remember, no-one like having to ask the names of people that they’ve met before).

Finally, some of the fundamental physical constants like the speed of light c, the Newtonian constant G, Boltzmann’s constant k and the reduced Planck constant \hbar, can sometimes be left unintroduced if writing for professional physicists. They are guests that went to university together, so you can assume they know each other. If there is any chance of confusion though, make sure to introduce them. Try to never use a symbol for any of the constants that is not their usual one, that’s like giving a guest a new nickname for the purpose of the party. It will lead to all sorts of confusion, which might be amusing in a sit-com, but less so in scientific writing

Never use the same symbol for two different quantities. Just like having a seating plan with two identical names, this leads to confusion, arguments over who gets to sit next to the awesome physicist, and people being stabbed with forks. Using subscripts or superscripts, or a different font are common ways of avoiding a clash.

1 Punctuate properly

Equations should form a central component of your text. They are part of your sentences. Accordingly, they should be punctuated properly so that they make sense. This is like chewing with your mouth closed: no-one likes to see a mess.

It can be hard to put equations into words, to figure out where to put punctuation. However, they can usually be read as “left-hand side equals right-hand side”. Here, “equals” is a verb. Often an equation will need to be followed by comma, as above. Missing out punctuation is especially obvious when the equation comes at the end of a sentence and there’s no full stop.

Starting a sentence with an equation is a little weird, like serving the sweet before the soup, but I don’t think there’s anything to stop you. Consider the following examples.

“The most famous equation in physics is E = mc^2. This explains the equivalence of energy E and mass m, converting using the speed of light c.”

E =mc^2 is the most famous equation in physics. Here, E is the energy equivalent of mass m, and c is the speed of light in a vacuum.”

2 Fonts, roman, italic

Lend me you ears, I come with some of the finer details, like which fork to use. Variables are typeset in italics. This makes it easy to spot with letters are mathematical quantities and which are just plain text: a is a variable and a is just a short word.

Not everything that appears in an equation should be italicised. Numbers; operators like +, - and \times, and brackets (\ldots) are left as they are. These are always just themselves, so there’s no need to italicise, they are left roman (upright).

Function names, when more than one letter, are not italicised. For example \sin, \log or \min. This lets you know that these letters can’t be broken up, they come as a single unit. For example

\displaystyle \frac{sinx}{cosx} = \frac{in}{co},


\displaystyle \frac{\sin x}{\cos x} = \tan x.

Related to this, is the question of whether you should italicised the differential \mathrm{d}? I like to have it roman so it’s

\displaystyle \frac{\mathrm{d}x}{\mathrm{d}y} \quad and \quad \int f(x)\, \mathrm{d} x.

I think this makes it clear that the infinitesimal element \mathrm{d}x can’t be broken up (you can’t cancel \mathrm{d}). However, this is not universal, so I think this is much like whether you should prod or crush the peas onto your fork.

Subscripts and superscripts often lead to confusion. If they are part of a variable’s name, should they always be italicised? The answer is no: they should be treated as if they were in the main text. If I want to specify the area of a circle, it would be A_\mathrm{circle}, as circle is just a regular word. If I want to specify the coordinates of point \mathrm{P}, they are (x_\mathrm{P},\,y_\mathrm{P}), as \mathrm{P} is the name of the point, not a variable. If I wanted to talk about heat capacity, then the heat capacity at constant volume is C_V and the heat capacity at constant magnetic flux density is C_B because I’m using V and B to specify the volume and magnetic field respectively.

All this seems to make sense to me. It might seem strange that there’s a specific item of cutlery for each course, but it is easier to cut a steak with a steak knife than a butter knife, so there may be some logic to it. Similarly, the typesetting of maths does convey some meaning.

Sadly, there is a common exception to the rule, upper-case Greek letters are often not italicised, but are left upright, e.g. \Theta. (Lower-case Greek letters are italicised, as are our Latin upper-case letters). It could be that this gives a way of distinguishing between an upper-case beta \mathrm{B} and a capital B, chi \mathrm{X} and X, etc. However,  I think this is just because they look odd in some fonts. Italicising them wouldn’t be wrong. (Although, the summation symbol \sum and product symbol \prod are operators, and so should never be italicised).

3 Laying out units

Forgetting to include units is much like forgetting your trousers at a dinner party. It’s a definite faux pas, not to mention painful if you drop some of that hot soup. However, unlike the wearing of trousers, there is an international guideline on how to correctly use units. Units appear after a number separated by a small non-breaking space, e.g. x = 2.3~\mathrm{m}. The space needs to be non-breaking so that it’s never separated from the number, which would be painful.

Groundskeeper Willie

Trousers are not standardised, but units are! The Springfield Police are shocked when Willie forgets his. Credit: Fox

You may have noticed that units are not italicised. This makes them readily identifiable, and also avoids any confusion that a millimetre is the same as a square metre or that one hertz per henry could be z. Not italicising units means there’s a clear difference between T = 5~\mathrm{s} and T = 5s. The first indicates a time of five seconds, the second that T is five times s, whatever that might be. We can also write things like s = 5~\mathrm{s} without them being nonsense.

When making compound units, use negative powers rather than a slash so there are no ambiguities. It’s difficult to figure out \mathrm{m/s^2/kg^3}, but \mathrm{m~s^{-2}~kg^{-3}} is clear. You don’t want everyone pondering if you’ve accidentally put your trousers on back-to-front.

Finally, when plotting graphs, units should be included in the axis labels. I like to think of graphs just being of pure, dimensionless numbers, hence I need to divide out the units, e.g. T/~\mathrm{s} for time in seconds or C_V/(\mathrm{J~K^{-1}}) for heat capacity.

4 Use the right symbol for the job

Trying to eat your soup with your crab fork is not going to end well. You should always use the right tool for the job. When writing maths, this means using the correct symbol. The multiplication sign \times is not an x, and the minus sign - is not a hyphen.

5 Close your brackets

No parsing scripts should be harming in the reading of this

Pure evil. Credit: xkcd

To close, some tips on brackets. Brackets should always come in an (equally-size) pair. They should be large enough to enclose their contents. When eating, you should cut your food up into bite-size pieces, you can’t chop up equations in the same way, so instead you resize the brackets.

When nested brackets, use different types of brackets so it’s clear which term ends where. It’s usual to start with parentheses (\ldots), then use square brackets [\ldots], and then braces \{\ldots\}. Unlike with cutlery, you start inside and work your ways out. For example, making something up,

\displaystyle \exp\left\{-(1 + 2\xi)\left[(\xi - 1)^2 + \cos \left(\frac{\pi \xi}{2}\right)\right]^{-1/2}\right\}.

If you need more than three levels, you usually cycle round again.

There are a few cases where a particular type of bracket is used. Angle brackets \langle\ldots\rangle are often used for an average. Square brackets are often used to enclose the argument of a functional. Curly braces are often used for limits, \lim_{x\,\rightarrow\,0} \{\mathrm{sinc}\,x\} = 1, or Fourier transforms, \mathscr{F}_k\{f(x)\} = \tilde{f}(k). The important thing is to be clear, to make it easy for the reader to distinguish which brackets matches to which other.

That brings us to the end. We’ve closed all our brackets, and put our knife and fork together on our plate. Presenting equations clearly, like writing clearly, makes writing easy to understand. Paying attention to the details, making sure that you dot all your is and cross all your \hbars, creates a good impression, it shows you’re careful and that you care about your work. You may even get invited out to dinner again.