Chinese, Russian and English (and Arabic, and Thai, if possible) in LuaLaTeX

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}

• You'll need fontspec commands to select appropriate fonts, unless you have one that covers all these alphabets. – musarithmia Jun 15 '15 at 1:24
• How can I do that? Which would be the required fonts, and where to get them for Ubuntu? Thanks! – DaniCee Jun 15 '15 at 1:47
• Don't load inputenc or fontenc if you are compiling with LuaTeX. (In some cases, you can use fontenc but generally not. You definitely don't want inputenc ever here.) – cfr Jun 15 '15 at 2:12
• I suspect you ought not load CJK either but I'm not entirely sure. Also if it supports the languages you need, consider polyglossia as a replacement for babel with this engine. – cfr Jun 15 '15 at 2:14
• Which solution are you referring to? At least 3 different solutions are mentioned there, none involving LuaTeX. One uses the encapsulated option of CJK. One uses the CJKutf8 package. A third uses XeTeX (and is linked rather than given directly). The first two solutions are for (pdf)TeX - not XeTeX or LuaTeX. XeTeX or LuaTeX should be much easier here but you need to do a little bit of work to set your document up appropriately i.e. a bit of reading so that you understand the basics of switching engines. texdoc fontspec is a great resource. – cfr Jun 15 '15 at 2:22

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}.

• The Arabic isn’t right (no bidi). You’ll need \newfontfamily\arabicfont[Script=Arabic]{Droid Arabic Naskh}, though that won’t suffice. In the case of Arabic, xetex makes life easier than luatex, though I use luatex for everything else. Haven’t yet had time to update to TeX Live 2015, but when I do I’ll revisit this question if the situation has changed. – Thérèse Jun 16 '15 at 15:14