# Cookbook and Sandbox for mathjax

I can never remember how to format units in math formatting, and people show different ways to do it anyway! So I thought it would be a good idea to have a permanent note listing things to do and not-do with peer-approved examples to copy from.

# Units

Scientific notation with units on the end: $2.5*10^8 m/s$ is not right but commonly seen posted (a fresh example).

…someone?… what’s the best practice for typesetting this easily and correctly?

• FYI. There are two contributed extension for MathJax that implement units by mimicking well known LaTeX packages (physics and siunits). The admins are often open to community requests for adding such packages to the MathJax configuration. See github.com/mathjax/MathJax-third-party-extensions – Peter Krautzberger Sep 10 '16 at 10:52

# sandbox

Other answers are for sandbox experimentation and discussion. The only way to see what we’re doing is in a post. It doesn’t look the same in comments or a chat room.

# vector with subscript name

What’s the right way to indicate a vector quantity with subscriped name, like p_in for momentum?

HDE 226868 suggests

Would something like $\vec{p_{\text{in}}}$ work?
You could also just use $\vec{p}_{\text{in}}$.


which formats as

Would something like $\vec{p_{\text{in}}}$ work? You could also just use $\vec{p}_{\text{in}}$.

I am not sure what you mean really. If you're asking how to represent units (m, s, etc.) in math/physics/... results in general, you should know that there's a norm. International System of Unit (called SI from French).

From the wikipedia page and this nice checklist, we can see a set of rules:

1. A value is written with a number, a space and a unit. No end of line can occur between the number and the unit. Exceptions are %, °, ", ' which are written without spaces.
2. A unit is mathematical symbol not an abbreviation. So m for metres and not m..
3. A prefix (m for mili, k for kilo, M for mega, etc.) is part of the unit, so no space.
4. Different units are combined with a dot (should be centred, as it indicates a multiplication, not decimals) or a space. $\text{N}\ \text{m}$ ($\text{N}\ \text{m}$) or $\text{N}\cdot\text{m}$ ($\text{N}\cdot\text{m}$). In practice, prefer the dots. Normal dots are often easily understood as well.
5. Division are given with a single slash, or a negative exponent. $\text{m}/\text{s}$ ($\text{m}/\text{s}$) or $\text{m}\cdot\text{s}^{-1}$ ($\text{m}\cdot\text{s}^{-1}$). No m/s/g: that's two slashes.
6. Units named from person should have a capital letter (Pa, Hz, T, K) others shouldn't (m, s, mol, parsec). Exception is litre which can use both.
7. No plural form! (no kgs).
8. Prefixes case is fixed. M means $10^6$ and m means $10^{-3}$. Also no Kg.
9. Units are written in Roman lettres ($\text{m}$ indicates metre, while $m$ is usually a mass).

Some conventions might add a few more details.

1. Variables should be in italic.
2. I can't write it better than

Superscripts and subscripts are in italic type if they represent variables, quantities, or running numbers. They are in roman type if they are descriptive.

Like $m_\text{p}$ is the mass of a proton (descriptive).

3. log, cos, etc. should be written in Roman lettres: $\cos x$ ($\cos x$).

A list of standard units and typical symbols for their variables can be found here.

Of course all this is valid for SI units (not imperial ones). So if you're more familiar with pounds, yards, cups, etc. You might consider using those instead. You just have to make sure that you are explicit and clear. And still many of the rules above can apply to it.

Hope I answered your question. In any case, I figure it would be something worth having around.

• No, I don’t mean “what are the SI units”. I mean how to format them in the correct font. You note “in roman” but what is the sequence in Mathjax to do that? Your inline examples use text, but I've seen several other words used for the purpose…is one of them specific for units or better than the others? – JDługosz Sep 9 '16 at 14:18