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 thefontspec
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
orpolyglossia
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.