I would like to define a new unit, analogous to \electronmass
, in the siunitx
package but this time for the proton mass. So I just copy/pasted the definition of \electronmass
from the style file and modified it. See MWE below.
\documentclass{article}
\usepackage{siunitx}
\DeclareSIUnit[]\protonmass
{ \text { \ensuremath { m _ { \textup { p } } } } }
\begin{document}
electron mass = \si{\electronmass}
proton mass = \si{\protonmass}
\end{document}
If I look at the output, there is a small space between the 'm' and the 'p'. .
How should I define the \protonmass unit so that the space is gone?
Best Answer
Remove the spaces from the definition. The reason why the space doesn't occur for
\electronmass
is I'd think thatsiunitx
is anexpl3
package, and in the environment defined byexpl3
spaces in the input are all ignored. Your new definition is not written in that environment.Here's the output.