# Best way to write $\lim^1$

The expression $\lim^1$ is often used in homological algebra, where the superscript always appears on the top-right of the \lim-term, never immediately above it. I run into issues when I want to typeset this term, but also with a subscript indicating the index the limit is being taken over.

I could not find a satisfactory way to typeset this. Ideally, I'd like to have two ways to typeset lim^1: one for displaystyle and one for textstyle. The textstyle version should render the same as $\lim_n^1$. The trouble is, ideally I'd have one command for this operation, say \limder, but defining this via something like \DeclareMathOperator{\limder}{\lim^1} would yield a faulty spacing on the subscript (in text mode):

The display style should render the index underneath the limit, but centered underneath the word "lim" (i.e., as if the superscript ^1 weren't there). I tried to use option 5 from this answer, but that makes the index center underneath the entire expression instead of just under the lim-term:

\mathop{\lim\nolimits^1}

renders

How would I find a way to typeset both of these correctly? I suppose that with \mathchoice I could merge two separate commands, one for display and the other for textstyle, so two separate commands as solutions would solve the problem.

\documentclass{article}
\usepackage{mathtools}
\NewDocumentCommand\limder{e{_}}{\mathchoice
{\lim  \IfValueT{#1}{_{\mathclap{#1}}}{}^{\!1\!}\mathop{}}
{\lim^1  \IfValueT{#1}{_{#1}}}
{\lim^1  \IfValueT{#1}{_{#1}}}
{\lim^1  \IfValueT{#1}{_{#1}}}}
\begin{document}
\parskip 1em
$\displaystyle\limder x$

$\displaystyle\limder_{n} x$

$\displaystyle\limder_{n\rightarrow\infty} x$

$\limder x$

$\limder_{n} x$

$\limder_{n\rightarrow\infty} x$
\end{document}

• I accepted this solution over the others, because this one results in a command which resembles \lim in every way. The others all had a little difference of some sort. Apr 5 at 14:12

Something like this?

\documentclass{article}
\usepackage{amsmath} % for '\DeclareMathOpertor*' macro
\DeclareMathOperator*{\limone}{lim^{\rlap{\scriptsize 1}}}
\begin{document}
$\limone_{n\to\infty} x_n \quad \displaystyle \limone_{n\to\infty} x_n$
\end{document}
• There are spacing issues in displaystyle if the subscript is too short. For example, \limone_n x_n. Apr 2 at 17:50
• There is another downside to this solution I'm afraid. When using this in a theorem environment (where all text is put in italics), the superscript 1 appears in italics also. I'm sure that's easy to fix though. Apr 5 at 14:13
• @SvanN - "I'm sure that's easy to fix though." Absolutely. Just change \scriptsize 1 to \scriptsize\upshape 1.
– Mico
Apr 5 at 16:11

You can use \sideset when in display style.

\documentclass{article}
\usepackage{amsmath}

\NewDocumentCommand{\derlim}{me{_}}{%
\mathchoice{\derlimdisplay{#1}{#2}}%
{\lim^{#1}\IfValueT{#2}{_{#2}}}%
{\lim^{#1}\IfValueT{#2}{_{#2}}}%
{\lim^{#1}\IfValueT{#2}{_{#2}}}%
}
\NewDocumentCommand{\derlimdisplay}{mm}{%
\!\sideset{}{^{#1}}\lim\IfValueT{#2}{_{#2}}%
}

\begin{document}

\begin{align*}
0&\to\lim_n x_n \\
0&\to\derlim{1}_n x_n \\
0&\to\derlim{11}_n x_n \\
&\to\smash{\kern-0.1pt\vrule height 2.5cm width 0.1pt} % just to show the alignment
\end{align*}

$\derlim{1}_{n} F \\$
\begin{center}% text style
$\derlim{1}_{n} F$
\end{center}

\end{document}

• This does what I want, however, upon close inspection, it acts a little differently from the usual \lim. My testcase was to compare (in a display mode) 0 \to \lim_n x_n and 0 \to \derlim{1}_n x_n, and there is a spacing difference: there is a larger space between the arrowhead and \derlim than with \lim. Apr 5 at 14:15
• @SvanN There was an added thin space to take care of. Apr 5 at 14:29