使用 LuaLaTex 混合冰岛语和德语的问题

使用 LuaLaTex 混合冰岛语和德语的问题

因此,我想做的是使用MikTeX 中包含的letter-classicLuaLaTeX () 类。This is LuaTeX, Version beta-0.80.0 (MiKTeX 2.9) (rev 5238) (format=lualatex 2015.11.10) 25 NOV 2015 09:30

它会出现icelandic.ldf如下错误:

! String contains an invalid utf-8 sequence.
l.144 \DeclareTextCommand{\ooob}{T1}{\sob {
                                         ó}{.85}{0}{.04}{0}}
A funny symbol that I can't read has just been (re)read.
Just continue, I'll change it to 0xFFFD.

! String contains an invalid utf-8 sequence.
l.145 \DeclareTextCommand{\OOob}{T1}{\sob {
                                         Ó}{.7}{0}{0}{0}}
A funny symbol that I can't read has just been (re)read.
Just continue, I'll change it to 0xFFFD.

! String contains an invalid utf-8 sequence.
l.148 \DeclareTextCommand{\eeob}{T1}{\sob {
                                         é}{1}{0}{.04}{0}}
A funny symbol that I can't read has just been (re)read.
Just continue, I'll change it to 0xFFFD.

! String contains an invalid utf-8 sequence.
l.149 \DeclareTextCommand{\EEob}{T1}{\sob {
                                         É}{1}{0}{.04}{0}}
A funny symbol that I can't read has just been (re)read.
Just continue, I'll change it to 0xFFFD.

! String contains an invalid utf-8 sequence.
l.152 \declare@shorthand{icelandic}{"
                                   ó}{\ooob}
A funny symbol that I can't read has just been (re)read.
Just continue, I'll change it to 0xFFFD.

! String contains an invalid utf-8 sequence.
<argument> icelandic@sh@\string "@\string �
                                  \ooob @
