# Math symbols in math operators

I would like to customize the weak-star limit as a math operator. It should look like w$^*$-lim. I don't want to use w*-lim or w^*-lim because it looks ugly. But when I write

\DeclareMathOperator*{\wslim}{w$^*$-lim}


I get an error because dollars cannot be used in \mathrm mode. How can I make this happen?

• Welcome to tex.sx. Your question about why MathJax doesn't work here is answered by this meta question: tex.meta.stackexchange.com/q/1272 – barbara beeton Jun 16 '19 at 14:05
• You commented on the meta question that you don't like mathjax not being enabled, I suggest that you use the site for a while longer to see why that is a good policy. – David Carlisle Jun 16 '19 at 14:50

* obtains a special mathcode inside the AMS math operator setup, but here you want the standard star which is still available as \ast :

\documentclass{article}

\usepackage{amsmath}
\DeclareMathOperator*{\wslima}{w^{*}-lim}
\DeclareMathOperator*{\wslimb}{w^{\ast}-lim}
\begin{document}
$\wslima a \quad \wslimb a$
\end{document}


Note the reason for the redefinition is to make it possible to just use w* which is the intended markup here although as you note it does not produce the same symbol (or use the same font) as a normal math ^*.

\documentclass{article}

\usepackage{amsmath}
\DeclareMathOperator*{\wslim}{w*-lim}
\DeclareMathOperator*{\wslima}{w^{*}-lim}
\DeclareMathOperator*{\wslimb}{w^{\ast}-lim}
\begin{document}
$\wslim a \quad \wslima a \quad \wslimb a$
\end{document}

• Finally someone who reads the question carefully. Thanks so much!!! – amsmath Jun 16 '19 at 14:38
• @amsmath it also helps that I'm the current maintainer of the package and I had an idea what it was doing without needing to read the question that carefully:-) – David Carlisle Jun 16 '19 at 14:39
• You're the maintainer of the amsmath package? Then you should like my nick. ;-) – amsmath Jun 16 '19 at 14:43
• @amsmath actually I was considering asking you to change it, it may be confusing to others. – David Carlisle Jun 16 '19 at 14:47

Maybe you'd be interested in this variant:

\documentclass{article}
\usepackage{amsmath}
\DeclareMathOperator*{\wslim}{w\raisebox{-1.5pt}{${}^{*}$}\mkern-2mu-lim}

\begin{document}

$\wslim f$%

\end{document}


• I wrote in my question: "I don't want to use w*-lim because it looks ugly"... – amsmath Jun 16 '19 at 14:09
• Sorry, I didn't notice it. I mainly focused on not having compilation errors. For me the exponent is too high w.r.t. a lowercase letter. I even tried a simple \textsuperscript, but I obtained the same result as with math mode. – Bernard Jun 16 '19 at 14:15
• I've modified my code. Is it more like you want? – Bernard Jun 16 '19 at 14:56