[Tex/LaTex] Merging Symbols in Mathmode

math-modesymbols

I want to create boxes (\Box) and diamonds (\Diamond) with letter and other symbols insider them.
I've achieved something, but the result is ok-ish:

$\Box \!\!\! _ {^{_ {^{_{^a}}}}}$
$\Diamond \!\!\! _ {^{_ {^{_{^a}}}}}$
$\Box\!\!\! _{^{ _{^\heartsuit}}}$

Does anyone have a good tip to make it looks better?

Best Answer

A simple solution for single characters in the box and diamond. Play around with the setting \setlength\fboxsep{2pt} inside macros

\documentclass[a5paper,12pt]{article}
\usepackage{amssymb,graphicx}
\def\CBox#1{\fbox{$\scriptstyle#1$}}
\def\DBox#1{\rotatebox[origin=c]{45}{\fbox{\rotatebox[origin=c]{-45}{$#1$}}}}
\begin{document}

$\CBox{a}$
$\DBox{a}$

\end{document} 

enter image description here

Related Question