我正在尝试在 LuaLatex (最新的 MiKTex+TexStudio) 中使用带有 fontspec 的多语种,正如 Tobias Oetiker 撰写的《LATEX 2ε 简介》(第 35 页)
\usepackage{polyglossia}
\setdefaultlanguage[ variant=uk]{english}
\setotherlanguage[babelshorthands]{german}
\usepackage[Ligatures=TeX]{fontspec}
然而,这会产生选择冲突
! LaTeX Error: Option clash for package fontspec.
See the LaTeX manual or LaTeX Companion for explanation.
Type H <return> for immediate help.
...
l.30
The package fontspec has already been loaded with options:
[]
There has now been an attempt to load it with options
[Ligatures=TeX]
Adding the global options:
,Ligatures=TeX
to your \documentclass declaration may fix this.
Try typing <return> to proceed.
polyglossia 是否可能加载了 fontspec,并产生了冲突?
答案1
您必须fontspec
先加载polyglossia
。没有Liagtures=TeX
选项,但您可以使用启用字体功能\addfontfeatures
。Ligatures=TeX
在最新版本的中也默认启用fontspec
。
\documentclass{article}
\usepackage{fontspec}
%\addfontfeatures{Ligatures=TeX} % is enabled by default
\usepackage{polyglossia}
\setdefaultlanguage[variant=uk]{english}
\setotherlanguage[babelshorthands]{german}
\begin{document}
foo
\end{document}
答案2
如果您不知道哪些选项polyglossia
传递给 fontspec,请使用:
\PassOptionsToPackage{...the options ...}{fontspec}
\documentclass{article}
\usepackage{polyglossia}
\setdefaultlanguage[variant=uk]{english}
\setotherlanguage[babelshorthands]{german}
\begin{document}
foo
\end{document}
但是,最新版本fontspec
没有针对特定字体功能的有效可选参数。