Everyone likes to use LaTeX for their documents. And everyone likes to use l as a variable. When writing formulas by hand it’s not much of a problem, but when typesetting, it is easy to confuse it with a 1:
l is not 1
It also looks kind of stupid in a TeXed document:

The code for this snippet is
\frac{{\rm d}f(l)}{{\rm d}l} = \lim_{\Delta l\rightarrow0}\frac{f(l+\Delta l) - f(l)}{\Delta l}
Let’s see how we can fix this…
Just some magic with catcodes and mathcodes (which are something like catcodes only for math). Also note how I added some space after the
\gdef\eLL{\ifnum\the\fam=-1
\ell\fi\ifnum\the\fam>-1
\mathcodel="716C{}l\fi}
{\catcodel=\active\gdefl{\eLL{}\hspace{0.2pt}}}
\mathcode`l="8000
\ell command to make it look slightly better.
See the result:
Note that the code has not changed:
\frac{{\rm d}f(l)}{{\rm d}l} = \lim_{\Delta l\rightarrow0}\frac{f(l+\Delta l) - f(l)}{\Delta l}

No Comment