这个问题是关于如何扩展@egreg 的精彩答案 https://tex.stackexchange.com/a/304078/103130
到以下情况(这与我需要的很接近,只是括号应该出现在点周围,并且括号应该更靠近一点):
\documentclass{article}
\usepackage{amsmath,graphicx}
\makeatletter
\newcommand\boverdot{}
\DeclareRobustCommand\boverdot[1]{\mathord{\mathpalette\b@dot{#1}}}
\newcommand{\b@dot}[2]{%
\sbox\z@{$\m@th#1\dot{#2}$}%
\raisebox{-\dp\z@}{\scalebox{.5}[.2]{$\m@th#1[$}}%
\copy\z@
\raisebox{-\dp\z@}{\scalebox{.5}[.2]{$\m@th#1]$}}%
}
\makeatother
\begin{document}
$a_{\boverdot{i}}$
\end{document}
有人知道该如何修复吗?谢谢
答案1
我改编\bunderline
自我的回答(在字母下划线处加上方括号(在数学模式下)) 到所引问题中\boverdot
。它适用于所有数学风格。
\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}
为了使括号更靠近一点,\wd0
在 的定义中乘以\boverdot
一个小于一的值,在本例中为.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}
上方的非中心点g
是与宏相关的特殊字母字距调整功能\dot
。以下通过强制将上点置于字母上方的中心来避免该问题。
\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}
答案2
这个解决方案对你也适用吗?它似乎简单得多,而且结果似乎是一样的。
\documentclass{article}
\usepackage{amsmath,graphicx}
\newcommand{\boverdot}[1]{\overset{\scalebox{.5}[.2]{$[$} \boldsymbol{.} \scalebox{.5}[.2]{$]$}}{#1}}
\begin{document}
$a_{\boverdot{i}}$
\end{document}