How do I do dot inside a letter?
It's among the worst notation I have ever seen.
If you really want it, at least do it right, with the dot in the middle of the D.
\documentclass{article}
\usepackage{amsmath}
\usepackage{xparse}
\usepackage{mathpazo}
\NewDocumentCommand{\disk}{smm}{%
\IfBooleanTF{#1}{\puncturedD}{D}[#2,#3]%
}
\makeatletter
\newcommand{\puncturedD}{{\vphantom{D}\mathpalette\punctured@D\relax}}
\newcommand{\punctured@D}[2]{%
\sbox\z@{$\m@th#1D$}
\ooalign{%
$\m@th#1D$\cr
\noalign{\punctured@adj{#1}}
\hidewidth$\m@th#1\mkern1mu\cdot$\hidewidth\cr
}%
}
\newcommand{\punctured@adj}[1]{%
\kern\dimexpr\fontdimen22
\ifx#1\displaystyle\textfont\else
\ifx#1\textstyle\textfont\else
\ifx#1\scriptstyle\scriptfont\else
\scriptscriptfont\fi\fi\fi 2
-\ht\z@/2\relax
}
\makeatother
\begin{document}
\begin{gather}
\disk*{z_0}{R}=
\{z\in\mathbb{C}:0<\lvert z-z_0\rvert<R\}=
\disk{z_0}{R}\setminus\{z_0\}
\\
\disk*{0}{1} \scriptstyle \disk*{0}{1} \scriptscriptstyle \disk*{0}{1}
\end{gather}
\end{document}
The only “manual” adjustment is \mkern1mu
to shift the dot a bit to the right. The amount of shifting depends on the font and the shape of the D, so it cannot be made automatic.
A more complete version with syntax support also for the closed disk.
\documentclass{article}
\usepackage{amsmath}
\usepackage{xparse}
\usepackage{mathpazo}
\NewDocumentCommand{\disk}{st-mm}{%
\IfBooleanTF{#1}{\puncturedD}{%
\IfBooleanTF{#2}{\,\overline{\!D\!}\,}{D}%
}%
[#3,#4]%
}
\makeatletter
\newcommand{\puncturedD}{{\vphantom{D}\mathpalette\punctured@D\relax}}
\newcommand{\punctured@D}[2]{%
\sbox\z@{$\m@th#1D$}
\ooalign{%
$\m@th#1D$\cr
\noalign{\punctured@adj{#1}}
\hidewidth$\m@th#1\mkern1mu\cdot$\hidewidth\cr
}%
}
\newcommand{\punctured@adj}[1]{%
\kern\dimexpr\fontdimen22
\ifx#1\displaystyle\textfont\else
\ifx#1\textstyle\textfont\else
\ifx#1\scriptstyle\scriptfont\else
\scriptscriptfont\fi\fi\fi 2
-\ht\z@/2\relax
}
\makeatother
\begin{document}
\begin{gather}
\disk{z_0}{R}=
\{z\in\mathbb{C}:\lvert z-z_0\rvert<R\}
\\
\disk-{z_0}{R}=
\{z\in\mathbb{C}:\lvert z-z_0\rvert\le R\}
\\
\disk*{z_0}{R}=
\{z\in\mathbb{C}:0<\lvert z-z_0\rvert<R\}=
\disk{z_0}{R}\setminus\{z_0\}
\\
\disk*{0}{1} \scriptstyle \disk*{0}{1} \scriptscriptstyle \disk*{0}{1}
\end{gather}
\end{document}
The advantage of having a unified syntax is that if, for instance, you decide for \dot{D}
instead of \puncturedD
, you can just change the call in the definition of \disk
.
A simple \stackinset
with a scalerel
wrapper thrown around it will support the smaller math styles.
\documentclass{article}
\usepackage{stackengine,scalerel}
\newcommand\dotD{\ThisStyle{\ensurestackMath{%
\stackinset{c}{.7\LMpt}{c}{-.2\LMpt}%
{\SavedStyle\cdot}{\SavedStyle D}}}}
\begin{document}
\[
x\dotD\scriptstyle\dotD\scriptscriptstyle\dotD
\]
\end{document}