Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

I have two variables: \vec{x} and another one which is somehow dual to the first. Therefore I would like to symbolize the second with something similar but a leftarrow on top of the x. I already tried \stackrel{leftarrwo}{x} but it looks to different (too big gap between x and the arrow, and too big arrow).

Is there a way to define a \cev command which does what I want?

share|improve this question
    
It's not usual to have a 'greeting' in your question: I've edited slightly to follow the house style we've adopted! –  Joseph Wright Apr 6 '11 at 19:15
add comment

4 Answers

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}
share|improve this answer
add comment

The \vec is an accent (and its own symbol; hence all \leftarrow and similar constructs look different), and the default Computer Modern font doesn't have a symbol which would be its mirror.

In addition to rotating/mirroring the vec accent symbol, as shown by Ian, you could make use of one provided by, say, STIX/XITS (if you use XeTeX). Then you could define:

\def\cev{\XeTeXmathaccent"0"1"20D6}
% The first number ("0) denotes the math type (0=Ord,1=Op,2=Bin,3=Rel,etc.)
% The second number ("1) denotes the math family (0=Roman,1=Italic,etc.)
% The last number ("20D6) denotes the actual glyph slot
$\cev a \qquad \vec a$

Which could look like: cevvec

share|improve this answer
add comment

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.

share|improve this answer
add comment

I have a little to add to Frederic's solution:

\usepackage{stmaryrd}

\overset{\shortleftarrow}{a} \quad \vec{a} \quad \overset{{}_{\shortleftarrow}}{a}

Basically, the arrow in the subscript makes it smaller and reduces the vertical space between it and the variable. Unfortunately, nesting doesn't seem to work.

enter image description here

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.