I am looking to make a log-like operator that looks the same as $p \text{-lim}$
.
The best way so far I found to do this is
\DeclareMathOperator*{\plim}{\text{$p$-lim}}
Question: Is this the best way to do this?
It seems like a bit of a hack. If I remove
\text{...}
then it doesn't work.
(Also, I know I can use \operatorname*
to give a more flexible implementation like
\newcommand{\plog}[1]{\operatorname*{\text{$#1$-lim}}
where now I can change the p to, say, a p+q when needed.)
Best Answer
The argument to
\DeclareMathOperator
is processed in math mode, but with special settings to make hyphens not come out as minus signs. However letters will appear in roman upright type. But we have all the math mode tools available:(the
\mkern2mu
is because the p would be too near to the hyphen.The "variable argument" version could be
If you need also a real minus sign in the argument, then you have to restore its mathcode: