6

I am typing some texts in Spanish, and I need to use the symbols for inverse and direct limits—\varprojlim and \varinjlim respectively. The problem is that these symbols look like "lim" with an arrow below, but I need "lím" with an accent over i. Is there an easy way to define something like that?

I think I found the definitions in the amsmath sources:

\def\varinjlim{%
  \mathop{\mathpalette\varlim@{\rightarrowfill@\textstyle}}\nmlimits@
}
\def\varprojlim{%
  \mathop{\mathpalette\varlim@{\leftarrowfill@\textstyle}}\nmlimits@
}

But I am not sure how to modify this properly.

Thank you for your help.

2 Answers2

8

You can solve it with a simple patch, which probably should be the default also for amsmath: Since babel-spanish already solves the problem for \lim, we can just use the command instead of the explicit lim in the definition of \varlim@.

\documentclass[a4paper]{article}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage[spanish]{babel}

\usepackage{amsmath}
\usepackage{etoolbox}

\makeatletter
\patchcmd{\varlim@}{lim}{\lim}{}{}
\makeatother

\begin{document}

$\displaystyle\lim\varinjlim\varprojlim$

\end{document}

enter image description here

This is the output after adding \usepackage[sc]{mathpazo}:

enter image description here

For “colimit”:

\documentclass[a4paper]{article}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage[spanish]{babel}
\usepackage[sc]{mathpazo}

\usepackage{amsmath}
\usepackage{etoolbox}

\DeclareMathOperator*{\colim}{co{\lim}}
\makeatletter
\patchcmd{\varlim@}{lim}{\lim}{}{}
\makeatother


\begin{document}

$\lim\colim\varinjlim\varprojlim$

\end{document}

enter image description here

egreg
  • 1,121,712
  • Wow, that really solves the problem, and I even don't have any issues with my exotic font (\usepackage[sc]{mathpazo}). Do you know how "lím" with an accent is defined properly? I want to copy that definition to have "colím". –  Dec 02 '16 at 13:18
  • 1
    @DonAlejo “I'm Mr. egreg, I solve problems”, see edit. – egreg Dec 02 '16 at 13:26
  • Thank you very much! It's a perfect solution and I am going to accept it. –  Dec 02 '16 at 14:00
1

You have to re-define \varlim@:

\documentclass[ a4paper, leqno]{article}

\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{lmodern}
\usepackage{amssymb, amsfonts, mathtools}

\makeatletter\def\varlim@#1#2{%
\vtop{\m@th\ialign{##\cr
\hfil$#1\operator@font l\'{i}m$\hfil\cr
\noalign{\nointerlineskip\kern1.5\ex@}#2\cr
\noalign{\nointerlineskip\kern-\ex@}\cr}}%
}
\makeatother

\begin{document}

\[ \varinjlim( E_{α},f_{α\,β}),\quad\varprojlim( E_{α},f_{β\,α}),\]%

\end{document}​ 

enter image description here

Bernard
  • 271,350
  • Thank you! That's probably a different question, but I use another font: I have \usepackage[sc]{mathpazo} in the preamble. This makes the accented letters disappear in math mode. How do I fix it? I tried \acute{\i}, but the dotless i is not displayed correctly. Something like \text{\rm l\'im} works, but it seems wrong (?) –  Dec 02 '16 at 12:52
  • Probably \operatorname{l\'im} is more correct. – Bernard Dec 02 '16 at 12:56
  • The accented letter disappears (but it's some issue with the font, I guess). –  Dec 02 '16 at 13:04
  • 3
    I'm not sure that four messages Command \' invalid in math mode per use of one of the commands is acceptable. – egreg Dec 02 '16 at 13:12
  • @egreg: I thought \operatorname made its argument typeset in textmode. I didn't have time to test it. – Bernard Dec 02 '16 at 18:46