I've been using the mathdesign package (specifically with the garamond font), and whenever I try using \hbar, the bar is much too high and to the left.

In order to fix this, I wanted to know how to redefine \hbar to be an h with a bar that I can move around until it looks aesthetically pleasing.

1 Answer 1


LaTeX defines \hbar as \mathchar'26, followed by a backspace of 9 math units (\mkern-9mu), followed by the letter h. Or, more specifically,

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

In order to provide the flexibility to overlap these two elements (the bar and the letter), we break it into two separate components, focussing on moving the bar in the correct position and then merely typesetting the h afterwards. Moving the bar left/right is obtained by a straight-forward \hspace*. Raising/lowering the bar is performed by the macro \raisemath{<len>}{...}, obtained from How to raise a subscript?:


Overlap of the bar with the h is obtained by \mathrlap (provided by the mathtools package). Easy macro definition is provided by \NewDocumentCommand from the xparse package.

\usepackage{mathtools}% http://ctan.org/pkg/mathtools
\usepackage{xparse}% http://ctan.org/pkg/xparse
\newcommand{\raisemath}[1]{\mathpalette{\raisem@th{#1}}}% \raisemath{<len>}{...}
\NewDocumentCommand{\newhbar}{O{0pt} O{0pt}}{% \newhbar[<horz len>][<vert len>]
    \verb!\hbar!: & \hbar \\
    \verb!\newhbar!: & \newhbar \\
    \verb!\newhbar[4pt]!: & \newhbar[4pt] \\
    \verb!\newhbar[-1pt][1.5pt]!: & \newhbar[-1pt][1.5pt] \\
    \verb!\newhbar[2pt][-4pt]!: & \newhbar[2pt][-4pt] \\
    \verb!\tfrac{\hbar}{2}!: & \tfrac{\hbar}{2} \\
    \verb!\tfrac{\newhbar}{2}!: & \tfrac{\newhbar}{2} \\
    \verb!\tfrac{\pi}{\newhbar[0pt][-1pt]}!: & \tfrac{\pi}{\newhbar[0pt][-1pt]}


hbar that can be modified

You can play around with the optional parameters for \newhbar[<horz len>][<vert len>]. The first parameter <horz len> moves the bar left/right, while the second <vert len> moves it up/down. They are optional, but cannot be empty. It would be possible to extend this to accommodate such empty parameters.

  • Thanks! This is so close to what I want, I just can't seem to lower it (putting a negative number as the second optional argument isn't changing anything, and 0 is still a bit too high).
    – qgp07
    Oct 3, 2011 at 2:08
  • @thequark: I've updated the solution to now take regular LaTeX lengths. You should be able to adequately specify negative lengths to move the bar up/down.
    – Werner
    Oct 3, 2011 at 2:30
  • Thanks! I'm certainly accepting this. Just thought I'd add one comment that it looks like the bar changes locations based on where it shows up in math (if it's at the beginning vs. after some other variables or equal sign). It's so subtle that it could just be my eyes...
    – qgp07
    Oct 3, 2011 at 3:00
  • I just came up with another issue: Whenever mathmode makes \hbar smaller (e.g. in a \tfrac command), the bar gets pushed upwards. I believe this is due to the fact that the phantom h doesn't scale appropriately. Any way to fix this?
    – qgp07
    Oct 3, 2011 at 3:34
  • 1
    @thequark: I've completely revamped the code and added some clarification for the use of certain elements. Hope this serves your needs.
    – Werner
    Oct 3, 2011 at 5:37

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.