vec{x} but with arrow from right to left?











up vote
26
down vote

favorite
2












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
























  • I just encountered a simple solution: stackoverflow.com/questions/2826471/…
    – cknoll
    May 27 '15 at 15:54










  • Since you have some responses below that seem to answer your question, please consider marking one of them as ‘Accepted’ by clicking on the tickmark below their vote count (see How do you accept an answer?). This shows which answer helped you most, and it assigns reputation points to the author of the answer (and to you!). It's part of this site's idea to identify good questions and answers through upvotes and acceptance of answers.
    – samcarter
    Mar 16 at 17:15















up vote
26
down vote

favorite
2












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
























  • I just encountered a simple solution: stackoverflow.com/questions/2826471/…
    – cknoll
    May 27 '15 at 15:54










  • Since you have some responses below that seem to answer your question, please consider marking one of them as ‘Accepted’ by clicking on the tickmark below their vote count (see How do you accept an answer?). This shows which answer helped you most, and it assigns reputation points to the author of the answer (and to you!). It's part of this site's idea to identify good questions and answers through upvotes and acceptance of answers.
    – samcarter
    Mar 16 at 17:15













up vote
26
down vote

favorite
2









up vote
26
down vote

favorite
2






2





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















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?







macros vector






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Apr 6 '11 at 19:14









Joseph Wright

201k21554879




201k21554879










asked Apr 5 '11 at 12:48









cknoll

325149




325149












  • I just encountered a simple solution: stackoverflow.com/questions/2826471/…
    – cknoll
    May 27 '15 at 15:54










  • Since you have some responses below that seem to answer your question, please consider marking one of them as ‘Accepted’ by clicking on the tickmark below their vote count (see How do you accept an answer?). This shows which answer helped you most, and it assigns reputation points to the author of the answer (and to you!). It's part of this site's idea to identify good questions and answers through upvotes and acceptance of answers.
    – samcarter
    Mar 16 at 17:15


















  • I just encountered a simple solution: stackoverflow.com/questions/2826471/…
    – cknoll
    May 27 '15 at 15:54










  • Since you have some responses below that seem to answer your question, please consider marking one of them as ‘Accepted’ by clicking on the tickmark below their vote count (see How do you accept an answer?). This shows which answer helped you most, and it assigns reputation points to the author of the answer (and to you!). It's part of this site's idea to identify good questions and answers through upvotes and acceptance of answers.
    – samcarter
    Mar 16 at 17:15
















I just encountered a simple solution: stackoverflow.com/questions/2826471/…
– cknoll
May 27 '15 at 15:54




I just encountered a simple solution: stackoverflow.com/questions/2826471/…
– cknoll
May 27 '15 at 15:54












Since you have some responses below that seem to answer your question, please consider marking one of them as ‘Accepted’ by clicking on the tickmark below their vote count (see How do you accept an answer?). This shows which answer helped you most, and it assigns reputation points to the author of the answer (and to you!). It's part of this site's idea to identify good questions and answers through upvotes and acceptance of answers.
– samcarter
Mar 16 at 17:15




Since you have some responses below that seem to answer your question, please consider marking one of them as ‘Accepted’ by clicking on the tickmark below their vote count (see How do you accept an answer?). This shows which answer helped you most, and it assigns reputation points to the author of the answer (and to you!). It's part of this site's idea to identify good questions and answers through upvotes and acceptance of answers.
– samcarter
Mar 16 at 17:15










5 Answers
5






active

oldest

votes

















up vote
13
down vote



accepted










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





















  • Thanks, but this causes problems with subscripts: Example On the right hand side the t is marked using cev{t_{mathring{r}}} and s is marked using cev{s}_{mathring{r}} I'd like to have the arrow centered over the whole symbol (including subscript) as it is in the case of t on the left.
    – C-Otto
    May 26 '14 at 7:26












  • In your example, the arrow over the t on the left does not appear to be centred over the whole symbol including the superscript to me. On the other hand, cev{t_{mathring{r}}} seems to give exactly what you want.
    – Ian Thompson
    May 26 '14 at 11:25










  • cev{t_{mathring{r}}} is shown on the right. And cev{t_r} is shown on the left, where the arrow is a bit more centered than in the case of cev{t}_r. I'm happy with the looks on the left side, but the right side obviously is wrong.
    – C-Otto
    May 26 '14 at 15:09










  • This could be a problem with the font you are using; the result of cev{t_{mathring{r}}} on my machine looks nothing like yours! Please post a new question with a complete example code that reproduces the problem.
    – Ian Thompson
    May 27 '14 at 7:41


















