[Tex/LaTex] How to write a formula using box product

math-modemath-operators

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

enter image description here

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

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.