# raising subscript with mhchem

I've tried to define a macro with staggered sub- and superscript and added a formula with mhchem to the superscript. the typesetting seems misaligned especially the subscript seems to be typeseted to high. is there a way to fix this? MWE:

\documentclass[numbers=noenddot,plain,ngerman,a4paper,12pt]{scrbook}

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

\DeclareRobustCommand{\va}[2]{$\nu_{\hspace{2px}\text{#2}}^\ce{\hspace{1px}#1}$}

\begin{document}

\blindtext
\va{CO2}{as} \va{CO}{as} \va{CO2}{as} \va{CO}{as}
\blindtext

\end{document}


the mwe output:

• For what it's worth: with chemformula's \ch this works “out of the box”: \DeclareRobustCommand{\va}[2]{$\nu_{\,\text{#2}}^{\,\ch{#1}}$} – clemens Jan 27 '15 at 20:53

Smash the bottom of the exponent:

\documentclass[12pt]{scrbook}

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

\DeclareRobustCommand{\va}[2]{%
\ensuremath{%
\nu_{\,\text{#2}}%
^{\smash[b]{\ce{\,#1}}}%
}%
}

\begin{document}

\blindtext
\va{CO2}{as} \va{CO}{as} \va{CO2}{as} \va{CO}{as}
\va{O2}{asas}
\blindtext

\end{document}


• this answer has a better typesetting. +1 – ruffy Jan 27 '15 at 18:20

Add a custom strut below the baseline. I also enclosed the \ce macro in braces to be on the safe side (thanks to Karl).

\documentclass[numbers=noenddot,plain,ngerman,a4paper,12pt]{scrbook}

\usepackage[version=3]{mhchem}
\usepackage{blindtext}
\def\mystrut{\rule[-.15\baselineskip]{0pt}{1pt}}
\DeclareRobustCommand{\va}[2]{$\nu_{\hspace{2px}\text{#2}}^{\ce{\hspace{1px}\mystrut#1}}$}

\begin{document}

\blindtext
\va{CO2}{as} \va{CO}{as} \va{CO2}{as} \va{CO}{as}
\blindtext

\end{document}


• It doesn't compile for me. It needs a pair of braces around \ce{\hspace{1px}\mystrut#1} – karlkoeller Jan 27 '15 at 16:36
• @karlkoeller I suppose one of us has a package out of date. But enclosing it in braces is certainly the safe way to go, so I will edit the answer. – Steven B. Segletes Jan 27 '15 at 17:32
• OK.................. :-) – karlkoeller Jan 27 '15 at 17:44