babel-greek、TexLive 2014 中可能存在错误

babel-greek、TexLive 2014 中可能存在错误

抱歉,我在这里报告了错误,但我想我还是应该这么做。我当前的横幅是:

$ pdflatex -version | grep 'TeX Live'
pdfTeX 3.14159265-2.6-1.40.15 (TeX Live 2014)

该问题似乎在打印古希腊文句子 - comp.text.tex,就我而言,源于这里:在 pdflatex 中获取 Texlive 版本?;无论我尝试哪个例子,都说:

\documentclass{article}

\def\gettexliveversion#1(#2 #3 #4#5#6#7#8)#9\relax{#4#5#6#7}
\edef\texliveversion{\expandafter\gettexliveversion\pdftexbanner\relax}
% \usepackage{unravel}

% [Printing sentence in ancient Greek - Google Groups](https://groups.google.com/forum/?_escaped_fragment_=topic/comp.text.tex/ajGFiDqpvW0#!topic/comp.text.tex/ajGFiDqpvW0)
% fail at step 16200 (16190)
% \unravel{
\usepackage[greek,english]{babel}
\usepackage[utf8]{inputenc}
\ifnum\texliveversion<2013
  \usepackage[LGRx,T1]{fontenc}
\else
  \usepackage[T1]{fontenc}
\fi
% }

\listfiles

\begin{document}

The starting verse of the Iliad is
\begin{quotation}\greektext
Μῆνιν ἄειδε, θεά, Πηληιάδεω Ἀχιλῆος
\end{quotation}
and it's really great.

\end{document}

...失败了:

Package babel Warning: No hyphenation patterns were preloaded for
(babel)                the language `greek' into the format.
(babel)                Please, configure your TeX system to add them and
(babel)                rebuild the format. Now I will use the patterns
(babel)                preloaded for english instead on input line 44.

! Undefined control sequence.
l.50 ...\bbl@monogreek \bbl@monogreek=\l@monogreek

如果我在每个错误出现时继续按 ENTER,最终它会编译一个 PDF,并且列表文件输出为:

 *File List*
 article.cls    2007/10/19 v1.4h Standard LaTeX document class
  size10.clo    2007/10/19 v1.4h Standard LaTeX file (size option)
   babel.sty    2014/09/25 3.9l The Babel package
   greek.ldf    2014/09/18 v1.9b Greek support for the babel system
  lgrenc.def    2013/12/02 v0.11.2 LGR Greek font encoding definitions
greek-fontenc.def    2013/11/28 v0.11 Common Greek font encoding definitions
 english.ldf    2012/08/20 v3.3p English support from the babel system
inputenc.sty    2014/04/30 v1.2b Input encoding file
    utf8.def    2008/04/05 v1.1m UTF-8 support for inputenc
   t1enc.dfu    2008/04/05 v1.1m UTF-8 support for inputenc
  ot1enc.dfu    2008/04/05 v1.1m UTF-8 support for inputenc
  omsenc.dfu    2008/04/05 v1.1m UTF-8 support for inputenc
  lgrenc.dfu    2014/09/14 1.5 UTF-8 support for Greek
 fontenc.sty
   t1enc.def    2005/09/27 v1.99g Standard LaTeX file
  lgrcmr.fd    2013/09/01 v1.0 Greek European Computer Regular
 ***********

comp.text.tex 线程实际上提到:

实际上,为了达到这一步,我编辑了 /usr/share/texlive/texmf-local/texmf-compat/tex/latex/greek.ldf 替换

\ifx\l@monogreek\@undefined
  \adddialect\@monogreek 0\fi
\ifx\l@ancientgreek\@undefined
  \adddialect\@ancientgreek 0\fi

经过

\ifx\l@monogreek\@undefined
  \adddialect\l@monogreek 0\fi
\ifx\l@ancientgreek\@undefined
  \adddialect\l@ancientgreek 0\fi

...

第二个版本\l@monogreek在第二行(对于\@monogreek)有类似的更改,在第四行有类似的更改。

改变之后我的问题就消失了。

对我来说,该代码片段位于/media/texlive/2014/texmf-dist/tex/generic/babel-greek/greek.ldf,并包含:

...
\ProvidesLanguage{greek}
        [2014/09/18 v1.9b Greek support for the babel system]
%% File `babel-greek.dtx'
...
\ifx\l@greek\@undefined
  \@nopatterns{greek}
  \adddialect\l@greek 0\fi
\ifx\l@monogreek\@undefined
  \adddialect\@monogreek 0\fi
\ifx\l@ancientgreek\@undefined
  \adddialect\@ancientgreek 0\fi

显然,它应该是,而不是现在这样;事实上,当我也做出这样的改变时,文档就能很好地编译。\adddialect\l@monogreek\adddialect\@monogreek


事情是这样的:我从头开始安装了 TexLive(install-tl),尝试编译给定的 MWE,但因给定错误而失败 - 不得不babel-greek/greek.ldf按照描述进行破解才能使其编译。因此,要么是代码有误greek.ldf,要么是 bug - 或者是我遗漏了某个包,而 Latex 无法通过常见的“文件未找到”消息告诉我是哪个。由于没有其他人可以重现此错误,因此它可能不是 bug - 但是,我该如何找到我遗漏的内容呢?

答案1

好的,我想我明白了。问题是 - 如果我安装新版 TexLive,我通常会安装最小软件包,然后尝试 tex 我的文档并添加软件包直到它们编译成功 - 所以显然这里缺少了一些东西。以下是我为使其正常工作所做的操作的日志(没有黑客攻击)。

正如评论所指出的:第一件关键的事情是我的日志说:

Babel <3.9l> and hyphenation patterns for 2 languages loaded.

... 这通常太少了。可以通过检查来确认kpsewhich language.dat,在我的例子中,只有这些未注释的行:

%
english         hyphen.tex  % do not change!
=usenglish
=USenglish
=american
% ...
%
dumylang        dumyhyph.tex    %for testing a new language.
nohyphenation   zerohyph.tex    %a language with no patterns at all.

因此这些hyphenation patterns for 2 languages报道可能是english——dummylang我不知道。

所以问题是如何为希腊语添加连字符;正如@UlrikeFischer 暗示的那样,这“取决于 language.dat 的位置” - 而且我显然使用的是自动生成的,而不是本地的:

$ kpsewhich language.dat
/media/texlive/2014/texmf-var/tex/generic/config/language.dat

因此,我确实使用搜索了“连字符” tlmgr search --global --file hyphen,并安装了我认为有趣的内容,如下所示:

$ tlmgr install hyph-utf8 hyphen-ancientgreek hyphen-greek 
...
[1/2, ??:??/??:??] install: hyphen-ancientgreek [17k]
[2/2, 00:00/00:00] install: hyphen-greek [717k]
...
running fmtutil-sys --no-error-if-no-engine=luajittex --byhyphen "/media/texlive/2014/texmf-var/tex/generic/config/language.dat" ...
...

现在,当我检查时language.dat,它最后有这个:

...
% 
dumylang        dumyhyph.tex    %for testing a new language.
nohyphenation   zerohyph.tex    %a language with no patterns at all.
% from hyphen-ancientgreek:
ancientgreek loadhyph-grc.tex
ibycus ibyhyph.tex
% from hyphen-greek:
monogreek loadhyph-el-monoton.tex
greek loadhyph-el-polyton.tex
=polygreek

很好 - 但示例仍然无法编译!因此,我尝试了:

tlmgr install --reinstall babel-greek 

不行。然后我按照提示尝试未加载该语言的连字模式

fmtutil --all 

不行 - 示例仍然无法编译。然后我按照以下方法尝试:TeX 常见问题 -- 通过 Babel 使用新语言 / 问题标签“newlang”

$ texconfig hyphen latex
texconfig hyphen is no longer supported, because manual edits of
language.dat (or language.def) will be overwritten by the new TeX Live
package manager, tlmgr, which regenerates those configuration files as
needed upon package changes.  Thus, to add or remove hyphenation
patterns, the recommended method is to use tlmgr to add or remove the
appropriate package.

If you need to make manual additions, you can edit the files
language-local.dat and language-local.def under TEXMFLOCAL.  Further
information with tlmgr --help and at http://tug.org/texlive/tlmgr.html.

Exiting.

所以这是不行的。所以我尝试了这个:

$ fmtutil --byhyphen language.dat
fmtutil: no format depends on hyphen file `/tmp/language.dat'.

啊,所以这里指的是当前工作目录?让我们输入一个绝对路径:

$ fmtutil --byhyphen `kpsewhich language.dat` 2>&1 | tee fmtutil.log
...
$ grep 'language\|installed' fmtutil.log
...
  50 for language 6
  18 for language 5
  148 for language 4
  97 for language 3
  2 for language 1
  181 for language 0
fmtutil: ~/.texlive2014/texmf-var/web2c/pdftex/latex.fmt installed.
  50 for language 6
  18 for language 5
  148 for language 4
  97 for language 3
  2 for language 1
  181 for language 0
fmtutil: ~/.texlive2014/texmf-var/web2c/pdftex/pdflatex.fmt installed.
...

啊,现在看起来所有新安装的语言的连字模式都重建了?但是这个例子仍然没有编译?

最后,我几乎偶然地输入了以下内容:

/tmp$ kpsewhich pdflatex.fmt
./pdflatex.fmt
/tmp$ rm pdflatex.fmt 
/tmp$ kpsewhich pdflatex.fmt
/tmp$

... 我发现我pdflatex.fmt当前工作目录中有一个/tmp,可能是fmtutil --byfmt pdflatex我之前弄乱它时生成的。所以我删除了这个/tmp/pdflatex.fmt,然后kpsewhich就找不到了pdflatex.fmt- 最后pdflatex test.tex完成了编译而没有错误;现在的日志是:

...
LaTeX2e <2014/05/01>
Babel <3.9l> and hyphenation patterns for 6 languages loaded.
... 
 *File List*
 article.cls    2007/10/19 v1.4h Standard LaTeX document class
  size10.clo    2007/10/19 v1.4h Standard LaTeX file (size option)
inputenc.sty    2014/04/30 v1.2b Input encoding file
    utf8.def    2008/04/05 v1.1m UTF-8 support for inputenc
   t1enc.dfu    2008/04/05 v1.1m UTF-8 support for inputenc
  ot1enc.dfu    2008/04/05 v1.1m UTF-8 support for inputenc
  omsenc.dfu    2008/04/05 v1.1m UTF-8 support for inputenc
   babel.sty    2014/09/25 3.9l The Babel package
   greek.ldf    2014/09/18 v1.9b Greek support for the babel system
  lgrenc.def    2013/12/02 v0.11.2 LGR Greek font encoding definitions
  lgrenc.dfu    2014/09/14 1.5 UTF-8 support for Greek
greek-fontenc.def    2013/11/28 v0.11 Common Greek font encoding definitions
 english.ldf    2012/08/20 v3.3p English support from the babel system
 fontenc.sty
   t1enc.def    2005/09/27 v1.99g Standard LaTeX file
  lgrcmr.fd    2013/09/01 v1.0 Greek European Computer Regular
 ***********
Output written on test.pdf (1 page, 26870 bytes).
Transcript written on test.log.

希望现在已经安装好了 TexLive 2014。

相关内容