2

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}
2
  • 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? Feb 22, 2016 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). Feb 22, 2016 at 16:17

1 Answer 1

2

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}

enter image description here

6
  • 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"? Feb 22, 2016 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 }. Feb 22, 2016 at 16:46
  • But, why do I have to redefine vec at all? What is going on? Feb 22, 2016 at 16:54
  • @fuzzybear3965 It is probably a bug in the package, but veryfying it needs more time. Feb 22, 2016 at 17:13
  • @fuzzybear3965 -- there are known problems with the \vec accent definitions; this is on the list of amsmath bugs that need attention. Feb 22, 2016 at 17:13

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .