2

Using the code from Reversed arrow tips for \overleftarrow and \overrightarrow I could create special arrows on top of letters. However, when using these symbols below a sum the arrows get all messed up (see the examples below). Can you help?

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

\makeatletter

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

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

\makeatother


\begin{document}



\[
\overrighttail{abc}
\]

\[
\sum _{\overrighttail{abc}}
\]

\[
\overleftrighttail{abc}
\]


\[
\sum _{\overleftrighttail{abc}}
\]
\end{document}


enter image description here

1
  • I adjusted my original answer a bit to solve this problem. In fact, you need to place \clipbox{0pt 0pt 6pt 0pt}{\ensuremath\rightarrowtail} inside \vcenter{\hbox{...}}, so that it becomes \vcenter{\hbox{\clipbox{0pt 0pt 6pt 0pt}{\ensuremath\rightarrowtail}}}. This will adjust the vertical alignment. Sep 29, 2022 at 8:15

1 Answer 1

2

Here is a completely different approach using tikz. Define new commands \overrighttail, \overlefttail and \overleftrighttail that take an argument as in \overrighttail{abc}. These commands place the argument in a node and then draws the arrow above. You can adjust spacing by changing the shift values.

To use these below (or above) \sum, use the additional new command \limstyle, which has the usage \limstyle{\overlefttail{abc}}. This command uses \mathclap, which requires the mathtools package.

enter image description here

An optional second argument allows further styling of the arrow. For example:

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

enter image description here

Note that you can change the Straight Barb arrowstyle to many other shapes by changing the tail/.tip setting. For example,

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

enter image description here

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

enter image description here

\documentclass{article}

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

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

\newcommand{\limstyle}[1]{\mathclap{\scriptsize{#1}}}
\newcommand{\overrighttail}[2][]{\tikz[baseline, anchor=base]{\node[inner sep=0pt](a){$#2$};
    \draw[tail-, #1]([shift={(1pt,2pt)}]a.north west)--([shift={(-1pt,2pt)}]a.north east);}}
\newcommand{\overlefttail}[2][]{\tikz[baseline, anchor=base]{\node[inner sep=0pt](a){$#2$};
    \draw[-tail, #1]([shift={(1pt,2pt)}]a.north west)--([shift={(-1pt,2pt)}]a.north east);}}
\newcommand{\overleftrighttail}[2][]{\tikz[baseline, anchor=base]{\node[inner sep=0pt](a){$#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}\;
\sum_{\limstyle{\overrighttail{abc}}}^{\limstyle{\overlefttail{abc}}}
\]
\end{document}
2

You must log in to answer this question.

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