I would like to create math symbol similar to set Union (big U) where I can insert inside an arbitrary word or symbol (e.g. "foo"). Something along the lines of this solution: Is a cupdot symbol available in amsmath? but with any text instead of dot. Is it possible?
Asked
Active
Viewed 1,826 times
0
1 Answers
3
A possible solution with TikZ:
\documentclass{article}
\usepackage{amsmath}
\usepackage{tikz}
\newcommand{\uwithtext}[1]{\DOTSB\mathbin{\text{\tikz{%
\node (a) {#1};
\draw[black, rounded corners=1.2ex]
([yshift=-2pt]a.north west) -- (a.south west) -- (a.south east) -- ([yshift=-2pt]a.north east);}}}}
\begin{document}
\[
A \uwithtext{a} B \quad
X_{A \uwithtext{a} B} \quad
A \uwithtext{ab} B \quad
X_{A \uwithtext{ab} B} \quad
A \uwithtext{abp} B \quad
X_{A \uwithtext{abp} B}
\]
\end{document}
CarLaTeX
- 62,716
-
To enhance compatibility with the
amsmathpackage, you might want to add\DOTSBat the beginning of\uwithtext. – GuM Feb 01 '18 at 11:44 -
-
Yes, it’s in the correct place. You might want to have a look at how, say, the
\skullcommand is implemented in thehalloweenmathpackage (search the code for\newcommand*\skull. – GuM Feb 01 '18 at 17:04 -
@krokodil You're welcome! Thank you for accepting my answer and please don't eat ducks! :):):):) – CarLaTeX Feb 02 '18 at 05:53

\cdotwith\text{foo}should work. Not sure how good it will look like though as there is not much space in there. – Peter Grill Feb 01 '18 at 01:15\stackinsetfrom thestackenginepackage – and probably use it with\bigcup. – Bernard Feb 01 '18 at 01:37