I'm trying to define a directed supremum operator in latex but I can't come up with something that would behave well in all situations. Here's what I've tried:
\documentclass{article}
\usepackage{amsmath}
\newcommand\dirup{\!{}^{\upset}}
\newcommand\upset{\ensuremath{\mathord{\uparrow}\mkern1mu}}
\begin{document}
$\mathop{\bigsqcup\dirup}_{i\in I}$
$$\mathop{\bigsqcup\dirup}_{i\in I}$$
$\mathop{\bigsqcup\dirup_{i\in I}}$
$$\mathop{\bigsqcup\dirup_{i\in I}}$$
$\mathop{\bigsqcup_{i\in I}}\dirup$
$$\mathop{\bigsqcup_{i\in I}}\dirup$$
\end{document}
In the first case, the subscripts are moved to right (in both math modes). In the second case, inline math mode works as expected but the display mode doesn't put the subscript below the supremum sign. Lastly the third case works as expected in display math mode but the inline math is broken because \dirup
is moved to the right.
Any ideas how to fix it? I'm fine with redefining \dirup
.
Edit:
Note that the operator should also behave well when the subscript is omitted, e.g. the following shouldn't display the set \{ a \}
too close to the supremum:
$\mathop{\bigsqcup\dirup} \{ a \}$
\[
…\]
preferable to$$
?