4

The post Change arrow tip of \overleftarrow-Command tells me how to change the size of the tips of arrows generated with \overleftarrow and \overrightarrow. But how can I get a different tip all together?

Ideally, I would like a reversed arrow tip (like --< but not dashed) or small vertical lines for the tip of arrows on top of a letter based on \overleftarrow and \overrightarrow.

Kaira
  • 61

3 Answers3

3

I tried to use the code of these answers to come up with a solution for an inverted arrow. Note that this may look a bit strage if the text underneath is too short (only one letter, for example). Also note that this approach has not been excessively tested for use in superscript or subscript.

\documentclass{article}
\usepackage{amsmath,amssymb,trimclip}

\makeatletter

\def\lefttailfill@{\arrowfill@\relbar\relbar{\vcenter{\hbox{\clipbox{6pt 0pt 0pt 0pt}{\ensuremath\leftarrowtail}}}}} \ams@newcommand{\overlefttail}{\mathpalette{\overarrow@\lefttailfill@}}

\makeatother

\newcommand{\olefttail}[2]{[\overlefttail{\mathstrut#1,#2}]}

\begin{document}

[ \olefttail{2}{5} ]

[ \overlefttail{abc} ]

[ \sum^{\overlefttail{abc}} ]

\end{document}

enter image description here


Edit: same thing for the right "arrow" and one with two tails:

\documentclass{article}
\usepackage{amsmath,amssymb,trimclip}

\makeatletter

\def\righttailfill@{\arrowfill@{\vcenter{\hbox{\clipbox{0pt 0pt 6pt 0pt}{\ensuremath\rightarrowtail}}}}\relbar\relbar} \ams@newcommand{\overrighttail}{\mathpalette{\overarrow@\righttailfill@}}

\def\leftrighttailfill@{\arrowfill@{\vcenter{\hbox{\clipbox{0pt 0pt 6pt 0pt}{\ensuremath\rightarrowtail}}}}\relbar{\vcenter{\hbox{\clipbox{6pt 0pt 0pt 0pt}{\ensuremath\leftarrowtail}}}}} \ams@newcommand{\overleftrighttail}{\mathpalette{\overarrow@\leftrighttailfill@}}

\makeatother

\newcommand{\orighttail}[2]{[\overrighttail{\mathstrut#1,#2}]}

\newcommand{\oleftrighttail}[2]{[\overleftrighttail{\mathstrut#1,#2}]}

\begin{document}

[ \orighttail{2}{5} ]

[ \overrighttail{abc} ]

[ \oleftrighttail{2}{5} ]

[ \overleftrighttail{abc} ]

\end{document}

enter image description here

  • This is great! Thanks a lot. And how do you do the \overrighttail{} ? – Kaira Jul 12 '22 at 13:17
  • sorry for being dense, I am trying to adjust it myself but am getting some strange symbols – Kaira Jul 12 '22 at 13:18
  • Based on your answer I tried for the " right " equivalent but it is not correct \documentclass{article} \usepackage{amsmath,amssymb,trimclip}

    \makeatletter

    \def\righttailfill@{\arrowfill@\relbar\relbar{\clipbox{0pt 0pt 3pt 0pt}{\ensuremath\rightarrowtail}}} \ams@newcommand{\overrighttail}{\mathpalette{\overarrow@\righttailfill@}}

    \makeatother

    \newcommand{\olefttail}[2]{[\overlefttail{\mathstrut#1,#2}]}

    \newcommand{\orighttail}[2]{[\overrighttail{\mathstrut#1,#2}]} \begin{document}

    [ \overrighttail{abc} ]

    \end{document}

    – Kaira Jul 12 '22 at 14:04
  • See the edit of my post for a right-pointing (that is, left-tailed) "arrow". – Jasper Habicht Jul 12 '22 at 14:26
  • Thank you so much! – Kaira Jul 12 '22 at 14:32
  • Can I bug you for one more: what if I want the inverted arrow tip on both sides ? – Kaira Jul 12 '22 at 17:18
  • Sure, see the new edit. – Jasper Habicht Jul 12 '22 at 17:41
  • Thanks a million!! – Kaira Jul 12 '22 at 20:11
1

Run with lualatex or xelatex:

\documentclass[border=12pt]{standalone}
\usepackage{amsmath,graphicx}
\usepackage{unicode-math}
\setmathfont{XITS Math}
\makeatletter
\newcommand\xlongrightreversedarrow[2][]{\ext@arrow 0055{\longrightreversedarrowfill@}{#1}{#2}} 
\def\longrightreversedarrowfill@{\arrowfill@{}{\relbar}{\char"2919}}
\makeatother
\begin{document}

$\xlongrightreversedarrow[y=f(x,v,w)]{x=f(w)}$

\end{document}

enter image description here

user187802
  • 16,850
0

Here is a possibility with tikz. The commands \overrighttail, \overlefttail and \overleftrighttail produce the "arrows" using the syntax \overrighttail{abc}, etc.

enter image description here

An optional second argument allows for styling of the arrow, e.g.,

\overleftrighttail[red, semithick, densely dotted, line cap=round]{abc}

as seen above. The arrow shape can be changed by replacing to in the tikzset with whatever shape you want:

\tikzset{tail/.tip={Stealth[reversed, length=4pt]}}

enter image description here

To use as a limit in a \sum, see this related answer.

Here is the code:

\documentclass{article}

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

\tikzset{tail/.tip={to[reversed, length=1.5pt]}}

\newcommand{\overrighttail}[2][]{\tikz[baseline, anchor=base]{\nodeinner sep=0pt{$#2$}; \draw[tail-, #1]([shift={(1pt,2pt)}]a.north west)--([shift={(-1pt,2pt)}]a.north east);}} \newcommand{\overlefttail}[2][]{\tikz[baseline, anchor=base]{\nodeinner sep=0pt{$#2$}; \draw[-tail, #1]([shift={(1pt,2pt)}]a.north west)--([shift={(-1pt,2pt)}]a.north east);}} \newcommand{\overleftrighttail}[2][]{\tikz[baseline, anchor=base]{\nodeinner sep=0pt{$#2$}; \draw[tail-tail, #1]([shift={(1pt,2pt)}]a.north west)--([shift={(-1pt,2pt)}]a.north east);}}

\begin{document} [ \overrighttail{abc};\overlefttail{abc};\overleftrighttail{abc}; \overleftrighttail[red, semithick, densely dotted, line cap=round]{abc} ] \end{document}

Sandy G
  • 42,558