The default limit operator displays “lim” with a small l. I wish to redefine it to display “Lim” that is, with a capital L like shown below.
3 Answers
You can add \ShowCommand\lim
to your preamble to see the definition of \lim
. It'll show
> \lim=robust macro:
->\protect \lim .
> \lim =\long macro:
->\mathop {\operator@font lim}.
<argument> \lim
l.3 \ShowCommand\lim
You can then define something similar for \Lim
or redefine \lim
accordingly:
\makeatletter
\NewDocumentCommand{\Lim}{}{\mathop{\operator@font Lim}}% Similar to \lim
\RenewDocumentCommand{\lim}{}{\mathop{\operator@font Lim}}% Replace \lim (lim -> Lim)
\makeatother
Note that this default definition differs from how its defined by other packages. For example, with amsmath
, the definition is
> \lim=\protected macro:
->\qopname \relax m{lim}.
<argument> \lim
l.4 \ShowCommand\lim
where \qopname
takes 3 arguments, the first of which is the operator text. You could
\NewDocumentCommand{\Lim}{}{\qopname{\relax}{m}{Lim}}
\RenewDocumentCommand{\lim}{}{\qopname{\relax}{m}{Lim}}
Best would be to use other tools (like mathtools
), which help you define operators in a natural way:
\usepackage{mathtools}
\let\lim\relax% Remove existing \lim definition
\DeclareMathOperator*{\lim}{Lim}% (Re)define \lim
\DeclareMathOperator*{\Lim}{Lim}% Define \Lim
Here's a complete minimal example:
\documentclass{article}
%\ShowCommand\lim
%\makeatletter
%\NewDocumentCommand{\Lim}{}{\mathop{\operator@font Lim}}
%\RenewDocumentCommand{\lim}{}{\mathop{\operator@font Lim}}
%\makeatother
\usepackage{mathtools}
\let\lim\relax
\DeclareMathOperator*{\lim}{Lim}
\DeclareMathOperator*{\Lim}{Lim}
\begin{document}
\[
\lim_{n \rightarrow \infty} S_n
\qquad
\Lim_{n \rightarrow \infty} S_n
\]
\end{document}
You can either define a new \Lim
or redefine the existing \lim
. Both are shown in this MWE.
\documentclass{article}
\usepackage{mathtools}
\DeclareMathOperator*{\Lim}{Lim}
\let\lim\relax
\DeclareMathOperator*{\lim}{Lim}
\begin{document}
$ \lim_{n\rightarrow\infty} S_n = \Lim_{n\rightarrow 0} Z_n$
\[ \lim_{n\rightarrow\infty} S_n = \Lim_{n\rightarrow 0} Z_n\]
\end{document}
The simplest way is to use amsmath
(of course you already have it in a math document) and do
\renewcommand{\lim}{\operatorname*{Lim}}
This is (slightly) less efficient than doing
\let\lim\relax %%% undefine \lim
\DeclareMathOperator*{\lim}{Lim}
See also How to redefine a command using \DeclareMathOperator
Another strategy is, of course, to do
\DeclareMathOperator*{\Lim}{Lim}
and to use \Lim
.
\usepackage{mathtools} \DeclareMathOperator*{\Lim}{Lim}
. If you prefer to redefine the original,\let\lim\relax \DeclareMathOperator*{\lim}{Lim}