Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

Mathematical operators, such as function names, should be set in roman type, not italics. Latex already has commands for some operators, including \max, \min, and \log. How can I define additional such commands?

share|improve this question
add comment

5 Answers

up vote 35 down vote accepted

\DeclareMathOperator{\foo}{foo} and \DeclareMathOperator*{\hocolim}{hocolim} for sub- and superscripts in the limits position.

share|improve this answer
    
Great! I thought there was some way of handling the limits, but couldn't remember it. –  Andrew Stacey Jul 30 '10 at 18:56
add comment

Alternatively, if you are using any of the packages from the AMS (amsart.cls or amsmath.sty) then there is a command \DeclareMathOperator which does what it says on the tin! For example,

\DeclareMathOperator{\Det}{Det}

I think that it can handle variants, but I don't recall off the top of my head.

share|improve this answer
    
Ah, you were faster :-) –  Grigory M Jul 30 '10 at 18:57
    
The slower won! –  I am who I say I am Mar 15 '12 at 18:25
add comment

If you're looking for something one-off, you can always use \mathrm in a math environment like so:

\mathrm{ultimatefunction}(x)

Which will display 'ultimatefunction' in a roman type.

share|improve this answer
8  
Note that \mathrm differs from \operatorname or \DeclareMathOperator in terms of spacing, and that the latter two are preferable to the first in this respect (see this answer for more detailed information). –  Andrew Uzzell Nov 13 '12 at 12:09
add comment

Define the command \newoperator as follows:

\providecommand{\newoperator}[3]{%
  \newcommand*{#1}{\mathop{#2}#3}}

Here is an example that defines \FD as an operator:

\newoperator{\FD}{\mathrm{FD}}{\nolimits}
share|improve this answer
add comment

If you need use this new operator only one time, maybe you could considere use

\text{operator}

in the math formula.

For example:  $$ 3 \cdot \text{FoO} (x) $$
share|improve this answer
2  
Welcome to TeX.SX. A tip: If you indent lines by 4 spaces, then they're marked as a code sample. You can also highlight the code and click the "code" button ({}) or hit Ctrl+K. You may want to have a look to Why is [ … ] preferable to $$ … $$? to better typeset equations. –  Claudio Fiandrino Nov 27 '13 at 15:13
1  
this won't always set the specified string in roman type; if it's within an italicized theorem environment, it will come out in italics. also, it won't accommodate limits correctly, if such are needed, and the spacing won't be quite the same as for a "real" operator. –  barbara beeton Nov 27 '13 at 15:27
    
Thank you, @Claudio Fiandrino. I'm reading your link now. –  Vitor Lima Nov 27 '13 at 18:54
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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