16
$\begingroup$

I usually pay a very high attention to the formatting of anything I write, especially to the mathematical notation, because in my opinion it is really important. Of course, the most important thing in formatting is its consistency, and while in principle everyone is free to follow his own personally developed guidelines, in practice personal formatting rules are usually inconsistent, since consistency requires a lot of effort, time and experience. Besides, personal formatting preferences are often different which complicates the exchange of knowledge.

Thus, it is much better to use some standard formatting rules established by some international organization responsible (among other things) for developing such standards. In the field of chemistry the most important formulary is the Quantities, Units and Symbols in Physical Chemistry, informally known as the IUPAC Green Book. The third edition of the book is freely available from the IUPAC site here (PDF, 1.47 MB), and I wish more and more of us will follow the guidelines.

In this thread I would like to discuss the formatting of one entity which appears at Chemistry.SE so often that I think it needs a particular attention. I'm talking about electron configurations. Let us take a look at IUPAC recommendations for writing them down. At the end of the day it all boils down to the following recommendation on p. 7 of the Green Book (emphasis mine):

The overall rule is that symbols representing physical quantities or variables are italic, but symbols representing units, mathematical constants, or labels, are roman.

And on p. 8 one can already find an example of how this rule applies to electron configurations (emphasis mine):

The ground and first excited electronic states of the $\ce{CH2}$ molecule are denoted $\mathrm{\dotsc (2a_1)^2 (1b_2)^2 (3a_1)^1 (1b_1)^1, \, \tilde{X} \; ^3 B_1}$ and $\mathrm{\dotsc (2a_1)^2 (1b_2)^2 (3a_1)^2, \, \tilde{a} \; ^1 A_1}$ respectively. The $\pi$-electron configuration and symmetry of the benzene molecule in its ground state are denoted: $\mathrm{\dotsc (a_{2u})^2 (e_{1g})^4, \, \tilde{X} \; ^1 A_{1g}}$. Note that all these symbols are labels and are roman.

Note here that $\pi$ in the text above is supposed to be also roman, but $\LaTeX$ for historical reasons typeset small greek letters in italics and \mathrm does not change them to upright form. If someone knows how can we achieve upright small greek letters here at Chemistry.SE, please, share you ideas.

At p. 32 there is another piece of relevant information which is, of course, also consistent with the general rule above (emphasis again mine):

The electronic states of atoms are labeled by the value of the quantum number $L$ for the state. The value of $L$ is indicated by an upright capital letter: $\mathrm{S}, \mathrm{P}, \mathrm{D}, \mathrm{F}, \mathrm{G}, \mathrm{H}, \mathrm{I}, \, \text{and} \, \mathrm{K}, \dotsc$, are used for $L = 0, 1, 2, 3, 4, 5, 6, \, \text{and} \, 7, \dotsc$, respectively. The corresponding lower case letters are used for the orbital angular momentum of a single electron. [...] Finally, the electron configuration of an atom is indicated by giving the occupation of each one-electron orbital as in the examples below.

Examples*

$\mathrm{B: (1s)^2 (2s)^2 (2p)^1, \; ^2 P^{\circ}_{1/2}}$

$\mathrm{C: (1s)^2 (2s)^2 (2p)^2, \; ^3 P_0}$

$\mathrm{N: (1s)^2 (2s)^2 (2p)^3, \; ^4 S^{\circ}}$

In my opinion we should follow this IUPAC suggested formatting, although I think the brackets can often be omitted as usual. Currently to get here at Chemitry.SE the requred output the easiest way is to use \mathrm environment as follows. For example, to get $$\mathrm{(1s)^2 (2s)^2 (2p)^2}$$ simply write

$$\mathrm{(1s)^2 (2s)^2 (2p)^2}$$

* The right superscript $\circ$ on the term symbol is used to indicate odd parity.

$\endgroup$
1
  • 1
    $\begingroup$ Thanks for writing all of this out. We can work to clean these up over time, but there is no rush, as they are currently readable as most people have already formatted them. $\endgroup$
    – jonsca
    Commented May 18, 2015 at 22:48

1 Answer 1

10
$\begingroup$

Quoting liberally from Poll: mhchem syntax for electron configuration answer and comments:

In order to get $\mathrm{[Kr]\mskip2mu4d^{10}\mskip2mu5s^1\mskip2mu5p^3\mskip2mu5d^4}$, I'd prefer to input $\ce{[Kr] 4d^10 5s^1 5p^3 5d^4}$.


Seen in the wild (because you get acceptable results, that way). [Source code of revision.]
Already used a few dozen times here at SE (when including 4d^{10}).

I personally have adopted this style, too, basically because it gives quite neat results already, and is very easy to type.


Disclaimer: Some of the examples won't render the same as of the time of writing. Some of this has become somewhat obsolete (given the compromise that you cannot achieve 100% correct typesetting with MathJax anyway). Original answer circa 05/2015:

I appreciate the awareness of good typesetting, even when it is some kind of hard to follow with MathJax tools alone. This is very much the same discussion with a different focus, as we had a couple of months ago: Should we correct math formatting?

I asked Manish in chat what would be necessary to turn it into a faq, but got no reply so far. I still think we could profit from this kind of style guide.

