4

I am trting to define a custom unit as follows

\DeclareSIUnit{\cmHg}{\centi\meter.\mathrm{Hg}}

In previous versions of siunitx, it was working very well. With the newest version it does not. Even the dot does not appear.

My MWE

\documentclass[aspectratio=169, xcolor={x11names}, t, handout]{beamer}

\usetheme{Dresden}
\usefonttheme{professionalfonts}

\usepackage{siunitx}
\DeclareSIUnit{\cmHg}{\centi\meter.\mathrm{Hg}}

\begin{document}

\begin{frame}
    
    $\si{\cmHg}$
    
    $\si{\centi\meter.\mathrm{Hg}}$
    
\end{frame}
    
\end{document}
5

Intermixing 'literal' and macro-based units has always been somewhat risky. In v3, a more controlled code path means that you do need to separate them out cleanly. As cmHg is a unit in it's own right, I would simply use

\DeclareSIUnit{\cmHg}{cmHg}

One could also treat this as an out-and-out qualifer

\DeclareSIUnit[qualifier-mode = space]{\cmHg}{\centi\metre\of{Hg}}
2
  • Thanks for the answer. However, books usually provide the unit as cm.Hg (with a dot at the baseline). The dot still causes an error and even does not show up when typing \si{\centi\meter.\mathrm{Hg}} Sep 23 at 17:17
  • A dot in a literal unit has always meant a space: that goes back to the syntax inherited from SIstyle over a decade ago!
    – Joseph Wright
    Sep 23 at 17:35

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.