众所周知,土耳其语中,i
有两种不同的字母形式,一种带点,一种不带点(发音截然不同):带点字母组合i / İ
和不带点字母组合ı / I
。
请考虑以下代码:
\documentclass[a4paper,12pt]{article}
\usepackage{ifxetex,ifluatex}
\usepackage{fontspec}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\ifluatex
\usepackage[turkish,italian]{babel}
\babelfont[italian]{rm}[Ligatures=TeX]{Garamond Premier Pro}
\babelfont[turkish]{rm}[Ligatures=TeX]{Garamond Premier Pro}
\fi
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\ifxetex
\setmainfont[Ligatures=TeX]{Garamond Premier Pro}
\usepackage{polyglossia}
\setmainlanguage[babelshorthands=true]{italian}
\setotherlanguage{turkish}
\fi
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\begin{document}
\textbf{Italian}
\verb!\MakeUppercase{aabbccddiixx}! \MakeUppercase{aabbccddiixx}
\verb!\MakeUppercase{aabbccddııxx}! \MakeUppercase{aabbccddııxx}
\verb!\MakeLowercase{AABBCCDDİİ}! \MakeLowercase{AABBCCDDİİ}
\verb!\MakeLowercase{AABBCCDDII}! \MakeLowercase{AABBCCDDII}
fi ffi
\textbf{Turkish}
\selectlanguage{turkish}
\verb!\MakeUppercase{aabbccddiixx}! \MakeUppercase{aabbccddiixx}
\verb!\MakeUppercase{aabbccddııxx}! \MakeUppercase{aabbccddııxx}
\verb!\MakeLowercase{AABBCCDDİİ}! \MakeLowercase{AABBCCDDİİ}
\verb!\MakeLowercase{AABBCCDDII}! \MakeLowercase{AABBCCDDII}
fi ffi
\end{document}
如果你使用 Xelatex 进行编译,所有替换都可以正常工作。但是如果你使用 Lualatex 进行编译,则两个i
会消失:
这种不同的行为取决于什么? Lualatex 有解决方案吗? 我也可以修改字体的一些查找,但我必须首先了解发生这种情况的原因。
谢谢
后记 8月1日
我意识到 turkish.ldf 有一个新版本(2019/07/05 v1.4),但编译相同的文件时我收到:
(/usr/local/texlive/2019/texmf-dist/tex/generic/babel/locale/tr/babel-turkish.t
ex
! LaTeX Error: Can be used only in preamble.
See the LaTeX manual or LaTeX Companion for explanation.
Type H <return> for immediate help.
...
l.13 \StartBabelCommands
*{turkish}{}
?
! Undefined control sequence.
l.14 \SetCase
?
! Missing number, treated as zero.
<to be read again>
\relax
l.15 {\uccode`i=
`İ\relax
?
! Missing number, treated as zero.
<to be read again>
\relax
l.16 \uccode`ı=
`I\relax}
?
! Missing number, treated as zero.
<to be read again>
\relax
l.17 {\lccode`İ=
`i\relax
?
! Missing number, treated as zero.
<to be read again>
\relax
l.18 \lccode`I=
`ı\relax}
?
! Undefined control sequence.
l.19 \SetHyphenMap
{%
?
! LaTeX Error: Can be used only in preamble.
See the LaTeX manual or LaTeX Companion for explanation.
Type H <return> for immediate help.
...
l.22 \EndBabelCommands
每次都按 ENTER,最后它编译成功...我做错了什么吗?
答案1
turkish.ldf
已损坏:它太旧了,并且没有考虑到 lualatex 的编码已从 EU2 更改为 TU。
EU1 EU2
ldf 中的两个地方必须更改为TU
:
\StartBabelCommands*{turkish}{captions}
[unicode, charset=utf8, fontenc=EU1 EU2] %<<< e.g. here
通知维护者。
另一种方法是使用新的 babel 接口并通过 ini 加载语言:
\documentclass[a4paper,12pt]{article}
\usepackage{ifxetex,ifluatex}
\usepackage{fontspec}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\usepackage{babel}
\babelprovide[import=tr,main]{turkish}
\babelfont[turkish]{rm}[Ligatures=TeX]{arial}
\begin{document}
\textbf{Turkish}
aabbccddııxx AABBCCDDİİ
\verb!\MakeUppercase{aabbccddiixx}! \MakeUppercase{aabbccddiixx}
\verb!\MakeUppercase{aabbccddııxx}! \MakeUppercase{aabbccddııxx}
\verb!\MakeLowercase{AABBCCDDİİ}! \MakeLowercase{AABBCCDDİİ}
\verb!\MakeLowercase{AABBCCDDII}! \MakeLowercase{AABBCCDDII}
fi ffi
\end{document}