14

Can anybody help in writing the following formula... I am having trouble. LHS I can write, but not the RHS.

enter image description here

1 Answer 1

15

You can use \DeclareMathOperator* from amsmath to declare an operator accepting "limits" in super/sub script positions:

\documentclass{article}
\usepackage{graphicx}
\usepackage{amsmath}
\usepackage{amssymb}

\DeclareMathOperator*{\MyS}{\text{\raisebox{-0.25ex}{\scalebox{1.25}{$\square$}}}}
\newcommand\Osq{\mathbin{\text{\scalebox{.84}{$\square$}}}}

\begin{document}

\[
G_1\Osq G_2\Osq \cdots \Osq G_n = \MyS_{i=1}^{n}G_i.
\]

\end{document}

enter image description here

As egreg comments, perhaps one could use \vcenter instead of an explicit dimension in the definition of \MyS; in this way, the square will be vertically centered with respect to the equal sign:

\documentclass{article}
\usepackage{graphicx}
\usepackage{amsmath}
\usepackage{amssymb}

\DeclareMathOperator*{\MyS}{\vcenter{\hbox{\text{\scalebox{1.3}{$\square$}}}}}
\newcommand\Osq{\mathbin{\text{\scalebox{.84}{$\square$}}}}

\begin{document}

\[
G_1\Osq G_2\Osq \cdots \Osq G_n = \MyS_{i=1}^{n}G_i.
\]

\end{document}

enter image description here

Notice also the use of \mathbin in the definition of \Osq to have the proper spacing for a binary operator.

9
  • 1
    even though the normal-sized box is baseline-aligned, setting the enlarged box on the baseline doesn't look right. shifting it down a bit (perhaps with the top aligned at cap height) would look much better. Commented Aug 8, 2013 at 18:36
  • @barbarabeeton Agreed. I lowered just a bit. I hope it's better now. Commented Aug 8, 2013 at 18:44
  • @barbarabeeton in fact, I also reduced the size of the square used as binary operator; I think it looks better this way. Commented Aug 8, 2013 at 19:02
  • 1
    Probably using \vcenter is better than using an explicit dimension: \vcenter{\hbox{\text{\scalebox{1.25}{$\square$}}}}
    – egreg
    Commented Aug 8, 2013 at 19:33
  • 1
    @GonzaloMedina Your 1.1pt will be used in all styles; probably an ex based dimension together with \text would be better.
    – egreg
    Commented Aug 8, 2013 at 20:08

You must log in to answer this question.

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