Tx · LaTeX & TikZ

How to Typeset Capital M for Molarity with siunitx

Published By the 9to5Science editorial team

At a glance

  1. 1. Declare the symbol

    Add a custom unit declaration for capital M in your document preamble.

  2. 2. Use it as a unit

    Pass the declared unit to siunitx after the numerical value.

  3. 3. Consider the alternative

    For an explicit concentration unit, typeset moles per litre instead.

To print molarity as a numerical value followed by a capital M with siunitx, declare M as a custom unit in the preamble. Then use that unit with \qty (siunitx version 3) or \unit.

\documentclass{article}
\usepackage{siunitx}

\DeclareSIUnit{\Molar}{M}

\begin{document}
A \qty{0.10}{\Molar} solution

The concentration is \unit{\Molar}.
\end{document}

The first output is a value followed by an upright M, with spacing handled by siunitx. The name \Molar is just the LaTeX command you chose; it is the declaration’s replacement text, M, that determines what prints.

Why declare the unit?

siunitx parses units rather than treating every unit argument as ordinary text. Declaring a symbol tells the package that M is a unit, so it can format and space it consistently with other units. In this notation, capital M conventionally means molar concentration: 1 M1\,\mathrm{M} represents one mole of solute per litre of solution.

M is a commonly used chemistry symbol, but it is not an SI unit symbol. If you prefer to show the underlying units explicitly, write moles per litre instead:

\qty{0.10}{\mole\per\litre}

This produces a concentration in mol/L (or mol/L with the package’s chosen unit formatting). \litre is the spelling provided by siunitx; the package also supports \liter as an alternative spelling.

A complete example with both forms

\documentclass{article}
\usepackage{siunitx}

\DeclareSIUnit{\Molar}{M}

\begin{document}
The solution has concentration \qty{0.10}{\Molar},
which can also be written as \qty{0.10}{\mole\per\litre}.
\end{document}

Use the first form when your audience expects the compact chemistry notation. Use the second when you want the units to be explicit or are following a style guide that avoids M.

Common mistakes

  • Putting M in the number argument: Write \qty{0.10}{\Molar}, not \qty{0.10 M}{}. The value and unit belong in separate arguments.
  • Using lowercase m: M is uppercase for molarity. Lowercase m is the SI prefix milli, so changing the case changes the meaning.
  • Confusing molarity with amount of substance: \mole alone is an amount unit; concentration requires an amount per volume, such as \mole\per\litre.
  • Skipping the declaration: A custom command such as \Molar must be defined with \DeclareSIUnit before it is used.

The examples use the version 3 interface, where \qty formats a value with a unit and \unit formats a unit alone. If you are maintaining an older document that uses \SI, follow the interface supported by the version of siunitx installed, but the custom-unit declaration is the key step.

References

  1. siunitx — A comprehensive (SI) units package, CTAN

Spotted an error? Send a correction. Read how we write and check articles in our editorial policy.