5

I would like to know how to make a character like \hslash, but with a 'd' instead of an 'h'. I know that \hbar is defined using \mathchar'26, might there be a similar character for the slash in \hslash?

5
  • Here: detexify.kirelabs.org/classify.html ? \dj?
    – Sigur
    Commented Apr 3, 2014 at 2:37
  • Sorry, I am looking for the diagonal 'slash', not the horizontal 'bar'.
    – nivk
    Commented Apr 3, 2014 at 2:40
  • 1
    there is probably no reason that the same \mathchar'26 can't be used, just with some horizontal adjustments to make sure it crosses the stem in the correct place. sorry, i don't have access to a system where i can test it at the moment. Commented Apr 3, 2014 at 2:49
  • Apologies, I must be explaining myself poorly. \mathchar'26 is a short horizontal line used in the definition of \hbar. The character that I seek is a short diagonal line, similar to the one appearing in the character \hslash in the amssymb package.
    – nivk
    Commented Apr 3, 2014 at 2:57
  • Also, welcome to TeX.SX! You can have a look at our starter guide to familiarize yourself further with our format. Commented Apr 3, 2014 at 3:08

1 Answer 1

9

The \hslash symbol is a unique glyph. Here's an emulation of it obtained by scaling, rotating and raising a minus sign:

\documentclass{article}
\usepackage{amssymb,graphicx}
\newcommand{\hslashslash}{%
  \raisebox{.9ex}{%
    \scalebox{.7}{%
      \rotatebox[origin=c]{18}{$-$}%
    }%
  }%
}
\newcommand{\dslash}{%
  {%
   \vphantom{d}%
   \ooalign{\kern.05em\smash{\hslashslash}\hidewidth\cr$d$\cr}%
   \kern.05em
  }%
}
\begin{document}
$\hslash\ne\dslash^2$
\end{document}

enter image description here

8
  • But how did you find that angle? I am clueless. :)
    – user11232
    Commented Apr 3, 2014 at 8:47
  • @HarishKumar Trial and error; the first attempt was 20 degrees, but typesetting it over the \hslash revealed it was too much; with 18 degrees it was perfect. There's no indication of the angle in the Metafont source for \hslash (bsymbols.mf, character octal 175). The bar is slightly thicker for \dslash, though. :(
    – egreg
    Commented Apr 3, 2014 at 8:58
  • This is beautiful, just what I needed! Thank you!
    – nivk
    Commented Apr 3, 2014 at 16:14
  • If now I try to use this inside of a command like $\vec{\dslash}$, this gives interesting results... How would you solve this to avoid that the arrow is so high?
    – mwoua
    Commented Apr 24, 2020 at 16:48
  • @mwoua I get this picture (click to see)
    – egreg
    Commented Apr 24, 2020 at 17:04

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .