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?
-
1$\begingroup$ Related from earlier this year, How to rotate text by 180 and/or mirror it in Math.SE. But the idea below seems much less work. $\endgroup$– hardmathSep 9, 2022 at 23:33
-
1$\begingroup$ @hardmath: Thanks! I posted an alternative answer below based on the post you linked to. $\endgroup$– Evan AadSep 11, 2022 at 1:01
-
1$\begingroup$ Voting to migrate this to TeX Stack Exchange. $\endgroup$– K.defaoiteSep 13, 2022 at 20:10
-
$\begingroup$ Does this answer your question? MathJax basic tutorial and quick reference $\endgroup$– SurbSep 14, 2022 at 17:56
3 Answers
$\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}$
-
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, 2022 at 18:05
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}$.
A standard command exists for this: \overleftarrow{PQ}
for $\overleftarrow{PQ}$.
In fact, \vec
is defined to be a shorthand for \overrightarrow
.
-
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, 2022 at 10:00 -
2$\begingroup$ @MatthewTowers My fault.
\vec
is a (simple) math accent while\overrightarrow
is an extensible accent. $\endgroup$– ЅᴀᴀᴅSep 14, 2022 at 10:09