我正在尝试为阿尔巴尼亚语添加连字符。修改 languages.ini 并添加相应文件后,格式无法读取模式中的两个字母(ë 和 ç)。
这是添加于language.ini
:
[albanian]
loader=loadhyph-al.tex
lefthyphenmin=2
righthyphenmin=2
patterns=hyph-al.pat.txt
hyphenation=hyph-al.hyp.txt
这是的内容loadhyph-al.tex
:
\begingroup
\lccode`\'=`\'
% Test for pTeX
\ifx\kanjiskip\undefined
% Test for native UTF-8 (which gets only a single argument)
% That's Tau (as in Taco or ΤΕΧ, Tau-Epsilon-Chi), a 2-byte UTF-8 character
\def\testengine#1#2!{\def\secondarg{#2}}\testengine Τ!\relax
\ifx\secondarg\empty
% Unicode-aware engine (such as XeTeX or LuaTeX) only sees a single (2-byte) argument
\message{UTF-8 Albanian hyphenation patterns}
\input hyph-al.tex
\input hyph-quote-al.tex
\else
% 8-bit engine (such as TeX or pdfTeX)
\message{ASCII Albanian hyphenation patterns}
\input hyph-al.tex
\fi\else
% pTeX
\message{ASCII Albanian hyphenation patterns}
\input hyph-al.tex
\fi
\endgroup
这是的内容hyph-al.tex
:
\patterns{
.bashkë1
.dh2
.fj8
.çm8 }
这是的内容hyph-quote-al.tex
:
\bgroup
\lccode`\’=`\’
\patterns{
2’2
2ç’
2sh’
4s’
2t’
}
\egroup
这是的内容hyph-al.pat.txt
:
.bashkë1
.dh2
.fj8
.çm8
且hyph-al.hyp.txt
是空的。
根据日志,字母 ë 无法被识别:
("C:\Program Files\MiKTeX 2.9\tex\generic\hyph-utf8\patterns\tex\hyph-al.tex"
! Nonletter.
l.45 .bashkÃ
«1
Sorry, but miktex-makefmt did not succeed for the following reason:
miktex-pdftex.exe failed on etex.ini.
我可以添加一些内容以便识别ë和ç吗?
检查了 hyph-tr.tex(土耳其语)和 hyph-fr.tex(法语),但它们只是使用特殊字符,没有任何问题。
[编辑] 解决格式错误后,LuaLaTex 识别了新语言,但 XeLaTeX 却无法识别。
该文件:
\documentclass[11pt]{book}
\usepackage[paperwidth=140mm,paperheight=210mm,top=25mm,bottom=20mm,left=20mm,right=20mm,heightrounded]{geometry}
\usepackage{fancyhdr}
\usepackage{graphicx}
\usepackage{chngcntr}
\usepackage{tocloft}
\usepackage{polyglossia}
\setmainlanguage{albanian}
\begin{document}
test
\end{document}
使用 XeLaTex 编译时回答:
Package polyglossia Warning: No hyphenation patterns were loaded for `Albanian'
(polyglossia) I will use \language=\l@nohyphenation instead on input line 8.
Package polyglossia Warning: \setlocalhyphenmin useless for unhyphenated language albanian on input line 8.
使用 LuaLaTex 编译时回答:
("C:/Program Files/MiKTeX 2.9/tex/latex/polyglossia/gloss-albanian.ldf"
Language data for albanian loader loadhyph-al.tex
righthyphenmin 2
lefthyphenmin 2
patterns hyph-al.pat.txt
hyphenation hyph-al.hyp.txt
synonyms table: 0000018D1841DD20
hyph-al.pat.txt
Language albanian was not yet loaded; created with id 4
Language albanian already loaded; id is 4
Language albanian already loaded; id is 4) (./test-hyphenation2.aux
Language albanian already loaded; id is 4)
答案1
您缺少loadhyph-al.tex
加载 conv-utf8-ec.tex,它添加了非 ascii 字母的定义:
\else
% 8-bit engine (such as TeX or pdfTeX)
\message{ASCII Albanian hyphenation patterns}
\input conv-utf8-ec.tex %<-----------
\input hyph-al.tex
\fi
附注:ptex-case 通常需要自己的一套连字符模式(例如,参见法语加载器,这里使用 hyph-fr.ec.tex)。如果您不想创建它们,我认为最好直接删除这个案例。没有模式总比错误的模式好,