我使用 LuaLatex 并加载
\usepackage{fontsetup}
一切正常。
我的问题是,我在任何地方都没有找到:如何在字体之间切换?
例如,我只是想用不同的字体写一个句子。
有没有切换字体的命令?
谢谢
答案1
您无法更改 定义的一种(主)字体fontsetup
。
但是您可以定义新的字体系列来更改文档中间的字体。
% !TeX TS-program = lualatex
\documentclass{article}
\usepackage[default]{fontsetup}
\RequirePackage{ebgaramond}
\newfontfamily{\Garamond}[%
UprightFont=*-Regular,%
Extension = .otf,%
ItalicFont=*-Italic.otf,%
BoldFont=*-SemiBold.otf,%
BoldItalicFont=*-BoldItalic.otf,%
]{EBGaramond}
\RequirePackage{xcharter-otf}
\newfontfamily{\XCharter}[%
Extension = .otf,%
UprightFont=*-RegularCondensed,%
ItalicFont=*-ItalicCondensed.otf,%
BoldFont=*-SemiBoldCondensed.otf,%
BoldItalicFont=*-SemiboldItalicCondensed.otf,%
Scale=MatchLowercase
]{CabinCondensed}
\begin{document}
\section{Default (main font)}
This package is a simple wrapper-type package that makes the setup of fonts easy and
quick for XeLaTeX and LuaLaTeX. You just load the package using one of the supported
fonts as an option.
\section{EBGaramond bold italic}
{\Garamond \bfseries \itshape The target is to provide easy access to fonts with a matching Mathematics font available in
TeX distributions plus a few commercial if available.}
\section{Default again}
The package will include more font combinations in the future, however there are
some restrictions. The fonts must have some commercial-level quality and must support
Mathematics.
\section{CabinCondensed}
{\XCharter Starting with version 1.01 the package is split in two; the main package called ``fontsetup''
and the fontsetup-nonfree package that contains the support and sample files for the
non-free fonts. This facilitates the installation for users of texlive since the latter does not
install the support for non-free fonts. For a user who wants to install the support for
non-free fonts (Cambria, Lucida, Adobe-Minion, MS-Garamond, and Linotype-Palatino) it can be
easily done following the guide for the contrib repository here}
\end{document}
我发现软件包文档有点误导。听起来好像它在文档中间更改了字体,但实际上它正在加载独立生成的 PDF 图像。