%EF%BC%9F.png)
我有以下程式碼。
\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}
為什麼我得到一個黑色矩形而不是 aj 單位向量?
答案1
\imath
和符號\jmath
並非來自您的文字字體,該字體helvet
設定為 TeX Gyre Heros。除非您更改它,否則它們來自 7 位元 OML 字體。在本例中,您嘗試使用 來執行此操作mathastext
。
您可能想顯式加載tgheros
,其中包含 ĵ 和 ş 字形,而不是helvet
。
因此,您的選擇包括:
unicode-math
使用無襯線數學字型載入。截至 2020 年,這意味著 Fira Math。- 加載無襯線數學包,例如
sansmathfonts
,arev
或newtxsf
。 - 在數學模式下使用文字模式符號。將符號定義
\varj
為類似\textnormal{\sffamily\itshape\selectfont \j}
和\varjhat
的東西\textnormal{\sffamily\itshape\selectfont ĵ}
。 - 如上所述,但加載
fontspec
和使用ĵ來自 Unicode 字體。
答案2
helvet 沒有字形,因此您會得到.notdef
字形的符號。
您可以停用 mathastext 嘗試重新定義它的功能。不要到處寫 \mathit,而是使用 mathastext 的斜體選項。
請注意,helvet 不是數學字體。它缺少字符和許多數學符號,恕我直言,結果看起來相當糟糕。您可以使用選項 eulergreek 來改進希臘語(但希臘語將是直立的),但箭頭和重音符號仍然看起來太細。
\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}