does any know how I can create a command that places a symbol given as an argument inside \cup?

For instance, the command \uplus has the symbol '+' inside \cup. I would like to be able to place any given symbol inside \cup (in special, the letter 'k'). An important issue is that the size of the symbol must respect the superscript math mode. Actually, the size of this symbol has to be a bit smaller, so as is '+' inside \cup in \uplus.

The figure below explains better what I am talking about.

enter image description here

I would like to obtain something similar to the second (from left to right) case.

Thanks in advance!


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}}}


$B^{\cupk} $


enter image description here

  • Only possible suggestion would be to change \stackMath declaration to \ensurestackMath{...}, so that current text/math stack setting is not perturbed by the macro. – Steven B. Segletes Nov 5 '18 at 1:17
  • I confess I had forgotten this command. I'll fix the code at once. Thanks! – Bernard Nov 5 '18 at 1:22
  • \ensurestackMath takes an argument, so you need to enclose everything that follows in braces...[at least that is the official syntax]. – Steven B. Segletes Nov 5 '18 at 1:46
  • Of course. I guess I was out of my mind… – Bernard Nov 5 '18 at 9:38

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.


    }{\fontsize{\demote@{#1}\dimexpr\f@size pt}{\z@}\selectfont\check@mathfonts
  \ifx#1\displaystyle 0.7
  \else\ifx#1\textstyle 0.7
  \else\ifx#1\scriptstyle 0.5
  \else 0.4\fi\fi\fi





enter image description here

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.