[Tex/LaTex] Replace all instances of * with \cdot only in mathmode

math-modemath-operators

As i understand the most accepted form to write the multiplication symbol in
LaTeX in \cdot. However i have a rather large document already with * as the
multiplication operator.
I would like to replace all instances of * with \cdot, but only in
mathmode($ Math $) and displaymathmode ($$ display math $$).
I would like to do this with future documents as well, as i think it improves
readability of the code.

Is there a way to do this with xstring for example? Or any other way to do this for the whole document?

Best Answer

\cdot is defined by

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

So you just need to put this in your preamble

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