8

Consider

\documentclass{article}
\begin{document}
\(\vec a:\fbox?::\overrightarrow a:\overleftarrow a\)
\end{document}

Rendering of the above TeX code, showing the desired analogy

How do I get a math accent like \vec, not with such a huge tip or such width as \overleftarrow, but pointing the other way?

Presumably this can be rolled by hand, after deciding where and how the left arrow should be positioned. I'm not immediately up to rolling it by hand, but, even if I were, I don't want to have to decide where the arrow should be positioned. So I'm hoping there is some package that has already decided it for me! But, if not, I'd be happy for an arrow that occupied exactly the same horizontal space relative to the accented character as \vec, just with the tip on the other side.

Incidentally, I had a look at the comprehensive symbols list, but I didn't find it on random search, and, with no idea what to search for other than \cev (which gets no hits) or backward (which gets no obviously relevant hits), wasn't sure how to search more intelligently.

0

3 Answers 3

6

I don’t know of any packages that provide such a symbol, but with \reflectbox from the graphicx package, you can reflect anything—in this case, math diacritics. I added a negative space \! to make the horizontal spacing look nicer, but you’re more than welcome to delete it to suit your tastes.

An image of the normal short overline arrow vector symbol pointing to the right, and a backwards overline arrow vector symbol pointing to the left. These are compared to long overline arrow symbols pointing to the left and to the right. These symbols are shown as diacritics above both uppercase and lowercase letters.

\documentclass{article}
\usepackage{graphicx}
\newcommand{\backvec}[1]{\reflectbox{$\vec{\reflectbox{\!$#1$}}$}}
\begin{document}
\bfseries

Lowercase\qquad $\vec a:\backvec a::\overrightarrow a\overleftarrow a$

Uppercase\qquad $\vec A:\backvec A::\overrightarrow A\overleftarrow A$

\end{document}
4
  • 1
    Ah, I knew about \reflectbox, but I was worried about how to make it apply just to the diacritic. It didn't occur to me that, since \reflectbox is an involution, there was no need! Very nice solution; thanks. I'll wait a bit before accepting, to see if anyone else knows about a relevant package. \\ I just noticed my code, and therefore yours, is missing a(n essentially irrelevant) : to get things to render as desired. Sorry! I restored it in an edit, but of course there's no need for you to re-render your screenshot.
    – LSpice
    Aug 9, 2023 at 4:37
  • 2
    It’s a bit unfortunate that the arrow is “pre-italicized”, so in the reflected version, the slant is in the wrong direction. Aug 9, 2023 at 6:08
  • 1
    @EikeSchulte rotatebox 180 rather than reflect? Aug 9, 2023 at 6:53
  • 1
    Unfortunately, the reflect-accent-reflect trick won’t work at easily with rotatebox, I think. Aug 9, 2023 at 9:25
8

The standard Computer Modern Math font only has a right arrow (in position "7E or 126 in decimal). It has however no left arrow. enter image description here

The STIX font provides both a left arrow (in position "91 or 145 in decimal) and a right arrow (in position "92 or 146 in decimal). enter image description here

\documentclass{article}

\DeclareFontEncoding{LS1}{}{}
\DeclareFontSubstitution{LS1}{stix}{m}{n}
\DeclareSymbolFont{stixletters}{LS1}{stix}{m}{it}
\DeclareMathAccent{\cev}{\mathord}{stixletters}{"91}
\DeclareMathAccent{\vec}{\mathord}{stixletters}{"92}
\DeclareMathAccent{\vecev}{\mathord}{stixletters}{"95}


\begin{document}

$\vec{a}, \cev{a}$

$\vec{A}, \cev{A}$

Bonus: $\vecev{a}, \vecev{A}$

\end{document}

enter image description here

4
  • Thanks! It seems to me that this makes \vec and \cev behave as I've requested, but at the expense of changing the behaviour of \vec first (so that the arrowhead looks slightly different). Is that correct?
    – LSpice
    Aug 9, 2023 at 5:11
  • \vec was redefined to take the arrow from the same font so that the two symbols look similar. Comment the line \DeclareMathAccent{\vec}{\mathord}{stixletters}{"92} otherwise
    – user94293
    Aug 9, 2023 at 5:17
  • Re, right, I understand that I can comment out that line, but then \vec and \cev have different kinds of arrows (even aside from the direction), right? I'm not trying to be obstinate, just to understand if this is a reasonable answer to a nearby question that happens to not be the exact one I asked, or if it is an answer to my exact question and I'm not seeing it.
    – LSpice
    Aug 9, 2023 at 5:21
  • See comment added to the answer. You need to have a font that has both arrows.
    – user94293
    Aug 9, 2023 at 5:33
6

It seems that you are not using Unicode math, but maybe someone else who stumbles on this question does.

There are U+020D6 (wide left arrow above) and U+020D7 (wide right arrow above). In LaTeX (unicode-math), the first one is accessible via \overleftarrow and the second via \overrightarrow. This is how it can look.

arrows

In unicode-math there is also a \vec, but that is really also U+020D7 but with a fixed size (\mathaccent instead of \mathaccentwide). There is no \cev or similar corresponding to the left arrow. Looking in unicode-math-table.tex we find

\UnicodeMathSymbol{"020D6}{\overleftarrow            }{\mathaccentwide}{combining left arrow above}%
\UnicodeMathSymbol{"020D7}{\overrightarrow           }{\mathaccentwide}{combining left arrow above}%
\UnicodeMathSymbol{"020D7}{\vec                      }{\mathaccent}{combining right arrow above}%

This hints on how to define \cev in case one needs it.

(In ConTeXt the abovementioned arrows are accessed via \wideoverleftarrow and \wideoverrightarrow. The \overleftarrow and \overrightarrow are defined as a stackers rather than accents.)

2
  • Please pardon me for accepting and then unaccepting this answer, which I appreciate and upvoted. It's very useful, but I felt that @gz839918's answer came closer to my intention. Unfortunately, when I went to accept it, I mis-clicked.
    – LSpice
    Aug 9, 2023 at 20:47
  • 1
    Haha, don't worry. I don't care too much about those points anyways. Happy TeXing!
    – mickep
    Aug 9, 2023 at 20:53

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