[Tex/LaTex] Range symbol over character

symbols

How can I put a range symbol over a character?

The symbol I am looking for is similar to this:

\overleftrightarrow{T}

But instead of using an arrow at each end, I want to put a black dot at each end.

Best Answer

Here's an extensible version.

\documentclass{article}
\usepackage{amsmath}

\makeatletter
\newcommand{\range}{\mathpalette{\overarrow@\range@}}
\newcommand{\range@}{%
  \arrowfill@\leftrangebullet\relbar\rightrangebullet
}
\newcommand{\leftrangebullet}{\mathrel{\smallbullet}\joinrel\relbar}
\newcommand{\rightrangebullet}{\relbar\joinrel\mathrel{\smallbullet}}
\newcommand{\smallbullet}{%
  \vcenter{\hbox{$\m@th\scriptscriptstyle\bullet$}}%
}
\makeatother

\begin{document}

$\range{T}+\range{ABCD}$

\end{document}

enter image description here

Now also \leftrange and \rightrange:

\documentclass{article}
\usepackage{amsmath}

\makeatletter
\newcommand{\range}{\mathpalette{\overarrow@\range@}}
\newcommand{\leftrange}{\mathpalette{\overarrow@\leftrange@}}
\newcommand{\rightrange}{\mathpalette{\overarrow@\rightrange@}}
\newcommand{\range@}{%
  \arrowfill@\leftrangebullet\relbar\rightrangebullet
}
\newcommand{\leftrange@}{%
  \arrowfill@\leftrangebullet\relbar\relbar
}
\newcommand{\rightrange@}{%
  \arrowfill@\relbar\relbar\rightrangebullet
}
\newcommand{\leftrangebullet}{\mathrel{\smallbullet}\joinrel\relbar}
\newcommand{\rightrangebullet}{\relbar\joinrel\mathrel{\smallbullet}}
\newcommand{\smallbullet}{%
  \vcenter{\hbox{$\m@th\scriptscriptstyle\bullet$}}%
}
\makeatother

\begin{document}

$\range{T}+\range{ABCD}$

$\leftrange{T}+\leftrange{ABCD}$

$\rightrange{T}+\rightrange{ABCD}$

\end{document}

enter image description here