Related Question:
Typesetting the square of a mathematical operator

\operatorname converts its argument into a function symbol with appropriate spaces on the left and on the right. However, I often need sub- and superscripts applied on those symbols. So I'd like to define something like





Note that \operatorname{\mathnormal{f}}_{#1}^{#2} (sub- and superscript outside \operatorname) would place the subscript too far away from the letter f.

Here the problem begins: Since \operatorname internally applies \mathrm to its argument, \f{2}{n} typesets the exponent n upright:


On the other hand, if I write


then the numbers' font is changed:


This gets really tricky when combining letters (or other operators) and numbers like \f{2mn\cdot x}{\frac{c}{2}}:


Is there a way to get the "right" letters and the "right" numbers at the same time? That is: desired

  • 1
    Can you please explain why you want to use \operatorname, instead of just typing f_2^n? Oct 23, 2012 at 14:11
  • Because of the spacing: E.g. a\f{2}{n}+b is different from a\f{2}{n}+b.
    – aulste
    Oct 24, 2012 at 8:33
  • OK, that's true. I'm still not sure why you want that different spacing - that would be interesting to know. Oct 24, 2012 at 8:54
  • The idea is simply to highlight function symbols in somewhat lengthy equations, such that it is easier to determine which symbols are functions, constants and so on.
    – aulste
    Oct 24, 2012 at 9:24
  • Thanks for the info! (Let me mention that it might be OK to do this for educational purposes, but not in usual typesetting.) Oct 24, 2012 at 10:00

1 Answer 1


It's not clear exactly what layout you want, (perhaps a full minimal example and image in your question would have helped).

The main function of \operatorname is to provide multi-letter operators like log etc, if you want a math italic f it seems that you just need one of these, depending on where you want the limits to go.

The other function is to give it operator spacing, ie a small gap before the argument, so perhaps the first or second form is what you are looking for?

$ f_1^2 x $

$ \mathop{f_1^2} x $

$ \mathop{{}f}_1^2 x $

$ \mathop{{}f}\limits_1^2 x $

enter image description here

  • Thanks for your answer. I extended my question such that my problem should be quite clear now.
    – aulste
    Oct 23, 2012 at 13:48
  • Your first suggestion puts the subscript 1 not close enough to the f, just like \operatorname{\mathnormal{f}}_{#1}^{#2}. The second one is, unfortunately, also not the desired solution as I don't want the operator to show limits.
    – aulste
    Oct 23, 2012 at 13:54
  • it's not close because operatorname gives it mathop spacing which forces a gap, I updated my answer with a variant without that. Oct 23, 2012 at 14:11
  • Oh updated answer again. I think it's the 2nd form you want with the 1 still kerned back to the f and operator spacing for the whole constrruct Oct 23, 2012 at 14:16
  • Thanks. The second form solves my problem. \operatorname{foo} reduces to \mathop{\kern0pt \operator@font foo} where \operator@font caused my problem. For anyone who is interested in the details, I refer to tex.stackexchange.com/a/67956/7160
    – aulste
    Oct 24, 2012 at 9:14

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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