Can anybody help in writing the following formula... I am having trouble. LHS I can write, but not the RHS.
1 Answer
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}
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}
Notice also the use of \mathbin
in the definition of \Osq
to have the proper spacing for a binary operator.
-
1even 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. Aug 8, 2013 at 18:36
-
@barbarabeeton Agreed. I lowered just a bit. I hope it's better now. 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. Aug 8, 2013 at 19:02
-
1Probably using
\vcenter
is better than using an explicit dimension:\vcenter{\hbox{\text{\scalebox{1.25}{$\square$}}}}
– egregAug 8, 2013 at 19:33 -
1@GonzaloMedina Your
1.1pt
will be used in all styles; probably anex
based dimension together with\text
would be better.– egregAug 8, 2013 at 20:08