I want to place a limit under a word, as done here except with an arbitrary text rather than an existing math operator like lim or max.

\mathop{avg}\limits_{y\in U(x)} gives me the following, but I would like "avg" to be in non-italicized.

enter image description here

I have also tried to define \def\avg{\text{avg}} and \newcommand{\avg}{\text{avg}} but then the subscript is no longer underneath the text, even with \avg\limits_{y\in U(x)}:

enter image description here

  • Unrelated: \text does not do what you think here. (a) it switches to the current text font, (b) if that font shape is italic the output of \text is italic. This is sadly a very common error – daleif Apr 10 at 18:58

Here's how I do it:

\newcommand*\avg{\mathop{\operator@font avg}}
\avg_{y\in U(x)}

enter image description here

IIRC this was recommended by Herbert Voß in one of his books (credit where credit is due).

  • 1
    +1: Is \operator@font something "new"? I don't remember to have seen it before :). – Dr. Manuel Kuehner Apr 10 at 18:55
  • 1
    @Dr.ManuelKuehner I couldn't tell you how old it is exactly, but it must have been around for at least a few years. EDIT: just checked, there are mentions of it going back to at least 1999, so yeah --- a few years, indeed! – chsk Apr 10 at 18:57
  • Thank you! Is "\operator@font" a typo? i used simply \operatorfont and it worked. – 900edges Apr 10 at 19:08
  • @900edges Not a typo, no. Many internal LaTeX commands have @ signs in them, which is also why the above snippet wrapped the definition in \makeatletter ... \makeatother: otherwise @ would not be recognized as part of a command name. – chsk Apr 10 at 19:24
  • 3
    @Dr.ManuelKuehner No, it's not new, but this method is certainly not the best: \DeclareMathOperator*{\avg}{avg} is the way to go. – egreg Apr 10 at 19:49

Using \underset....

  \underset{y\in U(x)}{\mathrm{avg}} f(y)

enter image description here

Not the answer you're looking for? Browse other questions tagged or ask your own question.