2

I'm trying to insert a line segment symbol but I'm unable to find the correct "arrow" to use with

\buildrel \SEGMENT_ARROW \over AB.

Tanks in advance.

EDIT: I'm trying to achieve something like this

enter image description here

2

2 Answers 2

4

Recycling my code at https://tex.stackexchange.com/a/294539/4427

\documentclass{article}
\usepackage{amsmath}
\usepackage{stmaryrd}

\makeatletter
\newcommand{\segment}[1]{%
  \mathord{\vbox{\offinterlineskip\m@th
    \ialign{##\cr
      $\m@th\scriptscriptstyle{\mapstochar\relbar}
       \leaderbar
       {\relbar\mkern-1mu\mapsfromchar}$\cr
      $\m@th#1$\cr
    }%
  }}%
}

\newcommand{\leaderbar}{%
  \mkern-7mu
  \cleaders\hbox{$\scriptscriptstyle\mkern-2mu{\relbar}\mkern-2mu$}\hfill
  \mkern-7mu
}
\makeatother

\begin{document}

$\segment{AB}$

\end{document}

enter image description here

4

EDITED to handle smaller math styles. Rule thickness is based on \fboxrule, but reduced for smaller math sizes.

\documentclass{article}
\usepackage{tabstackengine,scalerel}
\makeatletter
\def\m@scaleD{1}
\def\m@scaleT{1}
\def\m@scaleS{\scriptstyleScaleFactor}
\def\m@scales{\scriptscriptstyleScaleFactor}
\def\Mscale{\csname m@scale\m@switch\endcsname}
\makeatother
\newcommand\vstroke{\rule[\dimexpr-1.4\LMpt+.1pt\relax]{\fboxrule}{3\LMpt}}
\newcommand\flatarrow[1]{%
  \ThisStyle{\ensurestackMath{\tabbedstackon[1\LMpt]{\SavedStyle#1}%
    {\fboxrule=\Mscale\fboxrule\relax%
    \SavedStyle\rlap{\vstroke}\TABrule\llap{\vstroke}}}}%
}
\begin{document}
$\flatarrow{AB}\quad\flatarrow{xyz}$\par
$\scriptstyle\flatarrow{AB}\quad\flatarrow{xyz}$\par
$\scriptscriptstyle\flatarrow{AB}\quad\flatarrow{xyz}$
\end{document}

enter image description here

You must log in to answer this question.

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