我一直使用 XeLaTeX + polyglossia 软件包来编写泰语文档。直到最近才出现问题。令我困惑的是,我使用了之前运行良好的相同代码,但不知何故现在它不再起作用了……
这是我的代码片段
%!TEX TS-program = xelatex
%!TEX encoding = UTF-8 Unicode
\documentclass[11pt, a4paper]{report}
\usepackage{fontspec}
\usepackage{polyglossia}
\setmainlanguage{english}
\setotherlanguage[numerals=arabic]{thai}
\newfontfamily{\thaifont}[Script=Thai, Scale=1.3]{TH Sarabun New:script=thai}
\XeTeXlinebreaklocale 'th_TH'
\newfontfamily{\sans}[Scale=1.0]{Helvetica}
\newfontfamily{\thai}[Scale=1.3]{TH Sarabun New}
\newfontfamily{\thaiit}[Scale=1.3]{TH Sarabun New Italic}
\newfontfamily{\thaibf}[Scale=1.3]{TH Sarabun New Bold}
\newfontfamily{\thaibi}[Scale=1.3]{TH Sarabun New Bold Italic}
据我所知,上述代码应该没有问题……以前也运行良好。然而,最近它产生了一个错误……
以下是日志文件中的相关部分
(/opt/local/share/texmf-texlive/tex/latex/polyglossia/gloss-english.ldf
File: gloss-english.ldf polyglossia: module for english)
Package polyglossia Info: Default language is english.
(/opt/local/share/texmf-texlive/tex/latex/polyglossia/gloss-thai.ldf
File: gloss-thai.ldf polyglossia: module for thai)
Package fontspec Warning: Font "TH Sarabun New:script=thai" does not contain
(fontspec) requested Script "Thai".
Package fontspec Info: Font family 'THSarabunNew:script=thai(0)' created for
(fontspec) font 'TH Sarabun New:script=thai' with options
(fontspec) [Script=Thai,Scale=1.3].
(fontspec)
(fontspec) This font family consists of the following NFSS
(fontspec) series/shapes:
(fontspec)
(fontspec) - 'normal' (m/n) with NFSS spec.: <->s*[1.3]"TH Sarabun
(fontspec) New:script=thai/OT:script=latn;language=DFLT;"
(fontspec) - 'small caps' (m/sc) with NFSS spec.:
(fontspec) - 'bold' (bx/n) with NFSS spec.: <->s*[1.3]"TH Sarabun
(fontspec) New:script=thai/B/OT:script=latn;language=DFLT;"
(fontspec) - 'bold small caps' (bx/sc) with NFSS spec.:
(fontspec) - 'italic' (m/it) with NFSS spec.: <->s*[1.3]"TH
(fontspec) Sarabun
(fontspec) New:script=thai/I/OT:script=latn;language=DFLT;"
(fontspec) - 'italic small caps' (m/itsc) with NFSS spec.:
(fontspec) - 'bold italic' (bx/it) with NFSS spec.: <->s* [1.3]"TH
(fontspec) Sarabun
(fontspec) New:script=thai/BI/OT:script=latn;language=DFLT;"
(fontspec) - 'bold italic small caps' (bx/itsc) with NFSS spec.:
Package fontspec Info: Font family 'THSarabunNew(0)' created for font 'TH
(fontspec) Sarabun New' with options [Scale=1.3].
(fontspec)
(fontspec) This font family consists of the following NFSS
(fontspec) series/shapes:
(fontspec)
(fontspec) - 'normal' (m/n) with NFSS spec.: <->s*[1.3]"TH Sarabun
(fontspec) New/OT:script=latn;language=DFLT;"
(fontspec) - 'small caps' (m/sc) with NFSS spec.:
(fontspec) - 'bold' (bx/n) with NFSS spec.: <->s*[1.3]"TH Sarabun
(fontspec) New/B/OT:script=latn;language=DFLT;"
(fontspec) - 'bold small caps' (bx/sc) with NFSS spec.:
(fontspec) - 'italic' (m/it) with NFSS spec.: <->s*[1.3]"TH
(fontspec) Sarabun New/I/OT:script=latn;language=DFLT;"
(fontspec) - 'italic small caps' (m/itsc) with NFSS spec.:
(fontspec) - 'bold italic' (bx/it) with NFSS spec.: <->s*[1.3]"TH
(fontspec) Sarabun New/BI/OT:script=latn;language=DFLT;"
(fontspec) - 'bold italic small caps' (bx/itsc) with NFSS spec.:
./Misc58_ex.tex:39: LaTeX3 Error: Command '\thai' already defined!
For immediate help type H <return>.
我觉得 fontspec 包确实有问题。有什么方法可以解决或规避这个问题吗?
PS. 我在 Macport (Mac OS X Mojave) 中使用 TeXShop 4.27 和 xelatex。据我所知,一切都是最新的