# New command for filtered colimits and limits

I would like to define a new command (called colim) for filtered colimit (also sometimes called direct limit ...) as nice as the command $\varinjlim$ in amsmath package.

So far, I tried $\newcommand{\colim{\operatornamewithlimits{\underset{\longrightarrow{colim}}$

but I find the arrow too thin and its positioning too low compare to $\varinjlim$. How can I get exactly the same (and centered) arrow than this command ?

Edit: with the answer of egreg, it is easy to also get a new command for filtered limit obviously (called colim with a leftarrow below)

Adapt the definition of \varinjlim:

\documentclass{article}
\usepackage{amsmath}

\makeatletter
\newcommand{\colim@}[2]{%
\vtop{\m@th\ialign{##\cr
\hfil$#1\operator@font colim$\hfil\cr
\noalign{\nointerlineskip\kern1.5\ex@}#2\cr
\noalign{\nointerlineskip\kern-\ex@}\cr}}%
}
\newcommand{\colim}{%
\mathop{\mathpalette\colim@{\rightarrowfill@\textstyle}}\nmlimits@
}
\makeatother

\begin{document}

$\colim_{\delta\in\Delta}F_\delta=F$

\end{document}


A variant, suggested by Manuel, with a smaller arrow. However, this also requires a redefinition of \varprojlim and \varinjlim for uniformity:

\documentclass{article}
\usepackage{amsmath}

\makeatletter
\newcommand{\colim@}[2]{%
\vtop{\m@th\ialign{##\cr
\hfil$#1\operator@font colim$\hfil\cr
\noalign{\nointerlineskip\kern1.5\ex@}#2\cr
\noalign{\nointerlineskip\kern-\ex@}\cr}}%
}
\newcommand{\colim}{%
\mathop{\mathpalette\colim@{\rightarrowfill@\scriptscriptstyle}}\nmlimits@
}
\renewcommand{\varprojlim}{%
\mathop{\mathpalette\varlim@{\leftarrowfill@\scriptscriptstyle}}\nmlimits@
}
\renewcommand{\varinjlim}{%
\mathop{\mathpalette\varlim@{\rightarrowfill@\scriptscriptstyle}}\nmlimits@
}
\makeatother

\begin{document}

$\colim_{\delta\in\Delta}F_\delta \quad \varinjlim_{\delta\in\Delta}F_\delta \quad \varprojlim_{\delta\in\Delta}F_\delta$

\end{document}


• as usual, fast & to the point ! – brunoh Dec 20 '15 at 22:49
• I personally think that the arrow is too big, may be adding \scriptstyle before \rightarrowfill helps smoothing it. – Manuel Dec 20 '15 at 22:49
• @Manuel I'll add the variant – egreg Dec 20 '15 at 22:50
• @Manuel thank you. But I want it to look & feel exactly the same way than the varinjlim command which is what egreg delivered. I will wait to see the variant just in case – brunoh Dec 20 '15 at 22:54
• @brunoh I added redefinitions for the \var...lim commands. Take your pick. – egreg Dec 20 '15 at 23:00