By amsmath
’s default (more specifically, amsopn
):
- The starred version
\DeclareMathOperator*
creates a large operator which places subscript/superscript like \sum
and \lim
; that is, below/above in display math while, lower-/upper-right in inline math.
- The non-starred version
\DeclareMathOperator
creates a large operator which places subscript/superscript like \sin
and \log
; that is, always lower-/upper-right.
So, if you want a \sum
that 1) always puts scripts on the right and 2) is always in \textstyle
(the latter being the tricky part), you can simply do
\DeclareMathOperator{\mysum}{\textstyle\sum}% <- The effect of \textstyle is local!
Okay, the “scripts always below/above” part is the actual tricky part, and you want the operator to always be in \displaystyle
(the latter is questionable in your current setting, so I’ll give two different approaches).
Update: I will use a macro \mustlimits@
, which mirrors \nolimits@
from amsopn
, in the following solutions. Since the macro name contains @
, the following code snippets should be wrapped inside \makeatletter ... \makeatother
.
You just want \limits
and don’t actually want \displaystyle
. Since \lim
is essentially just Roman text, it comes with only one style. To force below/above scripts, simply do
\newcommand{\mylim}{\lim\mustlimits@}
You do want \displaystyle
(although \lim
has only one style!). Well, as you wish:
\newcommand{\mydisplaylim}{%
\mathop{\hbox{$\displaystyle\m@th\operator@font lim$}}\mustlimits@
}
\newcommand{\mydisplaysum}{%
\mathop{\displaystyle\sum}\mustlimits@
}
So what is \mustlimits@
exactly? Here is its definition:
\newcommand*{\mustlimits@}{\@ifnextchar\nolimits{\limits\@gobble}{\limits}}
MWE:
\documentclass[12pt]{letter}
\usepackage{amsmath,amssymb,amsthm}
\DeclareMathOperator{\mysum}{\textstyle\sum}% <- The effect of \textstyle is local!
\makeatletter
\newcommand{\mylim}{\lim\mustlimits@}
\newcommand{\mydisplaylim}{%
\mathop{\hbox{$\displaystyle\m@th\operator@font lim$}}\mustlimits@
}
\newcommand{\mydisplaysum}{%
\mathop{\displaystyle\sum}\mustlimits@
}
\newcommand*{\mustlimits@}{\@ifnextchar\nolimits{\limits\@gobble}{\limits}}
\makeatother
\begin{document}
$\mylim_{n\to\infty} x_n = \lim_{n\to\infty} x_n$
\begin{equation*}
\mysum_{n=1}^\infty x_n = \sum_{n=1}^\infty x_n
\end{equation*}
$\mydisplaylim_{n\to\infty} x_n = \lim_{n\to\infty} x_n$
$\mydisplaysum_{n=1}^\infty x_n = \sum_{n=1}^\infty x_n$
\end{document}
Added: As @DavidCarlisle pointed out in the comments, \mylim
and \mydisplaylim
will very likely increase line spacing. I would not recommend using any of \mylim
, \mysum
, \mydisplaylim
or \mydisplaysum
.
style
s with\limits
/\nolimits
placements of sub-/superscripts. For the\sum
, does\DeclareMathOperator{\mysum}{\textstyle\sum}
help?\displaystyle\sum_{n=1}^\inft
is rather odd as where it is used in an equation it does nothing as the expression is displaystyle anyway, and if you used it in an inline expression it would make the entire following expression displaystyle not just the\sum
\lim
"doesn't take too much vertical space"? It does take too much vertical space for the intended use of inline math mode: fitting in a line of a paragraph without increasing the linespacing.