我无法弄清楚 babel 如何处理真正的多语言文本。至少需要以下几种语言,其中到目前为止,德语、英语、俄语和希腊语似乎可以使用,而韩语、中文和阿拉伯语则不行。我正在运行 XeLaTeX。
\documentclass[a4paper, twoside, ngerman]{book}
\usepackage{fontspec}
\setromanfont{CMU Serif}
\setsansfont{CMU Sans Serif}
\setmonofont{CMU Typewriter Text}
\newfontfamily\arabicfont[Script=Arabic]{Arial Unicode MS}
\newcommand\textarabic[1]{{\arabicfont #1}}
\newfontfamily\koreanfont{UnGungseo}
\newcommand\textkorean[1]{{\koreanfont #1}}
\newfontfamily\chinesefont{FandolSong}
\newcommand\textchinese[1]{{\chinesefont #1}}
\usepackage[bidi=default]{babel}
\babelprovide[main, import=de]{ngerman}
\babelprovide[import]{russian}
\babelprovide[import]{korean}
\babelprovide[import]{chinese-traditional}
\babelprovide[import]{arabic}
\babelprovide[import]{greek}
\begin{document}
deutsch \foreignlanguage{russian}{Видео урок по живописи маслом} deutsch \textkorean{미술부화실} deutsch
\textchinese{墨子} deutsch deutsch \foreignlanguage{greek}{πόλεις} deutsch \textarabic{أبو علي الحسن بن الهيثم} deutsch
\end{document}
答案1
我认为你需要加载其他字体,然后在本地切换字体。我的回答基于使用 LuaLaTeX 排版阿拉伯语(阿拉伯),如何使用lualatex来使用中文?(中文)和韩文字符不起作用(韩语)。使用 lualatex 进行编译
\documentclass[a4paper, twoside, ngerman]{book}
\usepackage{fontspec}
\setromanfont{CMU Serif}
\setsansfont{CMU Sans Serif}
\setmonofont{CMU Typewriter Text}
\newfontfamily\arabicfont[Script=Arabic]{Arial Unicode MS}
\newcommand{\textarabic}[1] % Arabic inside LTR
{\foreignlanguage{arabic}{{\arabicfont #1}}}
\newfontfamily\koreanfont{UnGungseo}
\newcommand\textkorean[1]{{\koreanfont #1}}
\newfontfamily\chinesefont{FandolSong}
\newcommand\textchinese[1]{{\chinesefont #1}}
\usepackage[bidi=default]{babel}
\babelprovide[main, import=de]{ngerman}
\babelprovide[import]{russian}
\babelprovide[import]{korean}
\babelprovide[import]{chinese-traditional}
\babelprovide[import]{arabic}
\babelprovide[import]{greek}
\begin{document}
deutsch \foreignlanguage{russian}{Видео урок по живописи маслом} deutsch \textkorean{미술부화실} deutsch
\textchinese{墨子} deutsch \textarabic{أبو علي الحسن بن الهيثم} deutsch \foreignlanguage{greek}{πόλεις} deutsch
\end{document}
答案2
以下是具体操作方法及其解释:
\documentclass[a4paper, twoside, russian, ngerman]{book}
% As there is very good support for both Russian and German with 'ldf'
% files, load them as class options. The last one is the main language.
\usepackage[bidi=default]{babel}
% Depending on the contents you may prefer bidi=bidi-l.
% Now the rest of languages. It is worth noting that 'import' is
% not always required if you need neither captions nor dates, just
% short texts.
\babelprovide[import]{korean}
\babelprovide[import]{chinese-traditional}
\babelprovide[import]{arabic}
\babelprovide[import]{greek}
% Set fonts up. As CMU Serif contains Greek letters, there is no need
% for an explicit setting.
\babelfont{rm}{CMU Serif}
\babelfont[arabic]{rm}{Arial Unicode MS}
\babelfont[korean]{rm}{UnGungseo}
\babelfont[chinese-traditional]{rm}{FandolSong}
\babelfont{sf}{CMU Sans Serif}
\babelfont{tt}{CMU Typewriter Text}
% Create language macros: \textkorean, \textchinese, \textarab. Note
% I'm not using 'arabic' but 'arab' because \babeltags tries to define
% \arabic, which is already defined. This should be fixed somehow in
% babel.
\babeltags{
korean=korean,
chinese=chinese-traditional,
arab=arabic}
\begin{document}
deutsch \foreignlanguage{russian}{Видео урок по живописи маслом} deutsch \textkorean{미술부화실} deutsch
\textchinese{墨子} deutsch \textarab{أبو علي الحسن بن الهيثم} deutsch \foreignlanguage{greek}{πόλεις} deutsch
\end{document}