However, I have some issues/ comments with what you are suggesting:

  1. The use of \ce{...} as a workaround is wrong. In this case you are using a command, that is not designed for this usage. It is part of the mhchem package, which is still actively developed for LaTeX, and some changes might be transferred to MathJax as well. At this point I would like to again point out, that MathJax is not LaTeX. It uses its syntax, but nothing more. It is important to realise, that it renders on the fly on your machine and what you see, might not be the same what I see.
    I would recommend switching to a more robust command, as it is a low-level command, that likely will not change its behaviour: \mathrm{...}. You have to admit, typing four more letters is not worth the hassle.
  2. I don't like the use of negative spaces (They should be used to form ligatures). And you only have to introduce them because you use the \ce{...} environment, which interprets numbers and letters differently, see the examples below. On my screens (I tested it on windows, linux, android with chrome each and in the app) the numbers and letters (almost) fuse.

    • \mathrm{(1s)^2(2s)^2(2p)^3} renders as $\mathrm{(1s)^2(2s)^2(2p)^3}$ and is absolutely fine, and should be preferred
    • \mathrm{(1\!s)^2(2\!s)^2(2\!p)^3} renders as $\mathrm{(1\!s)^2(2\!s)^2(2\!p)^3}$ and is not really fine
    • \ce{(1\!s)^2(2\!s)^2(2\!p)^3} renders as $\ce{(1\!s)^2(2\!s)^2(2\!p)^3}$ and is incorrect usage, as it adjusts the spacing for settings like $\ce{2H2O}$. Admittedly this does not look as wrong as the next entry.
    • \ce{(1s)^2(2s)^2(2p)^3} renders as $\ce{(1s)^2(2s)^2(2p)^3}$ and is wrong on many levels.
    • For me $\ce{B: (1\!s)^2 (2\!s)^2 (2\!p)^1, \; ^2\!P^{\circ}_{1/2}}$ does especially look odd, the 2 is fused with the P and almost can't make it out. When switching only to roman fonts, it does not fuse, i.e. \mathrm{B: (1s)^2 (2s)^2 (2p)^1, \; {}^{2}P^{\circ}_{1/2}} renders as $\mathrm{B: (1s)^2 (2s)^2 (2p)^1, \; {}^{2}P^{\circ}_{1/2}}$. Please note, that \ce{...} automatically renders 1/2 as \frac{1}{2} which might not be the best option in inline math. Also note, that I have set the 2 to and empty placement, to ensure that it is not set to anything before (in order to avoid odd spacing).
  3. Upright greek characters are not (yet ?) implemented in MathJax. Also see here, and here (official). In real LaTeX you could use \uppi from the upgreek package or any other solutions mentioned here. However, MathJaX is not LaTeX, so none of them work for us. Maybe you want to make a feature request to the MathJaX developers for this. A related post is available here.

There is quite a good reference about which commands are actually available. Not a lot, but at least something.

$\endgroup$
10
  • 1
    $\begingroup$ \mathrm is indeed a better solution than \ce. $\endgroup$
    – Wildcat
    Commented May 20, 2015 at 14:55
  • $\begingroup$ I think you yourself advocated to me using \ce for electronic configurations a few weeks back. Here in this post you are arguing for \mathrm instead. Have you change your stance on this since then? (note the formatting wiki advocates \mathrm) $\endgroup$ Commented Feb 27, 2018 at 5:01
  • $\begingroup$ @Gaurang I did, I guess I thought the change has already been implemented $\endgroup$ Commented Feb 27, 2018 at 5:06
  • $\begingroup$ @Martin-マーチン Has it been implemented or not yet? Typing $\ce{4d10}$ gives me 10 in subscript (not superscript as the highest voted answer), so I guess not yet. $\endgroup$ Commented Feb 27, 2018 at 5:11
  • $\begingroup$ @Gaurang Nah... I'd would have found an announcement. Anyway, also I'd need a time machine to fly back and take a screenshot of the answer with the old MathJax version... some things changed, and \ce{2s^2 2p^3} does not look odd to me anymore: $\ce{2s^2 2p^3}$ ... $\endgroup$ Commented Feb 27, 2018 at 5:12
  • $\begingroup$ @Gaurang There was something... not quite as wrong as I thought I was... chemistry.meta.stackexchange.com/questions/3576/… (guess next version will have a few more tweaks...) $\endgroup$ Commented Feb 27, 2018 at 5:15
  • $\begingroup$ @Martin-マーチン I think mhchem's comment meant "this is how users commonly write electronic configurations" and not "this is how you all should write electronic configurations" $\endgroup$ Commented Feb 27, 2018 at 5:20
  • $\begingroup$ @Gaurang mhchem has a habit of implementing common usages, hence retroactively supporting them. And it does work to an acceptable extend. The spacing is a bit off, but not by much, so just roll with it.... it's not LaTeX we're talking about... $\endgroup$ Commented Feb 27, 2018 at 5:29
  • $\begingroup$ @Martin-マーチン Yes, I understand that. Do you wanna change the formatting wiki to also include \ce as an alternative for electronic configs? $\endgroup$ Commented Feb 27, 2018 at 6:50
  • $\begingroup$ @Martin-マーチン What's the problem with simply writing sp<sup>2</sup> instead? The more we can avoid mathjax, the faster webpage renders, isn't it? $\endgroup$ Commented Mar 3, 2018 at 14:00

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .