Redefiniendo el asterisco (*) en modo matemático

Redefiniendo el asterisco (*) en modo matemático

Estoy intentando utilizar un símbolo de una fuente separada para el operador matemático asterisco centrado (∗). La fuente en cuestión solo tiene el glifo de asterisco (*) realzado (en muchas fuentes), que trato de usar para la variante centrada bajándolo.

En modo matemático, el operador puede ser utilizado tanto por *como por \ast, quienes se definen exactamente de la misma manera en las líneas 150 y 297 en fontmath.ltx.

\astSe puede redefinir con \renewcommand, pero *parece ser otra bestia. ¿Se puede convertir en una macro o cambiar de alguna otra manera la línea base del glifo?

\documentclass{minimal}

\DeclareSymbolFont{mymathoperators}{OT1}{phv}{m}{n}

\DeclareMathSymbol{\protoast}{\mathbin}{mymathoperators}{"2A}
\DeclareMathSymbol{*}{\mathbin}{mymathoperators}{"2A}

\renewcommand*{\ast}{\mathbin{\raisebox{-0.7ex}{\ensuremath{\protoast}}}}

\begin{document}

\( good \ast , bad * . \)

\end{document}

Respuesta1

Usando@egreg\DeclareMathActive:

ingrese la descripción de la imagen aquí

\documentclass{article}

\usepackage{amsmath}
\usepackage{etoolbox}

\DeclareSymbolFont{mymathoperators}{OT1}{phv}{m}{n}

\DeclareMathSymbol{\protoast}{\mathbin}{mymathoperators}{"2A}
\DeclareMathSymbol{*}{\mathbin}{mymathoperators}{"2A}

\renewcommand*{\ast}{\mathbin{\raisebox{-0.7ex}{\ensuremath{\protoast}}}}

\makeatletter
\newcommand{\DeclareMathActive}[2]{%
  % #1 is the character, #2 is the definition
  \expandafter\edef\csname keep@#1@code\endcsname{\mathchar\the\mathcode`#1 }
  \begingroup\lccode`~=`#1\relax
  \lowercase{\endgroup\def~}{#2}%
  \AtBeginDocument{\mathcode`#1="8000 }%
}
\newcommand{\std}[1]{\csname keep@#1@code\endcsname}
\patchcmd{\newmcodes@}{\mathcode`\-\relax}{\std@minuscode\relax}{}{\ddt}
\AtBeginDocument{\edef\std@minuscode{\the\mathcode`-}}
\makeatother

\DeclareMathActive{*}{\ast}

\begin{document}

\(good \ast , bad * . \)

\end{document}

información relacionada