13

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):

faulty subscript spacing

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

incorrect horizontal alignment

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.

8
\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}

enter image description here

1
  • 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.
    – SvanN
    Apr 5 at 14:12
8

Something like this?

enter image description here

\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}
3
  • 3
    There are spacing issues in displaystyle if the subscript is too short. For example, \limone_n x_n.
    – Sandy G
    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.
    – SvanN
    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
8

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}

enter image description here

2
  • 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.
    – SvanN
    Apr 5 at 14:15
  • @SvanN There was an added thin space to take care of.
    – egreg
    Apr 5 at 14:29

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.