# How do I make square brackets in a chemical formula?

I want to write the concentration of chlorine ions inside a cell as [Cl-]i, with the - superscripted and the i subscripted. I can't figure out how to do this.

• welcome to tex.sx. while i'm not a chemist, i believe that the mhchem package can help you. – barbara beeton Dec 21 '17 at 19:28
• The utf8 in inputenc package is for special characters and accents, it is not necessary for superscript format. – Cragfelt Dec 21 '17 at 19:31
• Try [Cl\textsuperscript{-}]\textsubscript{i} – Skillmon Dec 21 '17 at 19:43
• Or $[\mathrm{Cl}^-]_i$ – Sandy G Dec 21 '17 at 20:49

As already pointed out by barbara beeton in the comments, this can easily be done using the mhchem package as shown in the following example:

\documentclass{article}
\usepackage[version=4]{mhchem}

\begin{document}
\ce{[Cl^-]_i}
\end{document}


Alternatively, you can also use the chemformula package as shown in the following MWE:

\documentclass{article}
\usepackage{chemformula}

\begin{document}
\ch{[Cl^-]_i}
\end{document}


As pointed out in the comments by thymaro, mhchem yields an italic i while chemformula yields an upright i.

To quote from the mhchem manual:

Typographical conventions say that variables are typeset in italic font, while other entities (like chemical elements) are typeset in an upright font. mhchem tries to recognize common patterns and use the correct (italic) font [...]

To quote from the IUPAC 'Use of Italic and Roman Fonts for Symbols in Scientific Text':

The chemical potential of argon might be denoted m_Ar or m_(Ar), but the chemical potential of the ith component in a mixture would be denoted m_i , where the i is italic because it is a variable index.

To achieve an italic index i using the chemformula package, one can use something like this: \ch{[Cl^-]_{$i$}}

• Is there a difference between the upright i and the itshape i in chemical notation? If so, it should be pointed out. Not a chemist here, just noticing different output by the two packages. – thymaro Dec 21 '17 at 20:59
• @thymaro - I believe the "i" will generally be a digit, i.e., 1, 2, etc. Unless the text and math fonts are wildly different, nobody will notice the difference between, say, a text-mode "2" and a math-mode "2". – Mico Dec 21 '17 at 21:15