up vote
10
down vote













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]{%
mathpalettedo@cev{#1}%
}
newcommand{do@cev}[2]{%
fix@cev{#1}{+}%
reflectbox{$m@th#1vec{reflectbox{$fix@cev{#1}{-}m@th#1#2fix@cev{#1}{+}$}}$}%
fix@cev{#1}{-}%
}
newcommand{fix@cev}[2]{%
ifx#1displaystyle
mkern#23mu
else
ifx#1textstyle
mkern#23mu
else
ifx#1scriptstyle
mkern#22mu
else
mkern#22mu
fi
fi
fi
}

makeatother

begin{document}
$Xx$

$Xcev{x}_{cev{x}_{cev{x}}}$ $cev{a}cev{b}cev{m}cev{X}$

$Xvec{x}_{vec{x}_{vec{x}}}$ $vec{a}vec{b}vec{m}vec{X}$

$cev{imath}$

$vec{imath}$
end{document}


enter image description here



A different implementation:



documentclass{article}
usepackage{graphicx}

makeatletter
DeclareRobustCommand{cev}[1]{%
{mathpalettedo@cev{#1}}%
}
newcommand{do@cev}[2]{%
vbox{offinterlineskip
sboxz@{$m@th#1 x$}%
ialign{##cr
hidewidthreflectbox{$m@th#1vec{}mkern4mu$}hidewidthcr
noalign{kern-htz@}
$m@th#1#2$cr
}%
}%
}
makeatother

begin{document}
$Xx$

$Xcev{x}_{cev{x}_{cev{x}}}$ $cev{a}cev{b}cev{m}cev{X}$

$Xvec{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}


enter image description here






share|improve this answer



















  • 2




    Can the arrow be rotated instead of reflected to have the correct slanting? Now, the cev arrow slants to the left, while the vec arrow (as well as the italic letter) slants to the right.
    – Qrrbrbirlbel
    May 17 '15 at 0:21










  • @Qrrbrbirlbel That's more difficult.
    – egreg
    May 17 '15 at 9:13










  • @user49915 I get picture (click), which doesn't show so big a difference with cev{x}
    – egreg
    Dec 1 at 15:09










  • I apologize and removed my prior comment, which was misleading. With default CM fonts, yours (cev{sigma}) is ok. It gets ugly when you use usepackage[slantedGreek]{newtxmath} or usepackage{newtxmath}. In this situation, (cev{sigma}) produces the leftarrow that is shifted too much to the right. Is there a way to center the left arrow above the symbol automatically?
    – user49915
    Dec 1 at 15:24












  • @user49915 Maybe you want to try the different implementation I added, maybe fixing the amount of mkern.
    – egreg
    Dec 1 at 15:25


















up vote
7
down vote













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}
renewcommandvec[1]{overrightarrow{#1}}
newcommandcev[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






























    up vote
    6
    down vote













    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:



    defcev{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






























      up vote
      2
      down vote













      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























        Your Answer








        StackExchange.ready(function() {
        var channelOptions = {
        tags: "".split(" "),
        id: "85"
        };
        initTagRenderer("".split(" "), "".split(" "), channelOptions);

        StackExchange.using("externalEditor", function() {
        // Have to fire editor after snippets, if snippets enabled
        if (StackExchange.settings.snippets.snippetsEnabled) {
        StackExchange.using("snippets", function() {
        createEditor();
        });
        }
        else {
        createEditor();
        }
        });

        function createEditor() {
        StackExchange.prepareEditor({
        heartbeatType: 'answer',
        convertImagesToLinks: false,
        noModals: true,
        showLowRepImageUploadWarning: true,
        reputationToPostImages: null,
        bindNavPrevention: true,
        postfix: "",
        imageUploader: {
        brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
        contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
        allowUrls: true
        },
        onDemand: true,
        discardSelector: ".discard-answer"
        ,immediatelyShowMarkdownHelp:true
        });


        }
        });














        draft saved

        draft discarded


















        StackExchange.ready(
        function () {
        StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2ftex.stackexchange.com%2fquestions%2f15010%2fvecx-but-with-arrow-from-right-to-left%23new-answer', 'question_page');
        }
        );

        Post as a guest















        Required, but never shown

























        5 Answers
        5






        active

        oldest

        votes








        5 Answers
        5






        active

        oldest

        votes









        active

        oldest

        votes






        active

        oldest

        votes








        up vote
        13
        down vote



        accepted










        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





















        • Thanks, but this causes problems with subscripts: Example On the right hand side the t is marked using cev{t_{mathring{r}}} and s is marked using cev{s}_{mathring{r}} I'd like to have the arrow centered over the whole symbol (including subscript) as it is in the case of t on the left.
          – C-Otto
          May 26 '14 at 7:26












        • In your example, the arrow over the t on the left does not appear to be centred over the whole symbol including the superscript to me. On the other hand, cev{t_{mathring{r}}} seems to give exactly what you want.
          – Ian Thompson
          May 26 '14 at 11:25










        • cev{t_{mathring{r}}} is shown on the right. And cev{t_r} is shown on the left, where the arrow is a bit more centered than in the case of cev{t}_r. I'm happy with the looks on the left side, but the right side obviously is wrong.
          – C-Otto
          May 26 '14 at 15:09










        • This could be a problem with the font you are using; the result of cev{t_{mathring{r}}} on my machine looks nothing like yours! Please post a new question with a complete example code that reproduces the problem.
          – Ian Thompson
          May 27 '14 at 7:41















        up vote
        13
        down vote



        accepted










        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





















        • Thanks, but this causes problems with subscripts: Example On the right hand side the t is marked using cev{t_{mathring{r}}} and s is marked using cev{s}_{mathring{r}} I'd like to have the arrow centered over the whole symbol (including subscript) as it is in the case of t on the left.
          – C-Otto
          May 26 '14 at 7:26












        • In your example, the arrow over the t on the left does not appear to be centred over the whole symbol including the superscript to me. On the other hand, cev{t_{mathring{r}}} seems to give exactly what you want.
          – Ian Thompson
          May 26 '14 at 11:25










        • cev{t_{mathring{r}}} is shown on the right. And cev{t_r} is shown on the left, where the arrow is a bit more centered than in the case of cev{t}_r. I'm happy with the looks on the left side, but the right side obviously is wrong.
          – C-Otto
          May 26 '14 at 15:09










        • This could be a problem with the font you are using; the result of cev{t_{mathring{r}}} on my machine looks nothing like yours! Please post a new question with a complete example code that reproduces the problem.
          – Ian Thompson
          May 27 '14 at 7:41













        up vote
        13
        down vote



        accepted







        up vote
        13
        down vote



        accepted






        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












        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












        share|improve this answer



        share|improve this answer










        answered Apr 5 '11 at 13:07









        Ian Thompson

        31.6k377154




        31.6k377154












        • Thanks, but this causes problems with subscripts: Example On the right hand side the t is marked using cev{t_{mathring{r}}} and s is marked using cev{s}_{mathring{r}} I'd like to have the arrow centered over the whole symbol (including subscript) as it is in the case of t on the left.
          – C-Otto
          May 26 '14 at 7:26












        • In your example, the arrow over the t on the left does not appear to be centred over the whole symbol including the superscript to me. On the other hand, cev{t_{mathring{r}}} seems to give exactly what you want.
          – Ian Thompson
          May 26 '14 at 11:25










        • cev{t_{mathring{r}}} is shown on the right. And cev{t_r} is shown on the left, where the arrow is a bit more centered than in the case of cev{t}_r. I'm happy with the looks on the left side, but the right side obviously is wrong.
          – C-Otto
          May 26 '14 at 15:09










        • This could be a problem with the font you are using; the result of cev{t_{mathring{r}}} on my machine looks nothing like yours! Please post a new question with a complete example code that reproduces the problem.
          – Ian Thompson
          May 27 '14 at 7:41


















        • Thanks, but this causes problems with subscripts: Example On the right hand side the t is marked using cev{t_{mathring{r}}} and s is marked using cev{s}_{mathring{r}} I'd like to have the arrow centered over the whole symbol (including subscript) as it is in the case of t on the left.
          – C-Otto
          May 26 '14 at 7:26












        • In your example, the arrow over the t on the left does not appear to be centred over the whole symbol including the superscript to me. On the other hand, cev{t_{mathring{r}}} seems to give exactly what you want.
          – Ian Thompson
          May 26 '14 at 11:25










        • cev{t_{mathring{r}}} is shown on the right. And cev{t_r} is shown on the left, where the arrow is a bit more centered than in the case of cev{t}_r. I'm happy with the looks on the left side, but the right side obviously is wrong.
          – C-Otto
          May 26 '14 at 15:09










        • This could be a problem with the font you are using; the result of cev{t_{mathring{r}}} on my machine looks nothing like yours! Please post a new question with a complete example code that reproduces the problem.
          – Ian Thompson
          May 27 '14 at 7:41
















        Thanks, but this causes problems with subscripts: Example On the right hand side the t is marked using cev{t_{mathring{r}}} and s is marked using cev{s}_{mathring{r}} I'd like to have the arrow centered over the whole symbol (including subscript) as it is in the case of t on the left.
        – C-Otto
        May 26 '14 at 7:26






        Thanks, but this causes problems with subscripts: Example On the right hand side the t is marked using cev{t_{mathring{r}}} and s is marked using cev{s}_{mathring{r}} I'd like to have the arrow centered over the whole symbol (including subscript) as it is in the case of t on the left.
        – C-Otto
        May 26 '14 at 7:26














        In your example, the arrow over the t on the left does not appear to be centred over the whole symbol including the superscript to me. On the other hand, cev{t_{mathring{r}}} seems to give exactly what you want.
        – Ian Thompson
        May 26 '14 at 11:25




        In your example, the arrow over the t on the left does not appear to be centred over the whole symbol including the superscript to me. On the other hand, cev{t_{mathring{r}}} seems to give exactly what you want.
        – Ian Thompson
        May 26 '14 at 11:25












        cev{t_{mathring{r}}} is shown on the right. And cev{t_r} is shown on the left, where the arrow is a bit more centered than in the case of cev{t}_r. I'm happy with the looks on the left side, but the right side obviously is wrong.
        – C-Otto
        May 26 '14 at 15:09




        cev{t_{mathring{r}}} is shown on the right. And cev{t_r} is shown on the left, where the arrow is a bit more centered than in the case of cev{t}_r. I'm happy with the looks on the left side, but the right side obviously is wrong.
        – C-Otto
        May 26 '14 at 15:09












        This could be a problem with the font you are using; the result of cev{t_{mathring{r}}} on my machine looks nothing like yours! Please post a new question with a complete example code that reproduces the problem.
        – Ian Thompson
        May 27 '14 at 7:41




        This could be a problem with the font you are using; the result of cev{t_{mathring{r}}} on my machine looks nothing like yours! Please post a new question with a complete example code that reproduces the problem.
        – Ian Thompson
        May 27 '14 at 7:41










        up vote
        10
        down vote













        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]{%
        mathpalettedo@cev{#1}%
        }
        newcommand{do@cev}[2]{%
        fix@cev{#1}{+}%
        reflectbox{$m@th#1vec{reflectbox{$fix@cev{#1}{-}m@th#1#2fix@cev{#1}{+}$}}$}%
        fix@cev{#1}{-}%
        }
        newcommand{fix@cev}[2]{%
        ifx#1displaystyle
        mkern#23mu
        else
        ifx#1textstyle
        mkern#23mu
        else
        ifx#1scriptstyle
        mkern#22mu
        else
        mkern#22mu
        fi
        fi
        fi
        }

        makeatother

        begin{document}
        $Xx$

        $Xcev{x}_{cev{x}_{cev{x}}}$ $cev{a}cev{b}cev{m}cev{X}$

        $Xvec{x}_{vec{x}_{vec{x}}}$ $vec{a}vec{b}vec{m}vec{X}$

        $cev{imath}$

        $vec{imath}$
        end{document}


        enter image description here



        A different implementation:



        documentclass{article}
        usepackage{graphicx}

        makeatletter
        DeclareRobustCommand{cev}[1]{%
        {mathpalettedo@cev{#1}}%
        }
        newcommand{do@cev}[2]{%
        vbox{offinterlineskip
        sboxz@{$m@th#1 x$}%
        ialign{##cr
        hidewidthreflectbox{$m@th#1vec{}mkern4mu$}hidewidthcr
        noalign{kern-htz@}
        $m@th#1#2$cr
        }%
        }%
        }
        makeatother

        begin{document}
        $Xx$

        $Xcev{x}_{cev{x}_{cev{x}}}$ $cev{a}cev{b}cev{m}cev{X}$

        $Xvec{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}


        enter image description here






        share|improve this answer



















        • 2




          Can the arrow be rotated instead of reflected to have the correct slanting? Now, the cev arrow slants to the left, while the vec arrow (as well as the italic letter) slants to the right.
          – Qrrbrbirlbel
          May 17 '15 at 0:21










        • @Qrrbrbirlbel That's more difficult.
          – egreg
          May 17 '15 at 9:13










        • @user49915 I get picture (click), which doesn't show so big a difference with cev{x}
          – egreg
          Dec 1 at 15:09










        • I apologize and removed my prior comment, which was misleading. With default CM fonts, yours (cev{sigma}) is ok. It gets ugly when you use usepackage[slantedGreek]{newtxmath} or usepackage{newtxmath}. In this situation, (cev{sigma}) produces the leftarrow that is shifted too much to the right. Is there a way to center the left arrow above the symbol automatically?
          – user49915
          Dec 1 at 15:24












        • @user49915 Maybe you want to try the different implementation I added, maybe fixing the amount of mkern.
          – egreg
          Dec 1 at 15:25















        up vote
        10
        down vote













        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]{%
        mathpalettedo@cev{#1}%
        }
        newcommand{do@cev}[2]{%
        fix@cev{#1}{+}%
        reflectbox{$m@th#1vec{reflectbox{$fix@cev{#1}{-}m@th#1#2fix@cev{#1}{+}$}}$}%
        fix@cev{#1}{-}%
        }
        newcommand{fix@cev}[2]{%
        ifx#1displaystyle
        mkern#23mu
        else
        ifx#1textstyle
        mkern#23mu
        else
        ifx#1scriptstyle
        mkern#22mu
        else
        mkern#22mu
        fi
        fi
        fi
        }

        makeatother

        begin{document}
        $Xx$

        $Xcev{x}_{cev{x}_{cev{x}}}$ $cev{a}cev{b}cev{m}cev{X}$

        $Xvec{x}_{vec{x}_{vec{x}}}$ $vec{a}vec{b}vec{m}vec{X}$

        $cev{imath}$

        $vec{imath}$
        end{document}


        enter image description here



        A different implementation:



        documentclass{article}
        usepackage{graphicx}

        makeatletter
        DeclareRobustCommand{cev}[1]{%
        {mathpalettedo@cev{#1}}%
        }
        newcommand{do@cev}[2]{%
        vbox{offinterlineskip
        sboxz@{$m@th#1 x$}%
        ialign{##cr
        hidewidthreflectbox{$m@th#1vec{}mkern4mu$}hidewidthcr
        noalign{kern-htz@}
        $m@th#1#2$cr
        }%
        }%
        }
        makeatother

        begin{document}
        $Xx$

        $Xcev{x}_{cev{x}_{cev{x}}}$ $cev{a}cev{b}cev{m}cev{X}$

        $Xvec{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}


        enter image description here






        share|improve this answer



















        • 2




          Can the arrow be rotated instead of reflected to have the correct slanting? Now, the cev arrow slants to the left, while the vec arrow (as well as the italic letter) slants to the right.
          – Qrrbrbirlbel
          May 17 '15 at 0:21










        • @Qrrbrbirlbel That's more difficult.
          – egreg
          May 17 '15 at 9:13










        • @user49915 I get picture (click), which doesn't show so big a difference with cev{x}
          – egreg
          Dec 1 at 15:09










        • I apologize and removed my prior comment, which was misleading. With default CM fonts, yours (cev{sigma}) is ok. It gets ugly when you use usepackage[slantedGreek]{newtxmath} or usepackage{newtxmath}. In this situation, (cev{sigma}) produces the leftarrow that is shifted too much to the right. Is there a way to center the left arrow above the symbol automatically?
          – user49915
          Dec 1 at 15:24












        • @user49915 Maybe you want to try the different implementation I added, maybe fixing the amount of mkern.
          – egreg
          Dec 1 at 15:25













        up vote
        10
        down vote










        up vote
        10
        down vote









        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]{%
        mathpalettedo@cev{#1}%
        }
        newcommand{do@cev}[2]{%
        fix@cev{#1}{+}%
        reflectbox{$m@th#1vec{reflectbox{$fix@cev{#1}{-}m@th#1#2fix@cev{#1}{+}$}}$}%
        fix@cev{#1}{-}%
        }
        newcommand{fix@cev}[2]{%
        ifx#1displaystyle
        mkern#23mu
        else
        ifx#1textstyle
        mkern#23mu
        else
        ifx#1scriptstyle
        mkern#22mu
        else
        mkern#22mu
        fi
        fi
        fi
        }

        makeatother

        begin{document}
        $Xx$

        $Xcev{x}_{cev{x}_{cev{x}}}$ $cev{a}cev{b}cev{m}cev{X}$

        $Xvec{x}_{vec{x}_{vec{x}}}$ $vec{a}vec{b}vec{m}vec{X}$

        $cev{imath}$

        $vec{imath}$
        end{document}


        enter image description here



        A different implementation:



        documentclass{article}
        usepackage{graphicx}

        makeatletter
        DeclareRobustCommand{cev}[1]{%
        {mathpalettedo@cev{#1}}%
        }
        newcommand{do@cev}[2]{%
        vbox{offinterlineskip
        sboxz@{$m@th#1 x$}%
        ialign{##cr
        hidewidthreflectbox{$m@th#1vec{}mkern4mu$}hidewidthcr
        noalign{kern-htz@}
        $m@th#1#2$cr
        }%
        }%
        }
        makeatother

        begin{document}
        $Xx$

        $Xcev{x}_{cev{x}_{cev{x}}}$ $cev{a}cev{b}cev{m}cev{X}$

        $Xvec{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}


        enter image description here






        share|improve this answer














        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]{%
        mathpalettedo@cev{#1}%
        }
        newcommand{do@cev}[2]{%
        fix@cev{#1}{+}%
        reflectbox{$m@th#1vec{reflectbox{$fix@cev{#1}{-}m@th#1#2fix@cev{#1}{+}$}}$}%
        fix@cev{#1}{-}%
        }
        newcommand{fix@cev}[2]{%
        ifx#1displaystyle
        mkern#23mu
        else
        ifx#1textstyle
        mkern#23mu
        else
        ifx#1scriptstyle
        mkern#22mu
        else
        mkern#22mu
        fi
        fi
        fi
        }

        makeatother

        begin{document}
        $Xx$

        $Xcev{x}_{cev{x}_{cev{x}}}$ $cev{a}cev{b}cev{m}cev{X}$

        $Xvec{x}_{vec{x}_{vec{x}}}$ $vec{a}vec{b}vec{m}vec{X}$

        $cev{imath}$

        $vec{imath}$
        end{document}


        enter image description here



        A different implementation:



        documentclass{article}
        usepackage{graphicx}

        makeatletter
        DeclareRobustCommand{cev}[1]{%
        {mathpalettedo@cev{#1}}%
        }
        newcommand{do@cev}[2]{%
        vbox{offinterlineskip
        sboxz@{$m@th#1 x$}%
        ialign{##cr
        hidewidthreflectbox{$m@th#1vec{}mkern4mu$}hidewidthcr
        noalign{kern-htz@}
        $m@th#1#2$cr
        }%
        }%
        }
        makeatother

        begin{document}
        $Xx$

        $Xcev{x}_{cev{x}_{cev{x}}}$ $cev{a}cev{b}cev{m}cev{X}$

        $Xvec{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}


        enter image description here







        share|improve this answer














        share|improve this answer



        share|improve this answer








        edited Dec 1 at 15:25

























        answered May 16 '15 at 23:12









        egreg

        703k8618733148




        703k8618733148








        • 2




          Can the arrow be rotated instead of reflected to have the correct slanting? Now, the cev arrow slants to the left, while the vec arrow (as well as the italic letter) slants to the right.
          – Qrrbrbirlbel
          May 17 '15 at 0:21










        • @Qrrbrbirlbel That's more difficult.
          – egreg
          May 17 '15 at 9:13










        • @user49915 I get picture (click), which doesn't show so big a difference with cev{x}
          – egreg
          Dec 1 at 15:09










        • I apologize and removed my prior comment, which was misleading. With default CM fonts, yours (cev{sigma}) is ok. It gets ugly when you use usepackage[slantedGreek]{newtxmath} or usepackage{newtxmath}. In this situation, (cev{sigma}) produces the leftarrow that is shifted too much to the right. Is there a way to center the left arrow above the symbol automatically?
          – user49915
          Dec 1 at 15:24












        • @user49915 Maybe you want to try the different implementation I added, maybe fixing the amount of mkern.
          – egreg
          Dec 1 at 15:25














        • 2




          Can the arrow be rotated instead of reflected to have the correct slanting? Now, the cev arrow slants to the left, while the vec arrow (as well as the italic letter) slants to the right.
          – Qrrbrbirlbel
          May 17 '15 at 0:21










        • @Qrrbrbirlbel That's more difficult.
          – egreg
          May 17 '15 at 9:13










        • @user49915 I get picture (click), which doesn't show so big a difference with cev{x}
          – egreg
          Dec 1 at 15:09










        • I apologize and removed my prior comment, which was misleading. With default CM fonts, yours (cev{sigma}) is ok. It gets ugly when you use usepackage[slantedGreek]{newtxmath} or usepackage{newtxmath}. In this situation, (cev{sigma}) produces the leftarrow that is shifted too much to the right. Is there a way to center the left arrow above the symbol automatically?
          – user49915
          Dec 1 at 15:24












        • @user49915 Maybe you want to try the different implementation I added, maybe fixing the amount of mkern.
          – egreg
          Dec 1 at 15:25








        2




        2




        Can the arrow be rotated instead of reflected to have the correct slanting? Now, the cev arrow slants to the left, while the vec arrow (as well as the italic letter) slants to the right.
        – Qrrbrbirlbel
        May 17 '15 at 0:21




        Can the arrow be rotated instead of reflected to have the correct slanting? Now, the cev arrow slants to the left, while the vec arrow (as well as the italic letter) slants to the right.
        – Qrrbrbirlbel
        May 17 '15 at 0:21












        @Qrrbrbirlbel That's more difficult.
        – egreg
        May 17 '15 at 9:13




        @Qrrbrbirlbel That's more difficult.
        – egreg
        May 17 '15 at 9:13












        @user49915 I get picture (click), which doesn't show so big a difference with cev{x}
        – egreg
        Dec 1 at 15:09




        @user49915 I get picture (click), which doesn't show so big a difference with cev{x}
        – egreg
        Dec 1 at 15:09












        I apologize and removed my prior comment, which was misleading. With default CM fonts, yours (cev{sigma}) is ok. It gets ugly when you use usepackage[slantedGreek]{newtxmath} or usepackage{newtxmath}. In this situation, (cev{sigma}) produces the leftarrow that is shifted too much to the right. Is there a way to center the left arrow above the symbol automatically?
        – user49915
        Dec 1 at 15:24






        I apologize and removed my prior comment, which was misleading. With default CM fonts, yours (cev{sigma}) is ok. It gets ugly when you use usepackage[slantedGreek]{newtxmath} or usepackage{newtxmath}. In this situation, (cev{sigma}) produces the leftarrow that is shifted too much to the right. Is there a way to center the left arrow above the symbol automatically?
        – user49915
        Dec 1 at 15:24














        @user49915 Maybe you want to try the different implementation I added, maybe fixing the amount of mkern.
        – egreg
        Dec 1 at 15:25




        @user49915 Maybe you want to try the different implementation I added, maybe fixing the amount of mkern.
        – egreg
        Dec 1 at 15:25










        up vote
        7
        down vote













        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}
        renewcommandvec[1]{overrightarrow{#1}}
        newcommandcev[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



























          up vote
          7
          down vote













          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}
          renewcommandvec[1]{overrightarrow{#1}}
          newcommandcev[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

























            up vote
            7
            down vote










            up vote
            7
            down vote









            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}
            renewcommandvec[1]{overrightarrow{#1}}
            newcommandcev[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














            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}
            renewcommandvec[1]{overrightarrow{#1}}
            newcommandcev[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














            share|improve this answer



            share|improve this answer








            edited Oct 19 '11 at 20:55









            egreg

            703k8618733148




            703k8618733148










            answered Apr 5 '11 at 13:56









            Frédéric Grosshans

            684517




            684517






















                up vote
                6
                down vote













                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:



                defcev{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



























                  up vote
                  6
                  down vote













                  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:



                  defcev{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

























                    up vote
                    6
                    down vote










                    up vote
                    6
                    down vote









                    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:



                    defcev{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














                    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:



                    defcev{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














                    share|improve this answer



                    share|improve this answer








                    edited Apr 6 '11 at 18:47

























                    answered Apr 6 '11 at 18:26









                    morbusg

                    19.9k361136




                    19.9k361136






















                        up vote
                        2
                        down vote













                        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



























                          up vote
                          2
                          down vote













                          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

























                            up vote
                            2
                            down vote










                            up vote
                            2
                            down vote









                            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














                            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














                            share|improve this answer



                            share|improve this answer








                            edited Mar 20 '13 at 13:25









                            percusse

                            136k12253493




                            136k12253493










                            answered Mar 20 '13 at 13:22









                            Herng Yi

                            330111




                            330111






























                                draft saved

                                draft discarded




















































                                Thanks for contributing an answer to TeX - LaTeX Stack Exchange!


                                • Please be sure to answer the question. Provide details and share your research!

                                But avoid



                                • Asking for help, clarification, or responding to other answers.

                                • Making statements based on opinion; back them up with references or personal experience.


                                To learn more, see our tips on writing great answers.





                                Some of your past answers have not been well-received, and you're in danger of being blocked from answering.


                                Please pay close attention to the following guidance:


                                • Please be sure to answer the question. Provide details and share your research!

                                But avoid



                                • Asking for help, clarification, or responding to other answers.

                                • Making statements based on opinion; back them up with references or personal experience.


                                To learn more, see our tips on writing great answers.




                                draft saved


                                draft discarded














                                StackExchange.ready(
                                function () {
                                StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2ftex.stackexchange.com%2fquestions%2f15010%2fvecx-but-with-arrow-from-right-to-left%23new-answer', 'question_page');
                                }
                                );

                                Post as a guest















                                Required, but never shown





















































                                Required, but never shown














                                Required, but never shown












                                Required, but never shown







                                Required, but never shown

































                                Required, but never shown














                                Required, but never shown












                                Required, but never shown







                                Required, but never shown







                                Popular posts from this blog

                                How to change which sound is reproduced for terminal bell?

                                Title Spacing in Bjornstrup Chapter, Removing Chapter Number From Contents

                                Can I use Tabulator js library in my java Spring + Thymeleaf project?