Lualatex 允许直接加载字体,无需包和其他依赖项。
我发现的问题是,pdflatex 和旧样式的用法有很好的文档记录,而使用 fontspec 命令的 lualatex 的用法没有文档记录。对于大多数用户来说,这仍然是加载包的最佳方式,但这似乎并不存在。
以下是我为 pdflatex 编写的一些示例,我想知道正确的 lualatex 方法。旧代码只能与\usepackage[T1]{fontenc}
MWE 示例
\documentclass[]{scrbook}
\usepackage{amsmath}
\usepackage{esint}
%\usepackage{unicode-math} % works not with old font loading
%\usepackage{fontspec}
\usepackage[T1]{fontenc}
\usepackage{mathptmx} %% --- Times (incl math)
\usepackage[scaled=.90]{helvet} %% --- Helvetica (Arial)
\usepackage{courier} %% --- Courier
\begin{document}
\chapter*{Font Test}
The text on these pages demonstrates the appearance of the used fonts for serif, \textsf{sans serif}, math and \texttt{typewriter fonts}.
%
\subsection*{Green's theorem}
\begin{equation}
\underset{\mathcal{G}\quad}\iiint
\left[u\nabla^{2}v+\left(\nabla u,\nabla v\right)\right]\mathrm{d}^{3}V
=\underset{\mathcal{S}\quad}\oiint u\,\frac{\partial v}{\partial n}
\,\,\mathrm{d}^{2}A
\end{equation}
\end{document}
这里还有一些我正在寻找字体规范定义的其他字体代码组合
% lmodern with sans math
\usepackage{lmodern}
\DeclareMathVersion{sans}
% Math letters from Latin Modern Sans
\SetSymbolFont{letters}{sans}{OML}{cmbr}{m}{it}
% Math operators
\SetSymbolFont{operators}{sans}{OT1}{lmss}{m}{n}
% Math symbols
\SetSymbolFont{symbols}{sans}{OMS}{lmsy}{m}{n}
% Large symbols
\SetMathAlphabet{\mathrm}{sans}{OT1}{lmr}{m}{n}
\SetMathAlphabet{\mathsf}{sans}{OT1}{lmss}{m}{n}
\SetMathAlphabet{\mathit}{sans}{OT1}{lmr}{m}{it}
% -> Palantino, Helvetica, Courier
\usepackage{mathpazo} %% --- Palantino (incl math)
\usepackage[scaled=.95]{helvet} %% --- Helvetica (Arial)
\usepackage{courier} %% --- Courier
% -> Charter, Bera Sans, Luxi Mono
\usepackage{charter}\linespread{1.05} %% --- Charter
\renewcommand{\sfdefault}{fvs} %% --- Bera Sans
\usepackage[charter]{mathdesign} %% --- Charter (Math)
\usepackage[scaled=0.85]{luximono} %% --- Luxi Mono (Typewriter)
% -> URW Garamond
\renewcommand{\rmdefault}{ugm} %% --- URW Garamond
\renewcommand{\sfdefault}{fvs} %% --- Bera Sans
\usepackage[Garamond]{mathdesign} %% --- Garamond (Math)
\usepackage[scaled=0.85]{luximono} %% --- Luxi Mono (Typewriter)
% -> Fourier (Utopia), Latin Modern (Sans and Typewriter)
\usepackage{lmodern}
\usepackage{fourier}
答案1
作为当前字体的替换,您可以尝试以下操作(取消注释要测试的字体集):
\documentclass[a4paper,openany]{scrbook}
\usepackage{amsmath}
\usepackage{unicode-math}
% -> Times, Arial, Courier (licence issues ???)
\setmainfont{TeX Gyre Termes X}
\setsansfont{Arial}[Scale=MatchLowercase] % msttcorefonts on Debian
\setmonofont{Courier 10 Pitch}[Scale=MatchLowercase]
\setmathfont{Latin Modern Math}
% -> Times, Arial, Courier
%\setmainfont{TeX Gyre Termes X}
%\setsansfont{TeX Gyre Heros}[Scale=MatchLowercase]
%\setmonofont{TeX Gyre Cursor}[Scale=MatchLowercase]
%\setmathfont{TeX Gyre Termes Math}
% -> Palatino, Arial, Courier
%\setmainfont{TeX Gyre Pagella X}
%\setsansfont{TeX Gyre Heros}[Scale=MatchLowercase]
%\setmonofont{TeX Gyre Cursor}[Scale=MatchLowercase]
%\setmathfont{TeX Gyre Termes Math}
%-> Charter, Bera Sans, Luxi Mono
%\usepackage{xcharter-otf}
%\setsansfont{Cabin}[Scale=MatchLowercase]
%\setmonofont{Luxi Mono}[Scale=MatchLowercase]
% -> URW Garamond, Bera Sans, Luxi Mono
%\usepackage{ebgaramond}
%\setsansfont{Fira Sans}[Scale=MatchLowercase]
%\setmonofont{Luxi Mono}[Scale=MatchLowercase]
%\setmathfont{Garamond-Math}
% -> Fourier (Utopia), Latin Modern (Sans and Typewriter)
%\usepackage{fourier-otf}
\begin{document}
%\showoutput
\chapter*{Font Test}
The text on these pages demonstrates the appearance of the used fonts
for serif, \textsf{sans serif}, math and \texttt{typewriter fonts}.
%
\subsection*{Green's theorem}
\begin{equation}
\underset{\mathcal{G}\quad}\iiint
\left[u\nabla^{2}v+\left(\nabla u,\nabla v\right)\right] \mathrm{d}^{3}V
=\underset{\mathcal{S}\quad}\oiint u\,\frac{\partial v}{\partial n}
\,\,\mathrm{d}^{2}A
\end{equation}
\end{document}
您不能期望一对一地替换您的 Type1 字体。但是,已经有大量免费的 OpenType 文本/数学字体可供使用。