12
$\begingroup$

I'd like to typeset $\vec{\square}$ but with the arrow pointing left, where $\square$ stands for an arbitrary letter from the Latin alphabet. I've tried to implement the solution described here, however it uses the \reflectbox command, which MathJax doesn't support. How can a left pointing vector accent be implemented in MathJax?

$\endgroup$
4

3 Answers 3

12
$\begingroup$

$\newcommand{\cev}[1]{\stackrel{\tiny\leftarrow}{\mathbf{#1}}}$ In general, you can put one thing on top of another using \stackrel{topthing}{bottomthing}. It's natural to use \leftarrow as the top thing, but it will look too large unless you modify it: \stackrel{\leftarrow}{\mathbf{v}} gives $\stackrel{\leftarrow}{\mathbf{v}}$. You can make a symbol a lot smaller with \tiny: \stackrel{\tiny\leftarrow}{\mathbf{v}} gives $\stackrel{\tiny\leftarrow}{\mathbf{v}}$ which has an arrow about the same size as the one produced by \vec{\mathbf{v}}: $\vec{\mathbf{v}}$ although a bit less bold. I don't know a heavier left arrow symbol.

To avoid typing out the full command every time, you can do \newcommand{\cev}[1]{\stackrel{\tiny\leftarrow}{\mathbf{#1}}} at the top of your answer. Then \cev{u} will produce $\cev{u}$

$\endgroup$
1
  • 1
    $\begingroup$ Alas, I think the scaling depends on the MathJax renderer. Here's what I see using the default "HTML-CSS" renderer: i.stack.imgur.com/tUOCr.png And here's what I (and, I suspect, you) see if I switch to the "Common HTML" renderer: i.stack.imgur.com/KmFce.png (Screenshots taken on Firefox 104.0.2 / macOS 12.5.1; behavior on Chrome 105.0.5195.125 and Safari 15.6.1 is pretty much the same.) Evan Aad's answer works great for me on both renderers, though. $\endgroup$ Sep 16 at 18:05
12
$\begingroup$

Here's an alternative solution to Matthew's, based on this answer, which I was made aware of thanks to hardmath's comment.

\newcommand{\cev}[1]{\style{display:inline-block; transform:scale(-1,1)}{\vec{\style{display:inline-block; transform:scale(-1,1)}{#1}}}} $\newcommand{\cev}[1]{\style{display:inline-block; transform:scale(-1,1)}{\vec{\style{display:inline-block; transform:scale(-1,1)}{#1}}}}$

Using this command, \cev{y} produces $\cev{y}$. For comparison, \vec{y} produces $\vec{y}$, and Matthew's code produces $\stackrel{\tiny\leftarrow}{y}$.

One advantage of my code over Matthew's is that with my code the arrow stretches automatically when more than one letter is involved. Thus, \cev{xy} produces $\cev{xy}$, whereas Matthew's code produces $\stackrel{\tiny\leftarrow}{xy}$. For comparison, \vec{xy} produces $\vec{xy}$.

$\endgroup$
4
$\begingroup$

A standard command exists for this: \overleftarrow{PQ} for $\overleftarrow{PQ}$.

In fact, \vec is defined to be a shorthand for \overrightarrow.

$\endgroup$
2
  • 3
    $\begingroup$ I don't think your second sentence can be correct - \vec{v} gives $\vec{v}$ which has a very different size arrow to \overrightarrow{v} which makes $\overrightarrow{v}$ $\endgroup$ Sep 14 at 10:00
  • 2
    $\begingroup$ @MatthewTowers My fault. \vec is a (simple) math accent while \overrightarrow is an extensible accent. $\endgroup$ Sep 14 at 10:09

You must log in to answer this question.

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