# Combine two symbols to one fully scalable

I have to put a colon inside a bigcup symbol, so that the result is treated exactly like the latter.

I tried different approaches following various posts here and on other places. The best result until now is taking advantage of the package stackengine.

If I use the cup it works correctly, it really looks the same.

If I use the bigcup, on the other hand, the result is not correctly scaled, as you can see with the following code and the attached picture.

\documentclass[a4paper,10pt]{article}
\usepackage{stackengine}

\newcommand{\bigcupcolon}{\mathop{\ensurestackMath{\stackinset{l}{}{c}{+.25ex}{:}{\bigcup}}}}
\newcommand{\cupcolon}{\mathop{\ensurestackMath{\stackinset{l}{-.18ex}{c}{+0.1ex}{:}{\cup}}}}

\begin{document}
$\displaystyle\bigcup_{i\in I}S_i$\hspace{40pt}    $S_1\cup S_2$
\vspace{20pt}

$\displaystyle\bigcupcolon_{i\in I}S_i$\hspace{40pt}    $S_1\cupcolon S_2$

\end{document}


So the question is, how would you write such a symbol?

• Have a look at Heikos great answer: tex.stackexchange.com/questions/237780/… – Johannes_B May 6 '15 at 15:14
• off topic: what is the meaning of that union? – Sigur May 6 '15 at 15:18
• @sigur I use it to glue together things with two distinct special points and identifying this special points. It is similar to the coproduct of pointed sets, but with one more special point. – dadexix86 May 6 '15 at 15:53
• @dadexix86, thanks. In the case for two, is it a kind of quotient of the wedge $S_1\vee S_2$! – Sigur May 6 '15 at 15:55
• @sigur Yes, set-wise it looks exactly as doing it two times, but I am working with pointed monoid, so the two elements (the special point and the identity) behave rather differently. – dadexix86 May 6 '15 at 16:03

The problem is that stackengine does not explicitly preserve the math style (i.e., \textstyle or \displaystyle). Thus, while one could hardwire that or do a \mathchoice, here, I use the scalerel packages \ThisStyle{...\SavedStyle...} feature to save the math style and import it into the \stackinset.

In the MWE, I show \bigcupcolon in both math styles.

EDITED to make smaller dots in the regular cup, and EXTENDED to handle all math styles, including \scriptstyle and \scriptscriptstyle. (Note, though, that \bigcup does not appear to have a \scriptscriptstyle version.)

\documentclass[a4paper,10pt]{article}
\usepackage{stackengine,scalerel}
\newcommand{\bigcupcolon}{\mathop{\ThisStyle{%
\ensurestackMath{\stackinset{c}{-1.4pt}{c}{+.25\LMex}{:}{\SavedStyle\bigcup}}}}}
\newcommand{\cupcolon}{\mathop{\ThisStyle{%
\ensurestackMath{\stackinset{c}{.3\LMpt}{c}{-1\LMpt}{\SavedStyle^:}{\SavedStyle\cup}}}}}
\begin{document}
$\displaystyle\bigcup_{i\in I}S_i$\hspace{40pt}
$\bigcup_{i\in I}S_i$\hspace{40pt}
$S_1\cup S_2$
\vspace{20pt}

$\displaystyle\bigcupcolon_{i\in I}S_i$\hspace{40pt}
$\bigcupcolon_{i\in I}S_i$\hspace{40pt}
$S_1\cupcolon S_2$
\vspace{20pt}

$\scriptstyle\bigcupcolon_{i\in I}S_i$\hspace{40pt}
$\scriptscriptstyle\bigcupcolon_{i\in I}S_i$
\vspace{20pt}

$\scriptstyle S_1\cupcolon S_2$\hspace{40pt}
$\scriptscriptstyle S_1\cupcolon S_2$
\end{document}


• the same-sized colons don't really look so good. in particular, the colon in the regular-sized \cup looks oversized. i'd try both a regular and a bold colon in a smaller size (bold so that the "thickness" of the dots is in keeping with the thickness of the stroke forming the cup), then decide which looks better. – barbara beeton May 6 '15 at 15:30
• @barbarabeeton I'll have a look at that after lunch. – Steven B. Segletes May 6 '15 at 15:31
• This looks already amazing but yes, scaling the dot inside would be absolutely perfect! :D – dadexix86 May 6 '15 at 15:34
• @dadexix86 Please see revision. – Steven B. Segletes May 6 '15 at 16:42
• @barbarabeeton Employed a scripted colon in the regular-sized cup, and extended the solution for all math styles. – Steven B. Segletes May 6 '15 at 16:43

A solution based on https://tex.stackexchange.com/a/52673/4427

In the “binary” version, the colon is built by hand with small periods, because the ordinary colon would be too big in comparison with the cup symbol.

\documentclass{article}

\makeatletter
\def\moverlay{\mathpalette\mov@rlay}
\def\mov@rlay#1#2{\leavevmode\vtop{%
\baselineskip\z@skip \lineskiplimit-\maxdimen
\ialign{\hfil$\m@th#1##$\hfil\cr#2\crcr}}}
\newcommand{\charfusion}[3][\mathord]{%
#1{\ifx#1\mathop\vphantom{#2}\fi
\mathpalette\mov@rlay{#2\cr#3}%
}%
\ifx#1\mathop\expandafter\displaylimits\fi}
\makeatother

\newcommand{\ccolon}{\mathpalette\doccolon\relax}
\newcommand{\doccolon}[2]{%
\vcenter{%
\sbox8{$#1\mkern3.5mu$}%
\smash{$\scriptscriptstyle.$}%
\vskip\wd8
\smash{$\scriptscriptstyle.$}%
\vskip\ifdim\wd8<.15\normalbaselineskip.5\else.2\fi\wd8
}%
}

\newcommand{\cupcolon}{\charfusion[\mathbin]{\cup}{\ccolon}}
\newcommand{\bigcupcolon}{\charfusion[\mathop]{\bigcup}{:}}

\begin{document}

$\mbox{inline: }{\textstyle A_{X\cupcolon Y} \cupcolon B_{\bigcupcolon B_{j}}} \qquad \mbox{display: } \bigcupcolon_{i\in I} A_{i}$

\end{document}


• This look wonderful! :D Just one question, why would you use \mathbin and not \mathop in the inline version? – dadexix86 May 6 '15 at 15:58
• @dadexix86 I use \mathbin for the binary operation version. If you do $\bigcupcolon_{i\in I}A_i}$ you'll get the operator form (smaller than in display style). Just the same relationship as between \cup and \bigcup. – egreg May 6 '15 at 16:05
• I thought that also \cup was considered an operator. I read some documentation now and understand your code better. Thanks! :D – dadexix86 May 6 '15 at 16:11
• @dadexix86 It's common to find \cup_{i=1}^{n}, but it's wrong nonetheless. – egreg May 6 '15 at 16:22