# How can I reduce the gap between left and right of \cdot with a macro?

MWE

\documentclass[a4paper,11pt,border=1pt]{standalone}
%\LetLtxMacro{\oldcdot}{\cdot}
%\renewcommand{\cdot}{\!\cdot\!} <-- Like this
\begin{document}
$3\cdot 10^8$ m/s
\end{document}


I'm getting the following output.

However \cdot as there are many spaces between left and right. How do I get the following image should I have a macro?

Related to: https://tex.stackexchange.com/a/29838/33075

• $3{\cdot} 10^8$ m/s kills the \mathbin space before and after \cdot. – Phelype Oleinik Apr 18 at 14:31
• @PhelypeOleinik, How simple! – Özgür Apr 18 at 14:42

For this I recommend siunitx, that ensures uniformity in numbers and units.

\documentclass{article}
\usepackage{amsmath}
\usepackage{siunitx}

\sisetup{
exponent-product={{\cdot}}, % double brace for avoiding the space
per-mode=symbol,
}

\begin{document}

\SI{3e8}{\meter\per\second} % long form

\SI{3e8}{m/s} % abbreviated form

\SI[per-mode=reciprocal]{3e8}{\meter\per\second} % long form

\end{document}


Note that it's easy to change from a representation to another, when the long form is used (which is recommended).

Also this has the advantage that you just need to change the option in the preamble if you change your mind about how to represent that product.

The same effect can be obtained with the option tight-spacing, which however will act also on all binary operations, for instance uncertainties.

\documentclass{article}
\usepackage{amsmath}
\usepackage{siunitx}

\sisetup{
exponent-product=\cdot,
tight-spacing,
per-mode=symbol,
}

\begin{document}

\SI{3e8}{\meter\per\second} % long form

\SI{3e8}{m/s} % abbreviated form

\SI[per-mode=reciprocal]{3e8}{\meter\per\second} % long form

\end{document}

• Now this is the proper way to do it :-) – Phelype Oleinik Apr 18 at 16:52
• +1. Instead of hard-coding the tightly-spaced behavior, one could also run \sisetup{exponent-product=\cdot, tight-spacing=true}. Then, if at some point in the document it becomes necessary to switch to non-tight spacing, one can simply execute \sisetup{tight-spacing=false}. – Mico Apr 18 at 17:29
• @Mico Thanks for the hint. I added it, but noted that this acts also in other places. – egreg Apr 18 at 22:18

\cdot is defined in fontmath.ltx with:

\DeclareMathSymbol{\cdot}{\mathbin}{symbols}{"01}


which means it is a binary operator (\mathbin) so it will have an extra space before and after as other binary operators, such as + and -.

TeX will not insert that space if you “hide” \cdot within braces:

\documentclass[11pt,border=1pt]{standalone}
\begin{document}
$3{\cdot} 10^8$ m/s
\end{document}


If you will use that symbol multiple times you can define an ordinary math symbol (\mathord) with the same glyph as \cdot:

\documentclass[11pt,border=1pt]{standalone}
\DeclareMathSymbol{\mdot}{\mathord}{symbols}{"01}
\begin{document}
$3\mdot 10^8$ m/s
\end{document}


or you can redefine \cdot with the same command.

• +1 Or call it \mdot for "multiplication dot" – Andrew Swann Apr 24 at 6:08