I am trying to obtain a black square with a subscript and a superscript in plain TeX. So far I managed to create $\buildrel abc \over\square$.

I could easily use nested \buildrels to achieve the desired result, but then, the font used for superscript is smaller than the one for the subscript, because what TeX sees is a "superscript" above \square above "subscript".

How can I solve this? For example, how does TeX implement the \sum macro with superscript and subscript that are equally scaled?



This should be declared as a \mathop; here is an implementation where the symbol is as high as a summation symbol.

% define the extension font also in smaller sizes (not relevant to the problem)
\font\fiveex=cmex7 scaled 714


% \squareop is a math operator like \sum

    \hbox to\square@size{#1}{%
      \vrule height \square@size{#1}%

% here we define the size of the square
  \ifx#1\displaystyle 14pt \fi
  \ifx#1\textstyle 10pt \fi
  \ifx#1\scriptstyle 7pt \fi
  \ifx#1\scriptscriptstyle 5pt \fi



enter image description here


TeX has the following math "styles":

  • \textstyle, which is the default style for inline maths ($...$);
  • \displaystyle, which is the default style for display maths ($$...$$), which is roughly the same as \textstyle, except \mathop atoms such as the \sum get the \limits after them so that the limits are displayed straight above/below the atoms;
  • \scriptstyle for first level of sub-/superscripts which by default is cmr7; and
  • \scriptscriptstyle for second level of sub-/superscripts which by default is cmr5.

It's not clear to me what is your goal here, so maybe you are after \square which is a \mathrel atom which has limits (so needs to be a \mathop atom, too), you could do


and use it with $A \relsquare xy B.

You can always change the active style explicitly:

\buildrel\displaystyle abc\over{\scriptscriptstyle\square}

By the way, \square is not defined in plain.

  • Thanks for further inside. \square is my own macro, maybe I should have stressed it out.
    – David
    Nov 25 '14 at 21:59

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.