![我怎样才能制作一条带有开放圆端点的上划线?](https://linux22.com/image/473768/%E6%88%91%E6%80%8E%E6%A0%B7%E6%89%8D%E8%83%BD%E5%88%B6%E4%BD%9C%E4%B8%80%E6%9D%A1%E5%B8%A6%E6%9C%89%E5%BC%80%E6%94%BE%E5%9C%86%E7%AB%AF%E7%82%B9%E7%9A%84%E4%B8%8A%E5%88%92%E7%BA%BF%EF%BC%9F.png)
我正在使用一本书作为我的现代几何报告的参考。我找不到这个符号的代码。它是什么?除了背页?
答案1
picture
与我使用模式的其他答案不同的方法:-)
。根据当前的数学风格进行缩放。
\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}
答案2
只要您不需要跨数学样式的符号:
\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}
当然,一些数值取决于所使用的字体。
答案3
如果您需要更多的灵活性,您可以使用 Ti钾Z:
没有参数\mybar{AB}
会创建开放的圆圈。空参数\mybar[]{AB}
会创建封闭的圆圈。您还可以创建颜色,例如\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}