Text Formattingmhchem | Italicized Chemical Formula

Information and discussion about LaTeX's general text formatting features (e.g. bold, italic, enumerations, ...)
Post Reply
MatthiasN
Posts: 41
Joined: Sun Mar 11, 2012 1:21 pm

mhchem | Italicized Chemical Formula

Post by MatthiasN »

Hi everyone,

I am using italic font in a certain paragraph of my document, but it won't put the chemical formulas I use in italics. My problem looks a bit like this:

Code: Select all

\usepackage{amsmath}
\usepackage[version=3]{mhchem}

\begin{document}
{\it This text is completely in italics except for this \cee{NH4+} formula.}
\end{document}
I read the mhchem package information, but there is nothing on italics or bold font use. There is a way to change the font used, but this is not what I'm looking for. I know that I can put the formula in bold font by putting it in math mode and using \mathbf or \boldsymbol. So is there an analogue command for italics?

Thanks for reading and hopefully somebody can help me.
Matthias

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org

NEW: TikZ book now 40% off at Amazon.com for a short time.

localghost
Site Moderator
Posts: 9202
Joined: Fri Feb 02, 2007 12:06 pm

mhchem | Italicized Chemical Formula

Post by localghost »

With \cee you are using the wrong command. It is made for chemical equations inside math environments. If you use \ce as suggested by the mhchem manual, there is no problem.

Code: Select all

\documentclass{scrartcl}
\usepackage[version=3]{mhchem}

\begin{document}
  \textit{This text is completely in italics except for this \ce{NH4+} formula.}
\end{document}
By the way, you better use \textit instead of the old LaTeX2.09 syntax \it to limit the scope of the (correct) \itshape declaration (see above).
MatthiasN wrote:[…] I know that I can put the formula in bold font by putting it in math mode and using \mathbf or \boldsymbol. […]
The font of the chemical symbols and formulas is usually customized by the provided \mhchemoptions command as explained in the section "Fine Tuning" of the package manual.


Thorsten
Post Reply