使用 LuaLaTeX 进行编译,使用 Bradley Hand Font 可以通过 beamer 用于正文和数学运算;但我想知道如何使用标准文章样式为数学运算呈现 Bradley Hand 字体。-谢谢。
%\documentclass[11pt]{article}
\documentclass{beamer} %
\usefonttheme{serif}%
\usepackage{fontspec}
\usepackage{mathpazo}
%\setmainfont{Bradley Hand ITC TT Bold}%used Bold, since that's what was bundled w/ Mac OS X
\setmainfont{BradleyHandITC} %Postscript name of TT added as user font on MacOS X
\begin{document}
\section{Section}
This is a font test.
\[ E = m c^2 \]
\[ L = \alpha \int_0^1 \, dx, \quad \vec{P} = \int_{0}^{\infty} \sum_{i =1}^{2} {\varphi}_i d \gamma \]
\end{document}
然而,当我尝试使用文章样式而不是投影仪时,主文本用字体呈现,但数学却没有。
\documentclass[11pt]{article}
%\documentclass{beamer}
%\usefonttheme{serif}%
\usepackage{fontspec}
\usepackage{mathpazo}
%\setmainfont{Bradley Hand ITC TT Bold}%used Bold, since that's what was bundled w/ Mac OS X
\setmainfont{BradleyHandITC} %Postscript name of TT added as user font on MacOS X
\begin{document}
\section{Section}
This is a font test.
\[ E = m c^2 \]
\[ L = \alpha \int_0^1 \, dx, \quad \vec{P} = \int_{0}^{\infty} \sum_{i =1}^{2} {\varphi}_i d \gamma \]
\end{document}
还有一个问题。如何让 \section{} 和/或选定的文本仅使用粗体 Bradley Hand ITC TT Bold,而不是 Regular。-谢谢。
答案1
您可以使用该mathastext
包来获得与 beamer 相同的行为,即文本模式下的符号被普通文本字体中的符号替换:
% !TeX TS-program = lualatex
\documentclass[11pt]{article}
%\documentclass{beamer}
%\usefonttheme{serif}%
\usepackage{fontspec}
\usepackage{mathpazo}
%\setmainfont{Bradley Hand ITC TT Bold}%used Bold, since that's what was bundled w/ Mac OS X
\setmainfont{Bradley Hand} %Postscript name of TT added as user font on MacOS X
\usepackage{mathastext}
\begin{document}
\section{Section}
This is a font test.
\[ E = m c^2 \]
\[ L = \alpha \int_0^1 \, dx, \quad \vec{P} = \int_{0}^{\infty} \sum_{i =1}^{2} {\varphi}_i d \gamma \]
\end{document}
答案2
我不熟悉beamer
文档类如何进行字体替换。但我可以建议您加载包unicode-math
并利用其range
机制,就像下面的示例一样。
% !TEX TS-program = lualatex
\documentclass{article}
\usepackage{unicode-math}
\setmainfont{Bradley Hand Bold} % what's bundled w/ MacOS
\setmathfont{KpMath-Regular} % set a default math font
\setmathfont{Bradley Hand Bold}[range={up,it}]
%% unicode slots for int, sum, infty, = glyphs:
\setmathfont{Bradley Hand Bold}[range={"222B,"2211,"221E,"003D}]
\begin{document}
\section{Section}
This is a font test.
\[
E = mc^2, \quad
L = \alpha \int_0^{\,1} dx, \quad
\vec{P} = \int_{0}^{\,\infty} \sum_{i=1}^2 \varphi_i \, d\gamma
\]
\end{document}
附录:如果省略\setmathfont{Bradley Hand Bold}[...]
上述代码中的 final 指令,则会得到:
第二附录: 楼主还问了,
如何仅使
\section
和/或选定的文本使用粗体 Bradley Hand ITC TT Bold,而不是 Regular?
假设您使用一个基本的 LaTeX 文档类,即 、article
或report
,book
或者基于其中一个基本类的文档类,则可以使用该sectsty
包来实现与分段相关的格式化目标。要对选定的文本片段使用 Bradley Hand Bold 字体,我建议您使用\newfontfamily
该fontspec
包的机制。
% !TEX TS-program = lualatex
\documentclass{article}
\usepackage{fontspec}
\newfontfamily{\bradley}{Bradley Hand Bold} % what's shipped with MacOS
\usepackage{sectsty}
\allsectionsfont{\bradley}
\begin{document}
\section{Hello}
\subsection{World}
Once upon a {\bradley time}, there {\bradley was} an enchanted castle \dots
\end{document}