I want to create an operator which looks exactly like one defined in the amsmath package. I've found the relevant definition in amsopn.sty, but when I copy it into the preamble of my document I get an error message Use of \varcolim doesn't match its definition. The code is below.
I also welcome suggestions on how better to do this. I'd rather use a "higher level" command to create my desired symbol, but I don't like what \newcommand\varinjcolim{\operatornamewithlimits{\underrightarrow{\mathrm{colim}}}} produces (its spacing isn't as tight as \varinjlim, and I'd really like it to be identical to that except from saying "colim" instead of "lim").
\documentclass{article}
\usepackage{amsmath}
\def\varcolim@#1#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}}%
}
\def\varinjcolim{%
\mathop{\mathpalette\varcolim@{\rightarrowfill@\textstyle}}\nmlimits@
}
\begin{document}
$\varinjlim$
$\varinjcolim$
\end{document}
\makeatletterto access commands with@in their name – David Carlisle Jan 06 '21 at 19:37