7

How can I place a symbol inside of \bigsqcup?

What I have tried is this:

\newcommand{\concn}{\bigsqcup_{i=1}^n\hspace{-1.07em}\text{\footnotesize $h$\normalsize\hspace{0.6em}}}

The problem ist that this only looks nice in an equation enviroment. When I use it inside of text, then my hspaces are no longer correct:

enter image description here

Is there a method to place the h inside of \bigsqcup which works in any environment?

3 Answers 3

4

A variation on Mathematical symbol for disjoint set union

\documentclass{article}

\makeatletter % \moverlay by D. Arsenau
\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{\bighsqcup}{\charfusion[\mathop]{\bigsqcup}{\innerh}}
\newcommand{\innerh}{\mathchoice
  {h}
  {\scriptstyle h}
  {\scriptscriptstyle h}
  {\scriptscriptstyle h}
}

\begin{document}
$\bighsqcup_{i=1}^n$
\[
\bighsqcup_{i=1}^n
\bigsqcup_{i=1}^n % for comparison
\]
\end{document}

enter image description here

6
  • 1
    +1 (of course) I used ooalign in my answer, using some of your previous work... Is there a reason you didn't go with it?
    – cmhughes
    Commented Jul 25, 2013 at 16:27
  • @cmhughes The \m@verlay macro is actually very similar to \ooalign (just a different setting of \lineskip). This macro by D. Arsenau can be found in the comprehensive list of symbols; so I use it without trying to change it into \ooalign.
    – egreg
    Commented Jul 25, 2013 at 16:34
  • @egreg OMG, I never would have tought it would be as difficult as that! ;-) Thanks!
    – lpdbw
    Commented Jul 25, 2013 at 17:01
  • @lpdbw Difficult? ;-)
    – egreg
    Commented Jul 25, 2013 at 17:03
  • 1
    @lpdbw Add \scriptstyle in the first argument to \mathchoice (where the single h is now) and change the \scriptstyle in the other three arguments to \scriptscriptstyle; you won't be using the symbol in second level sub/superscripts, I hope.
    – egreg
    Commented Jul 26, 2013 at 8:37
4

Here's an option using ooalign; I wonder if there's a reason that egreg didn't use it- if he tells me to delete this answer, I will :)

screenshot

The de facto reference on this site for ooalign is egreg's answer to \subseteq + \circ as a single symbol ("open subset") but you'll see it used in various answers.

% arara: pdflatex
% !arara: indent: {overwrite: yes}
\documentclass{article}
\usepackage{amsmath}

\DeclareMathOperator*{\bighsqcup}{%
    \mathchoice%
    {% displaystyle
        \ooalign{$\displaystyle\bigsqcup_{i=1}^n$\cr
            \hidewidth{\footnotesize $h\mkern2mu$}
    }}
    {% textstyle
        \ooalign{$\textstyle\bigsqcup_{i=1}^n$\cr%
            \hidewidth{\footnotesize $h\mkern25mu$}
    }}
    {% scriptstyle
        \ooalign{$\scriptstyle\bigsqcup_{i=1}^n$\cr%
            \hidewidth{\tiny $h\mkern24mu$}
    }}
    {% scriptscriptstyle
        \ooalign{$\scriptstyle\bigsqcup_{i=1}^n$\cr%
            \hidewidth{\tiny $h\mkern24mu$}
    }}
}

\begin{document}

$\bighsqcup_{\bighsqcup}$

\[
    \bighsqcup
\]

\end{document}
0

Of course, you can tweak the \hspace values in the \mathchoices to better match the centering.

\documentclass{article}
\usepackage{amsmath}
\usepackage{stackengine}
\def\stacktype{L}
\newlength\cupsize
\DeclareMathOperator*{\foo}{\bigsqcup}
\newcommand\filledcup[3]{%
\mathchoice%
{%
    \stackengine{0pt}{$\displaystyle\foo_{#2}^{#3}$}%
      {$\displaystyle #1$}{O}{c}{F}{T}{L}%
}{%
    \setlength\cupsize{\widthof{$\textstyle\bigsqcup$}}
    \stackengine{0pt}{$\textstyle\foo_{#2}^{#3}$}%
      {$\textstyle\hspace{.13\cupsize}#1$}{O}{l}{F}{T}{L}%
}{%
    \setlength\cupsize{\widthof{$\scriptstyle\bigsqcup$}}
    \stackengine{0pt}{$\scriptstyle\foo_{#2}^{#3}$}%
      {$\scriptstyle\hspace{.13\cupsize}#1$}{O}{l}{F}{T}{L}%
}{%
    \setlength\cupsize{\widthof{$\scriptscriptstyle\bigsqcup$}}
    \stackengine{0pt}{$\scriptscriptstyle\foo_{#2}^{#3}$}%
      {$\scriptscriptstyle\hspace{.08\cupsize}#1$}{O}{l}{F}{T}{L}%
}%
}
\begin{document}
\centering
This is inline: \( \filledcup{h}{i=1}{n} U_i \)
\[ \filledcup{h}{i=9991}{n} U_i \]
\[ A_{\filledcup{h}{i=1}{n} U_i} \]
\[ \scriptscriptstyle \filledcup{h}{i=1}{n} U_i \]
\end{document}

enter image description here

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .