Protecting negative spacing in math mode

I am using \! to create negative spacings and put a dash over a symbol in math mode. (Here I am denoting missing transverse energy by defining a command \met where a dash is put across E_T, see code below.)

This works well in most cases (when using beamer), but in the article class it can fail when lines are filled with additional space. Then the dash is no longer in the right position.

Is there a better way to put the dash in place?

Minimal example:

\documentclass{article}

\usepackage{xspace}
\usepackage{multicol}

\begin{document}

% \met has the negative spacing
\newcommand{\met}{\ensuremath{\not\!\!E_T}\xspace}

% fails here
\begin{multicols}{2}
A model for \met trigger rates.
Lorem ipsum dolor sit amet, consectetuer
adipiscing elit. Ut purus elit, vestibulum ut, placerat ac,
adipiscing vitae, felis. Curabitur dictum gravida mauris. Nam arcu
libero, nonummy eget, consectetuer id, vulputate a, magna. Donec
vehicula augue eu neque.
\end{multicols}

% works here
A model for \met trigger rate prediction.
Lorem ipsum dolor sit amet, consectetuer
adipiscing elit. Ut purus elit, vestibulum ut, placerat ac,
adipiscing vitae, felis. Curabitur dictum gravida mauris. Nam arcu
libero, nonummy eget, consectetuer id, vulputate a, magna.

\end{document}


PS: Feel free to put appropriate tags.

-

Here is a better complete minimal example, with a way to make your symbol more robust:

\documentclass{article}

\begin{document}

\newcommand{\met}{\ensuremath{{\not\mathrel{E}}_T}}

\newcommand{\foo}[1]{\hbox spread #1{A model for \met trigger rates.}}

\foo{0pt}
\foo{2pt}
\foo{4pt}
\foo{6pt}
\foo{8pt}

\end{document}


The extra braces turn the “relation” not-E back to an ordinary symbol.

Edit: I might add a word about how this works. \not is defines as \mathchar"3236, in which the 3 is the class (a relation). If you typeset $\not$ all by itself in a box and measure it, you will see that it has width zero. But in reality, the symbol has this almost-vertical line drawn outside of the nominal zero-width character box, on the right. So it will end up overlapping the next symbol. Now relations are usually surrounded by (stretchable) space, which is the source of the problem here. But two relation symbols side by side are given no intervening space, so you can make composite relations such as := for example. Hence, turning the E into a relation symbol turns off the troublesome space between it and the \not. An extra set of braces makes the result ordinary once more.

-
It's not the extra brackets, it's the \mathrel command that does the trick: \newcommand{\met}{\ensuremath{\not\mathrel{E}_T}\xspace} works as well. –  fuenfundachtzig Dec 3 '10 at 11:13
Indeed it is the \mathrel command that ensures the correct placement of the slash over the E. But the resulting combined symbol is a relation, and the braces are there so it will not have the spacing associated with a relation when used in a formula. In the above usage, where it is used on its own in text, it does not matter, of course. (My non-use of the \xspace does matter; I left it out because it is not relevant to the problem, but it should be kept if the symbol is to be used in text mode.) –  Harald Hanche-Olsen Dec 3 '10 at 11:24
Thanks for this explanation. –  fuenfundachtzig Dec 3 '10 at 14:05

The cancel package seems to be the right tool for this purpose.

\documentclass[11pt,a4paper]{article}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage{multicol}
\usepackage{cancel}

\begin{document}
\begin{multicols}{2}
A model for $\cancel{E_T}$ trigger rates.
Lorem ipsum dolor sit amet, consectetuer
adipiscing elit. Ut purus elit, vestibulum ut, placerat ac,
adipiscing vitae, felis. Curabitur dictum gravida mauris. Nam arcu
libero, nonummy eget, consectetuer id, vulputate a, magna. Donec
vehicula augue eu neque.
\end{multicols}
\end{document}

-
Except that the author of the package writes "Do not use this package" in the source. :-D –  Matthew Leingang Dec 1 '10 at 16:48
@Matthew: To be precise, he doesn't recommend that you use this package :-) –  Hendrik Vogt Dec 1 '10 at 16:55
He justifies that with "poor design" in the very last sentence of the manual. In principal the package works and doesn't mess up things. The author only expresses his opinion. –  Thorsten Donig Dec 1 '10 at 16:59
@Hendrik: you're right, I was quoting from (bad) memory. I confess I use it too so I'm certainly not against it. I just chuckled when I read that in the source. –  Matthew Leingang Dec 1 '10 at 17:10
@Thorsten: Good that you clarified this; I also first thought in the wrong direction and didn't it. –  Hendrik Vogt Dec 1 '10 at 17:12

I would suspect that multicols is altering the width of a negative thin space some how. Here's a hackier version that just overlaps.

  \newcommand{\met}{\ensuremath{\hbox to 0pt{$\not$}E_T}\xspace}

-