# How can we replace a math symbol?

I found a way to define a math symbol as follow:

\documentclass{article}

\makeatletter
\begingroup\lccode~=*
\lowercase{\endgroup\def~}{\times}
\mathcode*="8000
\makeatother

\begin{document}
$a*b$
\end{document}


Theh problem is that I have to assign a letter which appears on keyboard "*" to replace "\times" (that means the ASCII code is in range 0-255). Because function \lccode just accept value in that range.

How can I define an arbitrary math symbol and assign it to the same character? Something like:

\begingroup\lccode~=\times         % it doesn't work in this way
\lowercase{\endgroup\def~}{new\ \times}
\mathcode\times="8000


In other words, we redefine a math symbol which has value of mathcode is out of ASCII range. Because we can do as follow:

\lccode~=0
\lccode~=\_
\lccode~=\=
...


but cannot with

\lccode~=\times
\lccode~=\star
...

• rather than showing code that doesn't work and making us guess the intended effect it would be better to give a top level description of what you want to do. What input do you want in the file, and what typeset output do you want it to generate? Jan 6, 2020 at 0:42
• I don't get it. Why don't you just redefine \times? Like for example \let\normaltimes\times \renewcommand*\times{new\ \normaltimes} Jan 6, 2020 at 0:44
• >>@Henri Menke: Thank you. Your suggestion is so nice. I do that because I don't know how to redefine \times. Jan 6, 2020 at 0:56
• >>@David Carlisle: Thank for your feedback. I have just attended this forum, so I don't have experience. I will pay attention next time. Jan 6, 2020 at 1:00
• @Tauyeco I did not get notified about your reply, presumably because of the >> in front of the @ sign. Jan 6, 2020 at 2:47

\let <new command> <old command>

• It's not that the \mathcode is out of range for \times: \times cannot have a math code (as any other macro). You use the \mathcode for characters (only characters have a \mathcode), so you make them behave as if they were macros (like in your example you made the character * behave as the macro \times). For macros, you can just redefine them, as Henri suggested. Jan 6, 2020 at 1:19