# vec command produces tilde instead of arrow

Upon compilation this generates an "E" with a tilde over it. What I want, of course, is an "E" with an arrow over it. I think this may be a font issue. Does anyone know how to get me what I want?

\documentclass{article}
\usepackage{amsmath}
\usepackage{tikz}
\usepackage[eulergreek]{sansmath}
\tikzstyle{every picture}+=[font=\sffamily\sansmath]

\begin{document}

\begin{tikzpicture}
\node at (0,0) {This math expression should be sans serif and have a vector arrow: $\vec{ E }$.};
\end{tikzpicture}

\end{document}

• Which version are you using? I tested with pdfTeX, Version 3.14159265-2.6-1.40.16 (TeX Live 2015)  and get an arrow as expected. Have you tried with another pdf viewer? Maybe it is a problem of the viewer? – user36296 Feb 22 '16 at 16:12
• @samcarter, Sorry about that. I'm a total fool. I forgot to include the amsmath package that is associated with the error (the question has been edited to include this, now). Omitting this package resolves the issue. Unfortunately, in my particular use case, this is unacceptable (I need amsmath). – fuzzybear3965 Feb 22 '16 at 16:17

A quick solution (please observe \let in the second line):

\documentclass{article}
\let\oldvec\vec
\usepackage{amsmath}
\usepackage{tikz}
\usepackage[eulergreek]{sansmath}
\tikzstyle{every picture}+=[font=\sffamily\sansmath]

\begin{document}

\begin{tikzpicture}
\node at (0,0) {This math expression should be sans serif and have a vector arrow: $\oldvec{ E }$.};
\end{tikzpicture}

\end{document}


• Thanks! I understand that you're overriding the LaTeX command vec before amsmath defines its own version of this command. But, why is this necessary (what's happening)? Is there a better font/typeface that I can use to get a sans serif italics vector E without this "hack"? – fuzzybear3965 Feb 22 '16 at 16:30
• @fuzzybear3965 Without \let you can renew standard definition of \vec in the body of a document, using \def\vec{\mathaccent "017E\relax }. – Przemysław Scherwentke Feb 22 '16 at 16:46
• But, why do I have to redefine vec at all? What is going on? – fuzzybear3965 Feb 22 '16 at 16:54
• @fuzzybear3965 It is probably a bug in the package, but veryfying it needs more time. – Przemysław Scherwentke Feb 22 '16 at 17:13
• @fuzzybear3965 -- there are known problems with the \vec accent definitions; this is on the list of amsmath bugs that need attention. – barbara beeton Feb 22 '16 at 17:13