# What does “\!” aka backslash exclamation mark do?

I just came across this ! (backslash exclamation mark) in the code for a table in somebody else's tex and I was wondering what it does.

\begin{table}[hbt]
\centering
\resizebox{\columnwidth}{!}{%
\setlength\extrarowheight{1pt}
\begin{tabular}{l | c c c | c r}
\toprule
\textbf{Thing} & $a$ & $b$ & $c$ & $d$ & $e$\\
\midrule
Stuff &  \!\!100\!\!  &  \!\!$10^{6}$\!\! & \!\!$\pi_0$\!\! & $\sigma$ & $2^{30}$\\
\bottomrule
\end{tabular}%
}
\end{table}


My tex editor says unrecognized command but it compiles just fine. I've tried on overleaf and it seems to tighten the table somehow. Does anybody know more?

• A \! is a negative space, see tex.stackexchange.com/questions/9091/… for more information. – BambOo Oct 16 at 9:13
• It doesn't compile fine! – egreg Oct 16 at 9:42
• @egreg I'm not getting any errors for the overleaf example. What do you mean? – Elias Oct 16 at 16:56
• @Elias I get 11 errors, after adding a suitable minimal preamble. – egreg Oct 16 at 17:14
• Hm..strange. Compiling the overleaf example with pdflatex I don't get any. – Elias Oct 16 at 17:18

I don't know what the commands \! are supposed to do in the code you show, other than raising many errors.

The command \! is only allowed in math mode (unless redefined, which I'd discourage). It's purpose is to insert a negative thin space, which is useful in several places. For instance

\biggl(\frac{121}{12}-1\biggr)^{\!2}


is an improvement over ^{2}, because it moves the exponent towards the parenthesis and takes care of its bending.

Another place where it is helpful is in 2/\!\log x, because for technical reasons / is an ordinary symbol and TeX would add a thin space between it and the “log” operator.

Here's a picture: left the output with \!, right without.

The negative spacing of \! exactly matches the positive one by \, (which is automatically inserted in some places) in math mode. Note that \, can be used outside of math mode, where it inserts a sixth of a quad of space.

If you want to tighten a table, reduce the size of \tabcolsep. Using explicit negative spaces all over the place is not the correct way.

And never use \resizebox on a table.

• Huh...I always thought this kind of stuff was automatic in tex. I have to fix such spaces manually? – Elias Oct 16 at 16:57
• @Elias There are more things in heaven and math formulas than are dreamt of by your TeX engine. – egreg Oct 16 at 17:12
• In any case, good to know, although I have no intention of fiddling with this kind of thing. :) – Elias Oct 16 at 17:15

This symbol is usually defined as

 \! negative thin space (normally 1/6 of a quad)


It is commonly used in tables, and formulas among other ways to manipulate spaces in LaTeX

And before you do post a question, please do run a search with similar keywords on this site. Hope this helps.

• Commonly used in tables? Please explain. I hardly never see it used other than in a few math constructions. – daleif Oct 16 at 9:34
• @daleif I am not sure if I can provide examples that are relevant here, since it is a matter of usage, and remember coming across it in tables. – GermanShepherd Oct 16 at 9:38
• @GermanShepherd I tried searching for it but got no useful results. The search can't handle the special symbols, I guess. I didn't know it was called a negative thin space. ;) – Elias Oct 16 at 16:54
• @daleif Well, it can be used also for more bizarre goals as draw a donkey :-) – Fran Oct 16 at 19:19
• @Fran That was a good one :-) – GermanShepherd Oct 23 at 3:55