
我正在嘗試製作一個投影機演示文稿,其中僅更改文字字體,但數學保持不變。我本來以為這樣就可以了
\documentclass[english]{beamer}
\usepackage[no-math]{fontspec}
\setsansfont{Arial}
\begin{document}
\begin{frame}
This is a test. $f(x) = \pi \approx 3.14159$
\end{frame}
\end{document}
但它也取代了數學字體,儘管我使用了 [no-math] 選項。
答案1
您應該使用unicode-math
設定數學字體:
\documentclass{beamer}
\usefonttheme{professionalfonts} % needed for fontspec to work properly in beamer
\usepackage{fontspec}
\setsansfont{Arial}
\usepackage{mathtools} % should be loaded before unicode-math
\usepackage{unicode-math}
\setmathfont{Latin Modern Math} % or any of the other opentype math fonts
\begin{document}
\begin{frame}
This is a test. $f(x) = \pi \approx 3.14159$
\end{frame}
\end{document}