# How to write a modified limit operator? [duplicate]

I am trying to write an generalised limit operator, which look approximately like the standard \lim, except it has an additional symbol in front, connected by a hyphen (see example below). I would very much like this generalised limit to really look like the good old \lim; in particular, if I take limit over a variable x, then I would like the symbol x to be placed below. I almost managed to accomplish this by exploiting the old \lim, and adding the prefix:

> p \!\! - \!\! \lim_x


However, if I replace x by a longer string (say, several variables), I get too much whitespace. I tried grouping the limit into a single object, like below, but this leads to the variable being placed right of the limit symbol, not below:

> {p \!\! - \!\! \lim}_x


Could someone please advise me what is the best way of writing such a limit?

Here is a minimal example and the output.

\documentclass{article}
\usepackage
\begin{document}

Naive example:
$$p-\lim_{x} f(x), \qquad p-\lim_{x_1,x_2,\dots,x_n} f(x_1,x_2,\dots,x_n)$$

With \verb"\!" used for indentation, without grouping:
$$p\!\!-\!\!\lim_{x} f(x), \qquad p\!\!-\!\!\lim_{x_1,x_2,\dots,x_n} f(x_1,x_2,\dots,x_n)$$

With \verb"\!" used for indentation, plus grouping  :
$${p\!\!-\!\!\lim}_{x} f(x), \qquad \operatorname{p\!\!-\!\!\lim}\limits_{x_1,x_2,\dots,x_n} f(x_1,x_2,\dots,x_n)$$

\end{document}


-

## marked as duplicate by egreg, Paul Gaborit, Torbjørn T., Joseph Wright♦Jul 28 '13 at 13:06

Did you see tex.stackexchange.com/questions/73232/…? –  egreg Jul 28 '13 at 11:14
@egreg: No, I did not, but that looks very relevent. Thank you! –  Feanor Jul 28 '13 at 11:37

You can use

\DeclareMathOperator*{\plim}{p-lim}


in your preamble, which will define a command \plim which you can use in your document with, for example,

\plim_{x\to\infty} f(x)


This will produce a roman (upright) 'p'. If you want an italic 'p', the definition should be

\DeclareMathOperator*{\plim}{\mathit{p}-lim}

-
The “p” will be upright, which probably isn't wanted. –  egreg Jul 28 '13 at 11:17
This is precisely what I needed, thank you! I replaced \DeclareMathOperator* by a \newcommand with \operatorname* so that I could replace p by other, but other than that, you solution works perfectly. –  Feanor Jul 28 '13 at 12:11
The right command is \mathnormal, but this is already covered in the question I linked as duplicate. –  egreg Jul 28 '13 at 12:37