I adapted \bunderline
from my answer (putting square brackets around the underline of a letter (in math mode)) at the cited question into \boverdot
. It works in all math styles.
\documentclass{article}
\usepackage{stackengine,graphicx,scalerel,amsmath}
\stackMath
\def\tinylb{\smash{\scalebox{.25}{$\SavedStyle[$}}}
\def\tinyrb{\smash{\scalebox{.25}{$\SavedStyle]$}}}
\def\bunderline#1{\ThisStyle{\setbox0=\hbox{$\SavedStyle#1$}\def\useanchorwidth{T}%
\stackunder[1.2pt]{\SavedStyle#1}{\tinylb\rule[.3\LMpt]{\wd0}{.4pt}\tinyrb}}}
\def\boverdot#1{\ThisStyle{\setbox0=\hbox{$\SavedStyle#1$}\def\useanchorwidth{T}%
\stackon[-1.2\LMpt]{\SavedStyle\dot#1}{\tinylb\rule[0.3\LMpt]{\wd0}{0pt}\tinyrb}}}
\let\overdot\dot
\begin{document}
$ a,\overdot{b},\boverdot{b},\overdot{g},\boverdot{g},
\overdot{i},\boverdot{i},d $
$ \scriptstyle
a,\overdot{b},\boverdot{b},\overdot{g},\boverdot{g},
\overdot{i},\boverdot{i},d $
$ \scriptscriptstyle
a,\overdot{b},\boverdot{b},\overdot{g},\boverdot{g},
\overdot{i},\boverdot{i},d $
\end{document}
To bring the brackets a bit closer, multiply \wd0
in the definition of \boverdot
by a value less than one, in this case .5
.
\documentclass{article}
\usepackage{stackengine,graphicx,scalerel,amsmath}
\stackMath
\def\tinylb{\smash{\scalebox{.25}{$\SavedStyle[$}}}
\def\tinyrb{\smash{\scalebox{.25}{$\SavedStyle]$}}}
\def\bunderline#1{\ThisStyle{\setbox0=\hbox{$\SavedStyle#1$}\def\useanchorwidth{T}%
\stackunder[1.2pt]{\SavedStyle#1}{\tinylb\rule[.3\LMpt]{\wd0}{.4pt}\tinyrb}}}
\def\boverdot#1{\ThisStyle{\setbox0=\hbox{$\SavedStyle#1$}\def\useanchorwidth{T}%
\stackon[-1.2\LMpt]{\SavedStyle\dot#1}{\tinylb\rule[0.3\LMpt]{.5\wd0}{0pt}\tinyrb}}}
\let\overdot\dot
\begin{document}
$ a,\overdot{b},\boverdot{b},\overdot{g},\boverdot{g},
\overdot{i},\boverdot{i},d $
$ \scriptstyle
a,\overdot{b},\boverdot{b},\overdot{g},\boverdot{g},
\overdot{i},\boverdot{i},d $
$ \scriptscriptstyle
a,\overdot{b},\boverdot{b},\overdot{g},\boverdot{g},
\overdot{i},\boverdot{i},d $
\end{document}
The non-centered dot above the g
is a function of special letter-specific kerning associated with the \dot
macro. The following avoids that problem by forcing the overdot to be centered over the letter.
\documentclass{article}
\usepackage{stackengine,graphicx,scalerel,amsmath}
\stackMath
\def\tinylb{\smash{\scalebox{.25}{$\SavedStyle[$}}}
\def\tinyrb{\smash{\scalebox{.25}{$\SavedStyle]$}}}
\def\bunderline#1{\ThisStyle{\setbox0=\hbox{$\SavedStyle#1$}\def\useanchorwidth{T}%
\stackunder[1.2pt]{\SavedStyle#1}{\tinylb\rule[.3\LMpt]{\wd0}{.4pt}\tinyrb}}}
\def\boverdot#1{\ThisStyle{\setbox0=\hbox{$\SavedStyle#1$}\def\useanchorwidth{T}%
\stackon[1.2\LMpt]{\SavedStyle#1}{%
\tinylb\smash{\raisebox{-1.8\LMpt}{\makebox[.5\wd0]{$\SavedStyle\cdot$}}}\tinyrb}}}
\let\overdot\dot
\begin{document}
$ a,\overdot{b},\boverdot{b},\overdot{g},\boverdot{g},
\overdot{\imath},\boverdot{\imath},d $
$ \scriptstyle
a,\overdot{b},\boverdot{b},\overdot{g},\boverdot{g},
\overdot{\imath},\boverdot{\imath},d $
$ \scriptscriptstyle
a,\overdot{b},\boverdot{b},\overdot{g},\boverdot{g},
\overdot{\imath},\boverdot{\imath},d $
\end{document}