## LaTeX forum ⇒ Text Formatting ⇒ mhchem | Hide Subscript in chemical Formula

Information and discussion about LaTeX's general text formatting features (e.g. bold, italic, enumerations, ...)
ghostanime2001
Posts: 402
Joined: Fri May 20, 2011 9:41 am

### mhchem | Hide Subscript in chemical Formula

I just want to hide the "2" in HF (second chem reaction) in my document without changing the vertical alignment of the "acid" label under HF2. If that isn't clear enough:

Typeset "HF" like "HF2" without "2" in the first chem equation to keep labels consistent height.

MWE:
Last edited by ghostanime2001 on Sat Dec 17, 2011 8:23 pm, edited 1 time in total.

Tags:

josephwright
Site Moderator
Posts: 814
Joined: Tue Jul 01, 2008 2:19 pm
Do you mean something like
\documentclass{article}\usepackage{chemmacros}\begin{document}Original: \ce{$\underset{\clap{\begin{tabular}[t]{@{}c@{}}acid\end{tabular}}}{\ce{NH4+}}$ + $\underset{\clap{\begin{tabular}[t]{@{}c@{}}base\end{tabular}}}{\ce{F-}}$ <=> $\underset{\clap{\begin{tabular}[t]{@{}c@{}}base\end{tabular}}}{\ce{NH3}}$ + $\underset{\clap{\begin{tabular}[t]{@{}c@{}}acid\end{tabular}}}{\ce{HF}}$} \\ \\ \\Typset with a subscript of HF: \ce{$\underset{\clap{\begin{tabular}[t]{@{}c@{}}acid\end{tabular}}}{\ce{NH4+}}$ + $\underset{\clap{\begin{tabular}[t]{@{}c@{}}base\end{tabular}}}{\ce{F-}}$ <=> $\underset{\clap{\begin{tabular}[t]{@{}c@{}}base\end{tabular}}}{\ce{NH3}}$ + $\underset{\clap{\begin{tabular}[t]{@{}c@{}}acid\end{tabular}}}{\ce{HF$\smash{_2}$}}$}\end{document}

perhaps?

BTW, it would be better to cut down your code to a minimal example before posting: there were a lot of excess packages in your preamble.
Joseph Wright

ghostanime2001
Posts: 402
Joined: Fri May 20, 2011 9:41 am
I think you may have misunderstood me. I wanted to type the "acid" under HF2 without smash like typing "acid" under HF

\documentclass{article}\usepackage{chemmacros}\usepackage{mhchem}\begin{document}\ce{$\underset{\clap{\begin{tabular}[t]{@{}c@{}}acid\end{tabular}}}{\ce{HF}}$} \qquad\ce{$\underset{\clap{\begin{tabular}[t]{@{}c@{}}acid\end{tabular}}}{\ce{HF2}}$}\end{document}

cgnieder
Site Moderator
Posts: 1993
Joined: Sat Apr 16, 2011 7:27 pm
\documentclass{article}\usepackage[version=3]{mhchem}\begin{document} without phantom: $\underset{acid}{\ce{HCl}}$ $\underset{acid}{\ce{H2SO4}}$ with phantom: $\underset{acid}{\ce{HCl}\vphantom{\ce{H2}}}$ $\underset{acid}{\ce{H2SO4}}$ \end{document}