关于如何为 luaLatex 设置字体系列的通用指南

关于如何为 luaLatex 设置字体系列的通用指南

TEX 和 LATEX 免费数学字体调查是 Latex 中协调字体的很好例子。

例如考虑以下文本片段CM 明亮

在此处输入图片描述

pdfLatex只需使用就足够了\usepackage{cmbright},但我很难在luaLatex。这看起来要复杂得多。

经过几个小时的尝试和阅读字体规范文档我即将回到pdfLatex

你能指导我如何使用CM 明亮在 luaLatex 中?

在 luaLatex 中设置新字体系列(包括数学)的一般方法是什么

文档中以某种方式进行了解释,但很抱歉,LaTeX 人员并不是编写全面文档方面的佼佼者。

以下是 MWE:

前言:

\documentclass[a4paper]{article}

\usepackage{unicode-math}
\usepackage{amsmath}
\usepackage{fontspec}          % lualatex font engine


\setmainfont[Numbers = Uppercase,
             Ligatures = TeX,
             BoldFont  = CMU Bright SemiBold,
             ItalicFont = CMU Bright Oblique,
            ]{CMU Bright Roman} 

文档:

\begin{document}

\section{Let's try!}

\textbf{Theorem 1 (Residue Theorem).}
Let $f$ be analytic in the region $G$ except for the isolated singularities $a_1,a_2,\ldots,a_m$. If $\gamma$ is a closed rectifiable curve in $G$ which does not pass through any of the points $a_k$ and if $\gamma\approx 0$ in $G$ then
\[
\frac{1}{2\pi i}\int_\gamma f = \sum_{k=1}^m n(\gamma;a_k) \text{Res}(f;a_k).
\]

\textbf{Theorem 2 (Maximum Modulus).}
\emph{Let $G$ be a bounded open set in $\mathbb{C}$ and suppose that $f$ is a continuous function on $G^-$ which is analytic in $G$. Then}
\[
\max\{|f(z)|:z\in G^-\}=\max \{|f(z)|:z\in \partial G \}.
\]
\vspace*{-1em}

\newcommand{\abc}{abcdefghijklmnopqrstuvwxyz}
\newcommand{\ABC}{ABCDEFGHIJKLMNOPQRSTUVWXYZ}
\newcommand{\alphabeta}{\alpha\beta\gamma\delta\epsilon\varepsilon\zeta\eta\theta\vartheta\iota\kappa\varkappa\lambda\mu\nu\xi o\pi\varpi\rho\varrho\sigma\varsigma\tau\upsilon\phi\varphi\chi\psi\omega}
\newcommand{\AlphaBeta}{\Gamma\Delta\Theta\Lambda\Xi\Pi\Sigma\Upsilon\Phi\Psi\Omega}


{\par \tolerance=0 \emergencystretch=100em $a\alpha b \beta c \partial d \delta e \epsilon \varepsilon f \zeta \xi g \gamma h \hbar \hslash \iota i \imath j \jmath k \kappa \varkappa l \ell \lambda m n \eta \theta \vartheta o \sigma \varsigma \phi \varphi \wp p \rho \varrho q r s t \tau \pi u \mu \nu v \upsilon w \omega \varpi x \chi y \psi z$ \linebreak[3] $\infty \propto \emptyset \varnothing \mathrm{d}\eth \backepsilon$\par}

\end{document}

生产:

在此处输入图片描述

因此,文本似乎正确,但数学不正确。在过去几个小时的折腾中,我曾经算对了数学,但标题是错误的。我不记得我是怎么做到的,但我认为这并不重要。

答案1

unicode-math只有当您还拥有一个合理的“unicode math”字体并希望将其用作基础数学字体时才有意义。没有“cm bright math”(无衬线数学字体很稀疏......)。因此,最好以非 unicode 方式进行数学设置:

\documentclass[a4paper,12pt]{article}
\usepackage{cmbright}
\usepackage{amsmath,amssymb}
\usepackage{fontspec}          % lualatex font engine


\setmainfont[Numbers = Uppercase,
             Ligatures = TeX,
             BoldFont  = CMU Bright SemiBold,
             ItalicFont = CMU Bright Oblique,
            ]{CMU Bright Roman} 

\begin{document}

\section{Let's try!}

\textbf{Theorem 1 (Residue Theorem).}
Let $f$ be analytic in the region $G$ except for the isolated singularities $a_1,a_2,\ldots,a_m$. If $\gamma$ is a closed rectifiable curve in $G$ which does not pass through any of the points $a_k$ and if $\gamma\approx 0$ in $G$ then
\[
\frac{1}{2\pi i}\int_\gamma f = \sum_{k=1}^m n(\gamma;a_k) \text{Res}(f;a_k).
\]

\textbf{Theorem 2 (Maximum Modulus).}
\emph{Let $G$ be a bounded open set in $\mathbb{C}$ and suppose that $f$ is a continuous function on $G^-$ which is analytic in $G$. Then}
\[
\max\{|f(z)|:z\in G^-\}=\max \{|f(z)|:z\in \partial G \}.
\]
\vspace*{-1em}

\newcommand{\abc}{abcdefghijklmnopqrstuvwxyz}
\newcommand{\ABC}{ABCDEFGHIJKLMNOPQRSTUVWXYZ}
\newcommand{\alphabeta}{\alpha\beta\gamma\delta\epsilon\varepsilon\zeta\eta\theta\vartheta\iota\kappa\varkappa\lambda\mu\nu\xi o\pi\varpi\rho\varrho\sigma\varsigma\tau\upsilon\phi\varphi\chi\psi\omega}
\newcommand{\AlphaBeta}{\Gamma\Delta\Theta\Lambda\Xi\Pi\Sigma\Upsilon\Phi\Psi\Omega}


{\par \tolerance=0 \emergencystretch=100em $a\alpha b \beta c \partial d \delta e \epsilon \varepsilon f \zeta \xi g \gamma h \hbar \hslash \iota i \imath j \jmath k \kappa \varkappa l \ell \lambda m n \eta \theta \vartheta o \sigma \varsigma \phi \varphi \wp p \rho \varrho q r s t \tau \pi u \mu \nu v \upsilon w \omega \varpi x \chi y \psi z$ \linebreak[3] $\infty \propto \emptyset \varnothing \mathrm{d}\eth \backepsilon$\par}

\end{document} 

相关内容