View Single Post
Jun30-09, 08:13 AM
P: 74
First post, and it's about LaTeX! I've been working with LaTeX for some time now, and recently started getting serious about typesetting spectroscopic notation. I actually started this post asking a question, but while developing the post, I came across an acceptable answer. As such, the tone of this post will change from question to tip.

I have been trying to typeset any general chemical equation or spectroscopic configuration notation without italics. I have known of the \text{} command, and recently found the \textrm{} command, but both of these complain when there are superscripts, subscripts, or Greek characters within the {} delimiters.

As is shown in this thread, you can easily get away with carefully placing the delimiters and \text{} commands. For example, I want to write the following configuration information:


As another example, as was previously posted,
Quote Quote by Borek View Post
[tex]10\textrm{K}_{4}\textrm{Fe(CN)}_{6}+122\textrm{KMnO}_{4}+299\textrm{H}_ {2}\textrm{SO}_{4}\rightarrow162\textrm{KHSO}_{4}+5\textrm{Fe}_{2}\text rm{(SO}_{4}\textrm{)}_{3}+122\textrm{MnSO}_{4}+60\textrm{HNO}_{3}+60\te xtrm{CO}_{2}+188\textrm{H}_{2}\textrm{O}[/tex]
My problem: Although this works, it is quite messy to read for arbitrarily complex expressions. Further, I have to manually ensure this content is in math mode, which can be a pain when applying it to an arbitrary location.

My solution: Use the \mathrm{} command! Here's the same examples, cleaned up a bit using this new command:

\mathrm{4f^{14} 6s 6p ~ ^3P_1}

\mathrm{10 K_4 Fe (CN)_6 + 122 K MnO_4 + 299 H_2 SO_4 \rightarrow 162 K H SO_4 + 5 Fe_2 (SO_4)_3 + 122 Mn SO_4 + 60 H NO_3 + 60 CO_2 + 188 H_2 O}

Even better, define a new command which enforces math mode, as well as this Roman font. something like


and then you can just simply type \chem{H_2 SO_4} wherever you want, both inside or outside of math mode. With proper use of whitespace, the LaTeX markup looks more elegant and easy to read/diagnose in my opinion.

Hope this helps! It definitely helps me!