l.153 \declare@shorthand
                      {icelandic}{"Ó}{\OOob}
A funny symbol that I can't read has just been (re)read.
Just continue, I'll change it to 0xFFFD.

我的最小工作示例是这样的:

\documentclass[english,12pt,a4paper]{letter-classic}
\usepackage[T1]{fontenc}
\usepackage[icelandic,german,english]{babel}
\selectlanguage{english}
\newcommand{\ISL}[1]{\foreignlanguage{icelandic}{#1}}
\newcommand{\DEU}[1]{\foreignlanguage{german}{#1}}
%%\usepackage[utf8]{inputenc} % needed with pdfLaTeX, but not with LuaLaTeX (see comment below question)

\begin{document}

\begin{letter}{Troll family\\\ISL{Elliðaárdalur}\\\ISL{999 Reykjavík}\\ICELAND}
\fromname{\DEU{Mäxchen Mustermann}}
\fromstreet{\DEU{Musterstraße 123}}
\fromtown{12345 Musterstadt}
\fromphone{+49 123 4567890}
\fromtownshort{Musterstadt}
\fromsignature{\DEU{Mäxchen}}

\subject{\ISL{Jólasveinar}}
\opening{Folks,}

do you know the current address of the \ISL{Jólasveinar} and/or their parents \ISL{Grýla} and \ISL{Leppalúði}?

\closing{\ISL{Með kveðju,}}
\end{letter}

\end{document}

几个月前,使用 pdfLaTeX 时,实际文档的运行没有任何问题(现在仍然如此,见下文)。

外观使用 pdfLaTeX 渲染时

谁能向我解释如何混合冰岛语和德语使用 LuaLaTeXletter-classic班级一起吗?


我已经研究过 KOMA 字母类,但我更喜欢稍微现代/定制一点的信头外观,所以此刻我真的想避免那种。

答案1

问题不在于混合冰岛语和德语。一个较小的例子显示了全部文檔類別。

\documentclass{article}
\usepackage[icelandic]{babel}

\begin{document}

Test

\end{document}

通过 LuaLaTeX 运行该程序会产生与您看到的相同的错误(以及稍后出现的类似错误):

! String contains an invalid utf-8 sequence.
l.144 \DeclareTextCommand{\ooob}{T1}{\sob {
                                         ?}{.85}{0}{.04}{0}}
? 

icelandic.ldf不幸的是,通过硬编码加载的文件有babel四个 Latin-1 字符,用于

"Ó "ó "É "é

并且,当 LuaTeX 读取文件时,它会因无效输入而阻塞。XeTeX 在这方面更宽容,不会阻塞。

就目前情况而言,babel-icelandic它与 LuaLaTeX 不兼容,而且据我所知,除了编写修改后的文件外,没有其他解决方法icelandic.ldf

第 142 至 157 行应为

142 \DeclareTextCommand{\oob}{T1}{\sob {o}{.85}{0}{.04}{0}}
143 \DeclareTextCommand{\Oob}{T1}{\sob {O}{.7}{0}{0}{0}}
144 \DeclareTextCommand{\ooob}{T1}{\sob {^^f3}{.85}{0}{.04}{0}}
145 \DeclareTextCommand{\OOob}{T1}{\sob {^^d3}{.7}{0}{0}{0}}
146 \DeclareTextCommand{\eob}{T1}{\sob {e}{1}{0}{.04}{0}}
147 \DeclareTextCommand{\Eob}{T1}{\sob {E}{1}{0}{.04}{0}}
148 \DeclareTextCommand{\eeob}{T1}{\sob {^^e9}{1}{0}{.04}{0}}
149 \DeclareTextCommand{\EEob}{T1}{\sob {^^c9}{1}{0}{.04}{0}}
150 \declare@shorthand{icelandic}{"o}{\oob}
151 \declare@shorthand{icelandic}{"O}{\Oob}
152 \declare@shorthand{icelandic}{"^^f3}{\ooob}
153 \declare@shorthand{icelandic}{"^^d3}{\OOob}
154 \declare@shorthand{icelandic}{"e}{\eob}
155 \declare@shorthand{icelandic}{"E}{\Eob}
156 \declare@shorthand{icelandic}{"^^e9}{\eeob}
157 \declare@shorthand{icelandic}{"^^c9}{\EEob}

出现变化的行数有所差异^^;为了方便起见,我添加了行号。

应该向 的维护者提交错误报告babel

答案2

作为一种解决方法,您可以在本地使用 luainputenc 切换到 ansinew 读取:(稍加编辑以随后重置 catcodes,并删除写入回调,以便 toc 现在再次包含真正的 utf8)。

\documentclass{article}
\usepackage{fontspec}
\usepackage{luatexbase} %not needed now, but probably in the future.
\PushCatcodeTableNumStack
\usepackage[ansinew]{luainputenc}
\usepackage[icelandic]{babel}
\PopCatcodeTableNumStack

\directlua{luatexbase.remove_from_callback('process_input_buffer', 'luainputenc.fake_utf_read')
           luatexbase.remove_from_callback('process_output_buffer','luainputenc.fake_utf_write')
           luainputenc.state = stopped}
\begin{document}

\tableofcontents
\section{öäüß}
äöüß €
 ólasveinar Grýla Leppalúði
\end{document}

但是 icelandic.ldf 中的其他一些内容很可能不适合 luatex,那么您将必须进行更多调整。

在此处输入图片描述

答案3

为什么不使用polyglossia?我没有letter-classic,但是这里有类似的版本letter

样本

\documentclass{letter}

\usepackage[T1]{fontenc}
\usepackage{polyglossia}
\setdefaultlanguage{english}
\setotherlanguages{icelandic,german}

\newcommand{\ISL}[1]{\texticelandic{#1}}
\newcommand{\DEU}[1]{\textgerman{#1}}

\begin{document}

\begin{letter}{Troll family\\\ISL{Elliðaárdalur}\\\ISL{999 Reykjavík}\\ICELAND}
\name{\DEU{Mäxchen Mustermann}}
\address{\DEU{Musterstraße 123}\\
12345 Musterstadt}
\telephone{+49 123 4567890}
\signature{\DEU{Mäxchen}}

\opening{Folks,}

\begin{center}
  \ISL{Jólasveinar}
\end{center}

Do you know the current address of the \ISL{Jólasveinar} and/or their parents \ISL{Grýla} and \ISL{Leppalúði}?

\closing{\ISL{Með kveðju,}}
\end{letter}

\end{document}

答案4

更新。这个错误很久以前就已修复,并且与和babel-icelandic兼容。luatexxetex

相关内容