2

I am using a book as a reference for my modern geometry report. I cannot find the code for this symbol. What is it and where can I find codes for similar symbols, besides on Overleaf?

Enter image description here

2
  • 2
    Welcome to the TeX stackexchange! Can you share the title and author of the book, as well as the page number where you found this symbol?
    – Tommiie
    Feb 12 at 13:00
  • 6
    Suggestion: Edit the title of your question to be more specific so that other users looking for the same information may be able to find it in the future. Something like "How to make an overline with open circle endpoints"
    – Sandy G
    Feb 12 at 20:30

3 Answers 3

10

A different approach than my other answer using picture mode :-). Scales according to the current math style.

\documentclass{article}

\usepackage{pict2e,amsmath}% amsmath for scalable fraction rule thickness

\makeatletter
\newcommand*{\frac@rule}[1]{% width of frac rule in current math style
    \fontdimen8
    \ifx#1\displaystyle\textfont\else
    \ifx#1\textstyle\textfont\else
    \ifx#1\scriptstyle\scriptfont\else
    \scriptscriptfont\fi\fi\fi\thr@@\relax
}
\newcommand*{\math@ex}[1]{% ex in current math style
    \fontdimen5
    \ifx#1\displaystyle\textfont\else
    \ifx#1\textstyle\textfont\else
    \ifx#1\scriptstyle\scriptfont\else
    \scriptscriptfont\fi\fi\fi\tw@\relax
}
\newcommand*{\overObarO}[1]{\mathpalette\over@ObarO{#1}}
\newcommand*{\over@ObarO}[2]{%
   \begingroup
   \setbox\z@=\hbox{$\m@th#1#2\,$}%
   \unitlength\wd\z@
   \[email protected]\math@ex#1
   \setbox\tw@=\hbox{%
   \begin{picture}(\wd\z@,0)
   \linethickness{.8\frac@rule#1}
   \put(\dimen@,0){\circle{\dimen@}}
   \put(\unitlength-\dimen@,0){\circle{\dimen@}}
   \Line(1.5\dimen@,0)(\unitlength-1.5\dimen@,0)
   \end{picture}}
   \vbox{\offinterlineskip\box\tw@\kern\dimen@\box\z@}%
   \endgroup
}
\makeatother

\begin{document}

$\overObarO{A}\overObarO{AB}\overObarO{ABC}$\par
$\scriptstyle\overObarO{A}\overObarO{AB}\overObarO{ABC}$\par
$\scriptscriptstyle\overObarO{A}\overObarO{AB}\overObarO{ABC}$

\end{document}

enter image description here

9

As long as you don't need the symbol across math styles:

\documentclass{article}

\makeatletter
\newcommand*{\overObarO}[1]{%
   \vbox{%
      \@tempdima\fontdimen22\scriptscriptfont2
      \advance\@tempdima.2\p@
      \@tempdimb\@tempdima
      \advance\@tempdimb-.4\p@
      \ialign{%
         ##\cr
         $\m@th
         \scriptscriptstyle
         \circ\mkern-2mu
         \cleaders\hrule height\@tempdima depth-\@tempdimb\hfill
         \mkern-2mu\circ$\cr
         \noalign{\nointerlineskip\kern.2ex}%
         $\m@th\hfil#1\,\hfil$\cr
      }%
   }%
}
\makeatother

\begin{document}

$\overObarO{A}$
$\overObarO{AB}$
$\overObarO{ABC}$

\end{document}

enter image description here

Some numerical values of course depend on the used font.

1
  • Very nice.... +1
    – Sebastiano
    Feb 12 at 13:05
7

If you need more flexibility you can use TikZ:

enter image description here

No argument \mybar{AB} creates open circles. Empty argument \mybar[]{AB} creates closed ones. You can also make colors such as \mybar[red]{AB}.

\documentclass{article}

\usepackage{tikz}
\usetikzlibrary{arrows.meta}

\newcommand{\mybar}[2][open]{\tikz[baseline=(A.text)]{
    \node[inner xsep=0pt, inner ysep=2pt](A){$#2$};
    \draw[{Circle[#1, width=2.5pt, length=2.5pt]}-{Circle[#1, width=2.5pt, length=2.5pt]}](A.north west)--(A.north east);
}}

\begin{document}

The segment can be open \mybar{AB} or closed \mybar[]{AB}.

\end{document}

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .