I would like to increase the spacing of the lower limit of \lim command, such as:
The default (first) does not have enough space between the $x$ and the $c$, the second is what I would like it to look like, currently I use the space \; command to put this space in, but is there a better way to do this?
- 757,742
- 680
3 Answers
TeX doesn't space relation symbols when in subscripts or superscripts.
You can modify the behavior for the case at hand by making TeX into thinking that it's typesetting text style.
\documentclass{article}
\usepackage{amsmath}
\makeatletter
\RenewDocumentCommand{\lim}{e{}}{%
\qopname\relax m{lim}%
\IfValueT{#1}{{\text{\m@th\thickmuskip=3mu $#1$}}}%
}
\makeatother
\begin{document}
[
\lim_{x\to c} f(x)
]
\end{document}
The standard value of \thickmuskip is 5mu, which seems too much here, so I locally reduce it to 3mu. Make experiments to see what's the best for you.
The strange concoction \qopname\relax m{lim} is how \lim is defined by amsmath.
A way to do several operators at once can be as follows:
\documentclass{article}
\usepackage{amsmath}
\usepackage{etoolbox}
\ExplSyntaxOn
\NewDocumentCommand{\changebigoperators}{m}
{
\clist_map_inline:nn { #1 }
{
\exp_args:Nc \appto { ##1 } { \addspacelimits }
}
}
\ExplSyntaxOff
\NewDocumentCommand{\addspacelimits}{e{^}}
{%
\IfValueT{#1}{{\wrap{#1}}}%
\IfValueT{#2}{^{\wrap{#2}}}%
}
\NewDocumentCommand{\wrap}{m}
{%
\text{\mathsurround=0pt\thickmuskip=3mu$#1$}%
}
\changebigoperators{sum,prod,lim}
\begin{document}
\begin{gather}
\sum_{i=1}^n\dots\prod_{k=1}^n \
\lim_{x\to c}f(x)
\end{gather}
\end{document}
- 1,121,712
-
Thank you! Can this be extended to sums and products, for example? How would I change the limits on \sum? – btshepard Nov 18 '21 at 08:16
-
1@bshepard I added a general way. – egreg Nov 18 '21 at 12:01
-
Thank you so much! – btshepard Nov 20 '21 at 17:36
I think your solution is probably the best. The rationale is this
\lim{constraint} F(x)
The constraint is not parameterized by \lim It's your constraint, so it would be overwhelming for \lim to have assumptions built in that there's a variable then a symbol then another argument, etc..
Eg., if there was a variant of \lim, maybe \roomylim that worked as:
% Making this up...
\roomylimitspacer{\;}
% ...
\roomylim{x}{\to}{0} F(x)
Then it would be conceivable that the new macro could entertain settings to nudge x and 0 apart from the separator. But, I don't recall seeing a variant of \lim like that.
If you find that you're making repeated use of this idiom, then a \newcommand might be order for your document that embeds the roomy-separator.
I go with "LaTeX usually knows what to do, and when it doens't, then there's a fix." like the one you're thinking \; (if that's your preference for tiny bit of horizontal space, so be it.)
I found this related article.
Question about limits in lim command and scale in mathtools package
- 36
I believe the answer to your question is here: Arrows of arbitrary length
In fact if you consider the code given by AboAmmar you get:
\lim_{x\,\Arrow{.2cm}\,c}f(x)\qquad\lim_{x\,\Arrow{.4cm}\,c}f(x)


