Spacing after \mathinner

spacing

This is my first post here, so I hope I do it well (I am French).

I don't understand the spacing after \mathinner.

Here is a MWE:

\documentclass[a4paper]{article}

\begin{document}    
  $\mathinner{}!$

  $\mathinner{}{!}$  
\end{document}

The spacing before ! is not the same.

I thought ! was of type \mathord so typing {!} shouldn't change the spacing but it does: there is a \thinmuskip in the second line (which is correct between \mathinner and \mathord) but not in the first line and I don't get it.
Why is ! not of type \mathord in the first line? And which type is it?

Best Answer

enter image description here

! is \mathclose not \mathord alledgedly to improve the spacing in its conventional use as factorial. However the only case where this affects the space before the ! is with \mathinner (\left\right) where usually you can get the better spacing simply by not using \left\right as shown in the third line here. However the second line shows the spacing that you would get with \mathord, with an unwanted space before the !.

\documentclass{article}

\begin{document}

$ \left(1+2\right)! + 9! $

$ \left(1+2\right){!} + 9{!} $

$ (1+2){!} + 9{!} $


\end{document}

LaTeX defines ! by

\DeclareMathSymbol{!}{\mathclose}{operators}{"21}
Related Question