I want to replace the circle in the symbol \circledast
by a square. But i did not find the right command. It seems that the packages stmaryrd
would help. But the package usually re-defines other basic symbols which is not desired.
The amssymb
package seems not define such a symbol. Is there anyone know how to define some command like \boxdast
or \squaredast
? Or how to avoid other changes by introducing packages that already defines \boxdast
or \squaredast
?
Best Answer
The following example composes
\boxast
from\Box
and*
and only needs packageamssymb
because of\Box
:Remarks:
Macro
\@boxit
assumes that the symbol to be boxed is centered around the math axis as some of the typical boxed symbols are (plus, minus, times, ast). Then the symbol is placed in the middle of the box. (There might be tiny deviations because glyph side bearings are not taken into account.)The reason for
\mathpalette
is to get the actual math style in order to match the size of the symbol according to the current math style.\m@th
removes\mathsurround
, because it should add space around the formula, not within, if\mathsurround
is set.Update: The font bounding box of
\Box
is a little too small in the height, therefore I have added a manual correction.The following file shows the font bounding boxes for
\Box
, first the unmodified font bounding box (red), then the corrected bounding box (green). (The larger width of the font bounding box does not matter, because the white space left and right seems to be the same and the symbol remains centered.)