\vec{x} but with arrow from right to left?
A \cev
command that seems to give good results on most letters and works correctly (apart a very small drift) in subscripts and superscripts.
\documentclass{article}
\usepackage{graphicx,accents}
\makeatletter
\DeclareRobustCommand{\cev}[1]{%
\mathpalette\do@cev{#1}%
}
\newcommand{\do@cev}[2]{%
\fix@cev{#1}{+}%
\reflectbox{$\m@th#1\vec{\reflectbox{$\fix@cev{#1}{-}\m@th#1#2\fix@cev{#1}{+}$}}$}%
\fix@cev{#1}{-}%
}
\newcommand{\fix@cev}[2]{%
\ifx#1\displaystyle
\mkern#23mu
\else
\ifx#1\textstyle
\mkern#23mu
\else
\ifx#1\scriptstyle
\mkern#22mu
\else
\mkern#22mu
\fi
\fi
\fi
}
\makeatother
\begin{document}
$Xx$
$X\cev{x}_{\cev{x}_{\cev{x}}}$ $\cev{a}\cev{b}\cev{m}\cev{X}$
$X\vec{x}_{\vec{x}_{\vec{x}}}$ $\vec{a}\vec{b}\vec{m}\vec{X}$
$\cev{\imath}$
$\vec{\imath}$
\end{document}
A different implementation:
\documentclass{article}
\usepackage{graphicx}
\makeatletter
\DeclareRobustCommand{\cev}[1]{%
{\mathpalette\do@cev{#1}}%
}
\newcommand{\do@cev}[2]{%
\vbox{\offinterlineskip
\sbox\z@{$\m@th#1 x$}%
\ialign{##\cr
\hidewidth\reflectbox{$\m@th#1\vec{}\mkern4mu$}\hidewidth\cr
\noalign{\kern-\ht\z@}
$\m@th#1#2$\cr
}%
}%
}
\makeatother
\begin{document}
$Xx$
$X\cev{x}_{\cev{x}_{\cev{x}}}$ $\cev{a}\cev{b}\cev{m}\cev{X}$
$X\vec{x}_{\vec{x}_{\vec{x}}}$ $\vec{a}\vec{b}\vec{m}\vec{X}$
$\cev{\imath}$
$\vec{\imath}$
$\cev{\sigma}\cev{x}$
$\vec{\sigma}\vec{x}$
\end{document}
This may not be the best way, but two \reflectbox
commands will do the trick:
\documentclass{article}
\usepackage{graphicx}
\newcommand{\cev}[1]{\reflectbox{\ensuremath{\vec{\reflectbox{\ensuremath{#1}}}}}}
\begin{document}
\[
\vec{a} \quad \cev{a} \quad \vec{b} \quad \cev{b}
\]
\end{document}
The extensible \overleftarrow
might do the trick. The problem is that the arrow is bigger than the one used for \vec
, as shown by \[\overleftarrow{a}\overrightarrow{a}\vec{a}\]
. To have consistent arrows, you should redefine $\vec$ :
\documentclass{minimal}
\renewcommand\vec[1]{\overrightarrow{#1}}
\newcommand\cev[1]{\overleftarrow{#1}}
\begin{document}
\[\cev{a}\vec{a}\]
\end{document}
Edited to add:
Another solution is the \overset
command from amsmath
, used with \leftarrow
. However, the arrow is still bigger than the one from the \vec
command.
\documentclass{minimal}
\usepackage{amsmath}
\begin{document}
\[\overset{\leftarrow}{v}\overset{\rightarrow}{v}\vec{v}\]
\end{document}
*Edited to add *
Using \shortleftarrow
from the stmaryrd
package slightly improves the above construction.