I want to create a symbol "\bulletplus" which is basically a plus symbol
with a bullet in middle. The symbol should have the same width and height as
an usual plus.
How do I create this using only latex commands?
(maybe with the help of tikz)
Best Answer
Version with scaled down bullet
The following example
centers the bullet on the plus sign,
respects the current math style, and
uses a scaled down version of the bullet, which can be configured by setting macro \bulletplusscale.
The symbol behaves as math binary operator as the plus sign.
Full example:
\documentclass{article}
\usepackage{graphicx}
\makeatletter
\newcommand*{\bulletplus}{%
\mathbin{%
\mathpalette\@bulletplus{}%
}%
}
\newcommand*{\@bulletplus}[2]{%
% #1: math style
% #2: unused (empty)
\sbox0{$#1+\m@th$}%
\sbox2{$#1\vcenter{}$}% math axis
\rlap{%
\hbox to \wd0{% centers the bullet in the space of the plus sign.
\hfil
% The bullet is moved to the base line, scaled, and
% moved back.
\raise\ht2\hbox{%
\scalebox{\bulletplusscale}{%
\lower\ht2\hbox{$#1\bullet\m@th$}%
}%
}%
\hfil
}%
}%
+%
}
\newcommand*{\bulletplusscale}{.6}
\makeatother
\begin{document}
\[ A \bulletplus B_{A \bulletplus B_{A \bulletplus B}}\]
\end{document}
I am not too sure what font to use for the internal + and -, so I just used \hbox{\texttt{+}}. In TeX, each character has a \mathcode, describing its behavious in maths. All of them lie between "0000 and "7FFF (in hexadecimal), except the special mathcode "8000, which makes the character act like an active character. Within the group which \bra, \ket and \braket define, I get + and - to be active and expand to \braket@inner@minus and \braket@inner@plus.
Best Answer
Version with scaled down bullet
The following example
centers the bullet on the plus sign,
respects the current math style, and
uses a scaled down version of the bullet, which can be configured by setting macro
\bulletplusscale
.The symbol behaves as math binary operator as the plus sign.
Full example:
Older version with
\bullet
in original size