使用 pdfLaTeX、xeLaTeX 或 luaLaTeX 得到不同的结果

使用 pdfLaTeX、xeLaTeX 或 luaLaTeX 得到不同的结果

为什么像这样的简单文件:

\documentclass{report}

\usepackage[english,russian]{babel}

\begin{document}
\selectlanguage{english}
Next text in Russian:
\foreignlanguage{russian}{Элементарная теория аналитических}
\end{document}

使用一个或另一个引擎是否会产生完全不同的结果?

我确实知道他们使用不同的字体集,但为什么会这样,特别是如果pdflatex选择和其他选择的覆盖范围不同?

答案1

输出pdflatex

在此处输入图片描述

xelatex或输出lualatex

在此处输入图片描述

嘿!俄语句子在哪里?这里是:

Missing character: There is no Э (U+042D) in font [lmroman10-regular]:mapping=tex-text;!
Missing character: There is no л (U+043B) in font [lmroman10-regular]:mapping=tex-text;!
Missing character: There is no е (U+0435) in font [lmroman10-regular]:mapping=tex-text;!
Missing character: There is no м (U+043C) in font [lmroman10-regular]:mapping=tex-text;!
Missing character: There is no е (U+0435) in font [lmroman10-regular]:mapping=tex-text;!
Missing character: There is no н (U+043D) in font [lmroman10-regular]:mapping=tex-text;!
Missing character: There is no т (U+0442) in font [lmroman10-regular]:mapping=tex-text;!
Missing character: There is no а (U+0430) in font [lmroman10-regular]:mapping=tex-text;!
Missing character: There is no р (U+0440) in font [lmroman10-regular]:mapping=tex-text;!
Missing character: There is no н (U+043D) in font [lmroman10-regular]:mapping=tex-text;!
Missing character: There is no а (U+0430) in font [lmroman10-regular]:mapping=tex-text;!
Missing character: There is no я (U+044F) in font [lmroman10-regular]:mapping=tex-text;!
Missing character: There is no т (U+0442) in font [lmroman10-regular]:mapping=tex-text;!
Missing character: There is no е (U+0435) in font [lmroman10-regular]:mapping=tex-text;!
Missing character: There is no о (U+043E) in font [lmroman10-regular]:mapping=tex-text;!
Missing character: There is no р (U+0440) in font [lmroman10-regular]:mapping=tex-text;!
Missing character: There is no и (U+0438) in font [lmroman10-regular]:mapping=tex-text;!
Missing character: There is no я (U+044F) in font [lmroman10-regular]:mapping=tex-text;!
Missing character: There is no а (U+0430) in font [lmroman10-regular]:mapping=tex-text;!
Missing character: There is no н (U+043D) in font [lmroman10-regular]:mapping=tex-text;!
Missing character: There is no а (U+0430) in font [lmroman10-regular]:mapping=tex-text;!
Missing character: There is no л (U+043B) in font [lmroman10-regular]:mapping=tex-text;!
Missing character: There is no и (U+0438) in font [lmroman10-regular]:mapping=tex-text;!
Missing character: There is no т (U+0442) in font [lmroman10-regular]:mapping=tex-text;!
Missing character: There is no и (U+0438) in font [lmroman10-regular]:mapping=tex-text;!
Missing character: There is no ч (U+0447) in font [lmroman10-regular]:mapping=tex-text;!
Missing character: There is no е (U+0435) in font [lmroman10-regular]:mapping=tex-text;!
Missing character: There is no с (U+0441) in font [lmroman10-regular]:mapping=tex-text;!
Missing character: There is no к (U+043A) in font [lmroman10-regular]:mapping=tex-text;!
Missing character: There is no и (U+0438) in font [lmroman10-regular]:mapping=tex-text;!
Missing character: There is no х (U+0445) in font [lmroman10-regular]:mapping=tex-text;!

这是预期的吗?是的。XeLaTeX 或 LuaLaTeX 的默认字体是 Latin Modern,它根本不涵盖西里尔文。如果您想使用 XeLaTeX 或 LuaLaTeX 排版西里尔文文本,您需要使用支持它的字体。

例如,fontsetup将选择 NewComputer Modern。

\documentclass{report}
\usepackage{iftex}

\iftutex
% (Xe|Lua)LaTeX
\usepackage[russian,english]{babel}
\usepackage{fontsetup}
\else
\usepackage[T1,T2A]{fontenc}
\usepackage[russian,english]{babel}
\fi

\begin{document}

Next text in Russian:
\foreignlanguage{russian}{Элементарная теория аналитических}

\end{document}

输出与pdflatex之前相同。使用 XeLaTeX 或 LuaLaTeX 的输出为

在此处输入图片描述

无论如何,制作一个可以用所有引擎编译的真正文档是不可能实现的。决定使用哪一个引擎并坚持使用它的方法。

答案2

lualatex和 的重点xelatex在于它们提供了 中没有的许多新功能pdflatex。即使在 中pdflatex,您的文档也不是很完整,因为它缺少字体编码的声明(在这种情况下它可能有效,但并非总是如此,无论如何都建议声明它)。因此,可以预料到必须进行一些调整。

相关内容