36

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
37

Does

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

give what you want?

enter image description here

  • 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
  • 1
    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 Ender Apr 1 '15 at 13:59
13

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}

​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​​Slash operator

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
  • I tried something like this myself and the problem with it is that how it ends up looking, depends on the width of the character it's applied to. Try this with P or A and you'll see. – Geoff Pointer Apr 1 '17 at 4:03
  • 1
    @GeoffPointer: You could consider using centernot or cancel. – Werner Apr 1 '17 at 4:08
  • Then, all you need is \newcommand{\fsl}[1]{{\centernot{#1}}}. – Geoff Pointer Apr 1 '17 at 5:28
4

Small tip to enter the Dirac slash:

k\!\!\!/ = \gamma^\mu k_\mu
  • 1
    This solution is not very well thought out. The use of \! is very arbitrary. This might look good on the letter k, but it won't on other letters and it cannot be generalised. – Geoff Pointer Apr 1 '17 at 7:20
  • I have no idea why this is downvoted, it works quite well when you are unable to use a package that does it for you. – Miles Dec 3 '17 at 0:45
3

Quite often using Latex there is not a simple solution, so one gets used to having one's own macro file, to accumulate personal solutions, which I recommend if you keep finding yourself wanting to change things.

For this problem, \newcommand{\fsl}[1]{{\centernot{#1}}} is serving me very well. You must include \usepackage{centernot} after your \documentclass for it to work. Or put it at the top of your macro file, once and for all, (or \RequirePackage{centernot} if you've converted your macro file to a package). Even the slashed package requires a \usepackage{slashed} every time you use it.

I've included some output below. The top row is with my simple solution and the bottom row uses the slashed package. It shows that my simple solution is not perfect, just compare my theta slash with the one below it, but then have a look at the phi slash below mine. It just looks like a messy phi and the i slash below is not so flash either. So there is no perfect solution and at least in mine, all the slashes are uniform, which I prefer.

Notice the difference in spacing as well. I prefer it compact for products, but that's a question of taste I guess.

enter image description here

Please note that I've used double brackets around my definition, so the inner brackets become part of what is produced. I do this with most things that are essentially a single symbol, or unit, so they can be sub- or super-scripted without brackets in my source file.

3

A solution using \ooalign that yields slightly better spacing than Werner's (especially with the very narrow and the very wide characters) is

\renewcommand{\fsl}[1]{{\ooalign{\(#1\)\cr\hidewidth\(/\)\hidewidth\cr}}}

\fsl at work

This still looks rather ugly on some capital letters and the slash on the f is almost invisible, but that is maybe just a weakness of the notation. (One could of course add checks to adjust the spacing depending on the character that is to be slashed.)

For an introduction to \ooalign, see this answer.

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.