What's the most elegant way to obtain Dirac operators? (slash notation)

What's the best way to achieve the Dirac slash notation for Dirac operators (contraction with Gamma matrices)? I would have thought the AMSmath packages would have this built in somewhere.

(The cancel package springs to mind, but surely there is an easier method?)

-
Good question! And one I've struggled with over many years. I'm currently using the slashed package as mas suggests. – Loop Space Aug 25 '11 at 16:56

Does

\documentclass[12pt]{article}
\usepackage{amsmath}
\usepackage{slashed}
\begin{document}
$\slashed{p}$
\end{document}


give what you want?

-
Yes, it does - thanks. I was wondering if I had overlooked a built-in way of doing it, in AMSmath or otherwise, without the need for an additional package. – Dan Aug 25 '11 at 16:10
@Dan -- thanks for the comment. Welcome to TeX.SX: hope you'll enjoy coming here! – mas Aug 25 '11 at 17:15
While this is convenient, Werner's solution actually looks much nicer. The slashed package seems to use a different vertical position depending on the letter height, so if you have \slashed{a}\slashed{b} it looks a bit off. – Martin Büttner Apr 1 '15 at 13:59

In addition to mas's answer, you could define your own using an overlap (in mathmode) of the \not operator:

\documentclass[12pt]{article}
\usepackage{mathtools}% http://ctan.org/pkg/mathtools
\newcommand{\fsl}[1]{\ensuremath{\mathrlap{\!\not{\phantom{#1}}}#1}}% \fsl{<symbol>}
\begin{document}
\noindent $\not{a}\not{b}=4(a\cdot b)$

\noindent $\fsl{a}\fsl{b}=4(a\cdot b)$
\end{document}


​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​

Of course this works best for single-symbol/letter slashing. I think this is more commonly referred to as Feynman slash notation.

-
I never knew it was down to Feynman - thanks! – Dan Aug 25 '11 at 16:08

Small tip to enter the Dirac slash:

k\!\!\!/ = \gamma^\mu k_\mu

-