[Tex/LaTex] Chinese, Russian and English (and Arabic, and Thai, if possible) in LuaLaTeX

babellanguagesluatex

following up on THIS QUESTION, I want to embed the solution in a document (Beamer presentation) I compile (in English) with LuaLaTeX, but I just don't find the way. I just want to include a slide with text in different languages and the code for teaching purposes, but it is the first time I try to write something in a non-latin alphabet… But my document needs LuaLaTeX (and I actually like it!).

Additionally, if someone knows how to include text in a couple of other non-latin alphabets as well, like Arabic and Thai, it would be much appreciated.

So this it the code I want to embed in my document compiled with LuaLaTeX:

\documentclass[12pt]{article}
\usepackage[margin=1in]{geometry}
\usepackage[T1,T2A]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage[russian, english]{babel}% note - it is recommended to specify the variant of English required to avoid unexpected divergence depending on the version of babel e.g. american or british
\usepackage[encapsulated]{CJK}
\usepackage{setspace}
\doublespacing
\usepackage{natbib}
\begin{document}
\selectlanguage{russian}
слово

\begin{CJK}{UTF8}{gbsn}
你好
\end{CJK}

\selectlanguage{english}
Here is some text in English.

\selectlanguage{russian}
слово

\end{document}

Best Answer

Here I demonstrate only how to use fontspec to select many different fonts for different languages in one document. I use a main font that already covers a wide Unicode range, and then select other fonts as appropriate. I used fonts either available in TeXLive or freely available elsewhere. Compile with lualatex.

Note that for Hebrew and Arabic you have to use \luatextexdir TRT to set the right-to-left text direction, and with Arabic you need [Script=Arabic]. See the fontspec package documentation and other questions on these sites about these languages for more information.

I don't know all these languages, so I have likely gotten some things wrong, and I hope others will correct me.

To this you can add using babel or polyglossia for hyphenation patterns specific to each language, but I leave this up to someone else to demonstrate. With only short excerpts of different languages, that may be overkill anyway.

\documentclass{article}
\usepackage{url} % just to format urls 
\usepackage{fontspec}
\setmainfont{Linux Libertine O}
% Libertine covers Latin, Hebrew, Greek, and Russian

\newfontfamily{\hebrewfont}{Linux Libertine O} 
\newcommand{\texthebrew}[1]{%
    \bgroup\luatextextdir TRT\hebrewfont #1\egroup%
}

\newfontfamily{\chinesefont}{IPAMincho} % in TeXLive
\newcommand{\textchinese}[1]{\bgroup\chinesefont #1\egroup}

\newfontfamily{\arabicfont}[Script=Arabic]{Droid Arabic Naskh} % free with Debian GNU/Linux
\newcommand{\textarabic}[1]{%
     \bgroup\luatextextdir TRT\arabicfont #1\egroup%
}

\newfontfamily{\thaifont}{Norasi} % free with Debian
\newcommand{\textthai}[1]{\bgroup\thaifont #1\egroup}

\begin{document}
\section*{The Tower of Babel, Genesis 11:7}

\subsection*{English}
Come, let us go down and confuse their language so they will not understand each other. 

\subsection*{Hebrew}
\texthebrew{%
הָ֚בָה נֵֽרְדָ֔ה וְנָבְלָ֥ה שָׁ֖ם שְׂפָתָ֑ם אֲשֶׁר֙ לֹ֣א יִשְׁמְע֔וּ אִ֖ישׁ שְׂפַ֥ת רֵעֵֽהוּ׃%
}

\subsection*{Greek}
δεῦτε καὶ καταβάντες συγχέωμεν ἐκεῖ αὐτῶν τὴν γλῶσσαν, ἵνα μὴ ἀκούσωσιν ἕκαστος τὴν φωνὴν τοῦ πλησίον.

\subsection*{Latin}
venite igitur descendamus et confundamus ibi linguam eorum ut non audiat unusquisque vocem proximi sui

\subsection*{Spanish}
Será mejor que bajemos a confundir su idioma, para que ya no se entiendan entre ellos mismos.

\subsection*{Russian}
сойдем же и смешаем там язык их, так чтобы один не понимал речи другого.

\subsection*{Chinese (Simplified)}
\textchinese{%
来,我们下去,在那里混乱他们的语言,使他们听不懂对方的话。%
}

\subsection*{Thai}
\textthai{%
มาเถิด ให้เราลงไปทำให้เขามีภาษาสับสนแตกต่างกันออกไป เพื่อเขาจะได้ไม่เข้าใจกัน%
}

\subsection*{Arabic}
\textarabic{%
هَيَّا نَنْزِلْ إِلَيْهِمْ وَنُبَلْبِلْ لِسَانَهُمْ، حَتَّى لَا يَفْهَمَ بَعْضُهُمْ كَلامَ بَعْضٍ.%
}

\bigskip
\small
Texts from \url{https://www.biblegateway.com}.
Greek Septuagint text from \url{https://www.academic-bible.com/en/online-bibles/septuagint-lxx/read-the-bible-text/}.


\end{document}

enter image description here

Related Question