2

As described in this answer, constants should be typeset upright, not in italics. However the symbol for reduced Planck's constant (ħ, \hbar) is in italics by default. This is especially obvious when using both h and \hbar in one equation. How do I make LaTeX typeset ħ upright?

ħ = h/2π


EDIT: I've tried \mathrm, \text, \textup, none of them works.

  • 4
    Opinions on the subject tend to differ but the bit about upright constants usually refer to math constants. Physical constants are usually written italic. I have never seen upright c, h and whatnot. (Theoretical physicist talking here.) – campa Feb 5 at 9:51
  • 1
    In fact, I'm pretty sure ISO norms dictate (for whatever reason) upright for mathematical and italics for physical constants. In my experience, most mathematicians do not see the point of this distinction but many physicists abide by it. (Including myself.) – campa Feb 5 at 9:57
  • I'm pretty sure it's somewhere in “ISO 80000-1:2009”. Or maybe “-3” or “-7”. But I'm not sure it really matters, as each of these PDFs are sold at $160 🤷‍♂️️. But if you find a way to access those, I'll gladly read them. – m93a Feb 5 at 10:09
  • 3
    @HenriMenke Not since May 2019 any more :-) – campa Feb 5 at 10:20
  • 4
    @campa I remember that the “rationale” for typesetting physical constants in italic type was that their value is bound to change because of better measurements. Of course now this is absurd (it was to begin with, actually), because the speed of light and the Planck constant are defined as exact values. – egreg Feb 5 at 13:30
6

I won't delve into the issue whether this should be done or not.

The LaTeX kernel defines

\def\hbar{{\mathchar'26\mkern-9muh}}

and as such \mathrm{\hbar} should give an upright \hbar. However, the negative space of 9 math units is a wee bit too much for the upright letter; 8mu looks better, so you can use

\renewcommand*{\hbar}{{\mkern-1mu\mathchar'26\mkern-8mu\mathrm{h}}}

Care should be taken when font packages are loaded, for many of them contain \hbar as symbol. Obvious example: amssymb. In this case the redefinition of \hbar bust be issued after loading any font packages. To be on the safe side the above redefinition could be put into a \AtBeginDocument hook

\AtBeginDocument{\renewcommand*{\hbar}{{\mkern-1mu\mathchar'26\mkern-8mu\mathrm{h}}}}

EDIT To lower the bar a little the safest way is IMO to put it into a box and lower it by an amount relative to the height of the box.

\documentclass{article}

\begin{document}

\renewcommand*{\hbar}{{\mkern-1mu\mathchar'26\mkern-8mu\mathrm{h}}}
$\hbar \scriptstyle\hbar \scriptscriptstyle\hbar$

\renewcommand*{\hbar}{{\mathpalette\hbaraux\relax\mathrm{h}}}
\newcommand*{\hbaraux}[2]{\sbox0{\mathsurround=0pt$#1\mathchar'26$}\mkern-1mu\lower.07\ht0\box0\mkern-8mu}
$\hbar \scriptstyle\hbar \scriptscriptstyle\hbar$

\end{document}

enter image description here

|improve this answer|||||
  • 1
    Did you try it in context? You need \mkern-1mu in front of \mathchar. The total amount of backspacing should be 9mu, because that's the width of the bar. – egreg Feb 5 at 13:27
  • @egreg Yes, I did; apparently in my typical use cases no big difference did show up. But of course you are right... – campa Feb 5 at 13:36
  • 3
    The difference is subtle, but noticeable: in this picture the top has a simple h, the middle the \hbar without the \mkern-1mu and the bottom the fixed symbol. – egreg Feb 5 at 13:42
  • I found that in subscripts and superscripts, this macro fails. Doing $A^\hbar$ is enough to reproduce the issue. I have no idea why, though, as the original \hbar works fine… – m93a Feb 8 at 14:38
  • 1
    @m93a See edit. – campa Feb 8 at 15:46

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.