[Tex/LaTex] Astrophysical notation : typeset HI

formattingtypography

What would the best way to typeset HI to designate molecular gas as in the title of this article, with a capital H and a slightly smaller numeral I ? I am using the scrbook class.

I tried to define

\newcommand{\HI}{H {\uppercase{\romannumeral 1}} }

but this results in H i, with a lowercase i.

I also tried

\newcommand*{\HI}{\textsc{Hi}}

but this doesn't behave properly when I use it in \section{}, resulting in "H i" rather than "H I".

I also haven't found anything like this in chemmacros, which is more geared towards chemists.


This is a standard way of writing molecules in astrophysics, so I'm surprised there isn't a package that does this easily.

Best Answer

Use the size of subscripts linked to the current font size.

\documentclass{article}
\usepackage{amsmath}

\makeatletter
\DeclareRobustCommand{\HI}{%
  \mbox{H\check@mathfonts\fontsize\sf@size\z@\selectfont I}%
}
\makeatother

\textheight=3cm % just to shorten the image

\begin{document}

\section{About \HI}

Here we talk about \HI.\footnote{Yes, about \HI.}

\end{document}

enter image description here

The kernel command \check@mathfonts computes \sf@size and \ssf@size starting from the current font size, either with the parameters stored with \DeclareMathSizes or with a heuristic otherwise.