Place a given symbol inside \cup like \uplus
We need fully scalable fonts for this, so fix-cm
if the document is in the standard Computer Modern font. It is not necessary if other fonts are chosen.
\RequirePackage{fix-cm}
\documentclass{article}
\usepackage{amsmath}
\makeatletter
\DeclareRobustCommand{\vcup}[1]{%
\mathbin{\vphantom{\cup}\mathpalette\vcup@{#1}}%
}
\newcommand{\vcup@}[2]{%
\ooalign{%
$\m@th#1\cup$\cr
\hidewidth
\raisebox{%
\dimexpr\depth+\demote@{#1}\dimexpr1.5pt\relax\relax
}{\fontsize{\demote@{#1}\dimexpr\f@size pt}{\z@}\selectfont\check@mathfonts
$\m@th#2$}%
\hidewidth\cr
}%
}
\newcommand{\demote@}[1]{%
\ifx#1\displaystyle 0.7
\else\ifx#1\textstyle 0.7
\else\ifx#1\scriptstyle 0.5
\else 0.4\fi\fi\fi
}
\makeatother
\begin{document}
$A\vcup{k}B^{\vcup{k}}$
$\uplus\scriptstyle\uplus\scriptscriptstyle\uplus$
$\vcup{k}\scriptstyle\vcup{k}\scriptscriptstyle\vcup{k}$
$\vcup{y}\scriptstyle\vcup{y}\scriptscriptstyle\vcup{y}$
$\vcup{g}\scriptstyle\vcup{g}\scriptscriptstyle\vcup{g}$
\end{document}
The \stackinset
command from stackengine
can do that:
\documentclass[border = 2pt]{standalone}
\usepackage{stackengine} %
\newcommand\cupk{\ensurestackMath{\stackinset{c}{0ex}{c}{0.2ex}{\scriptscriptstyle k}{\scriptstyle\cup}}}
\begin{document}
$B^{\cupk} $
\end{document}