4

I've the following code.

\documentclass{article}
\usepackage[T1]{fontenc}
\usepackage[scaled]{helvet}
\renewcommand*\familydefault{\sfdefault}
\usepackage[utf8]{inputenc}
\usepackage{amsmath}
\usepackage{amssymb}
\usepackage{mathastext}

\begin{document}
\begin{equation*}
\overrightarrow{\mathit{r}}=\mathit{r}\cos \mathit{\varphi}\widehat{\mathrm{\imath}}+\mathit{r}\sin \mathit{\varphi} \widehat{\mathrm{\jmath}}
\end{equation*}
\end{document}

enter image description here

Why did I get a black rectangle instead of a j unit vector?

2
  • Welcome to TeX.SE.
    – Mico
    Sep 11, 2020 at 5:08
  • 2
    If you are fine with changing your font, you can use Fira Math which provides unicode-support. It contains dotless i and dotless j. That way, you can get greek letters which match sans-serif style as well. I don't know of any other sans-serif font with unicode-support. Sep 11, 2020 at 5:19

2 Answers 2

8

The \imath and \jmath symbols don’t come from your text font, which helvet sets to TeX Gyre Heros. Unless you change it, they come from the 7-bit OML font. In this case, you’re trying to do so with mathastext.

You probably want to explicitly load tgheros, which does contain the ĵ and ȷ glyphs, rather than helvet.

Your options therefore include:

  • Load unicode-math with a sans-serif math font. As of 2020, that means Fira Math.
  • Load a sans-serif math package, such as sansmathfonts, arev or newtxsf.
  • Use the text-mode symbol in math mode. Define the symbol \varj as something like \textnormal{\sffamily\itshape\selectfont \j} and \varjhat as \textnormal{\sffamily\itshape\selectfont ĵ}.
  • As above, but load fontspec and use ĵ from a Unicode font.
6

helvet doesn't have the glyph and so you get the symbol for the .notdef glyph.

You could deactivate that mathastext tries to redefine it. And instead of writing \mathit everywhere, use the italic option of mathastext.

Be aware that helvet is not a math font. It misses chars and a number of math symbols, and imho the result looks rather bad. You can improve the greek e.g. with the option eulergreek (but then greek will be upright), but the arrows and accents still look too thin.

\documentclass{article}
\usepackage[T1]{fontenc}
\usepackage[scaled]{helvet}
\renewcommand*\familydefault{\sfdefault}
%\usepackage[utf8]{inputenc} %unneeded in current tex systems
\usepackage{amsmath}
\usepackage{amssymb}
\usepackage[italic,defaultimath]{mathastext}
\begin{document}
\begin{equation*}
\overrightarrow{r}=r\cos \varphi\widehat{\mathrm{\inodot}}+r\sin \varphi \widehat{\jmath} 
\end{equation*}
\end{document}

enter image description here

You must log in to answer this question.

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