-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathinternational.tex
102 lines (96 loc) · 3.62 KB
/
international.tex
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
\chapter{Typographie Internationale}
\label{i18n}
Surprisingly, languages besides English exist.
You may want to write with them.
\section{Unicode}
Digitizing written language is a complicated topic that has evolved significantly
since \LaTeX's inception.
Today, most software uses Unicode to represent text. Briefly,
\begin{itemize}
\item A Unicode text file is a series of \introduce{code points}.
Each represents a character to be drawn,
an accent or diacritical mark to combine with an adjacent
character,
or formatting information,
such as an instruction to print subsequent text right-to-left.
\item One or more of these code points combine to represent a
\introduce{grapheme cluster} or \introduce{glyph},
the shapes within fonts that we informally call ``characters''\quotekern.
\begin{centerfigure}
\large%
\fontspec[Ligatures=TeX]{NotoSerif}%
Приве́т
\quad\fontspec[Ligatures=TeX]{NotoSerif-Devanagari}%
नमस्ते
\captionof{figure}{How many characters do you see?
How many code points?}
\end{centerfigure}
\item Modern font formats contain tables
which map code points to the glyphs the file contains.
\end{itemize}
\LuaLaTeX{} and \XeLaTeX{} are Unicode-literate and play well with
Unicode text
files.\punckern\footnote{\LuaLaTeX{} accepts \mbox{\acronym{utf}-8} files.
\XeLaTeX{} also accepts \mbox{\acronym{utf}-16} and \mbox{\acronym{utf}-32}.}
Make sure that the fonts you select contain the glyphs you need---many
only support Latin languages.
\section{Polyglossia}
When your document contains languages besides English,
consider using the \texttt{polyglossia} package.
It will automatically:
\begin{itemize}
\item Load language-specific hyphenations and other conventions.
\item Switch between user-specified fonts for each language.
\item Translate document labels,
like ``chapter''\quotekern, ``section''\quotekern, and so on.
\item Format dates according to language-specific conventions.
\item Format numbers in languages that have their own numbering system.
\item Use the \texttt{bidi} package for documents with languages written
right to left.
\item Set the script and language tags of OpenType fonts that have them.
\end{itemize}
To use \texttt{polyglossia}, specify your document's main language,
along with any others it uses.
Some languages also take regional dialects as an optional argument:
\begin{leftfigure}
\begin{lstlisting}
\usepackage{polyglossia}
\setdefaultlanguage[variant=american]{english}
\setotherlanguage{french}
\end{lstlisting}
\end{leftfigure}
Once set up,
\texttt{polyglossia} defines environments for the requested languages.
Each automatically applies their language's conventions to the text within.
French, for example, places extra space around punctuation, so
\begin{leftfigure}
\begin{lstlisting}
Dexter cried,
\begin{french}
«Omelette du fromage!»
\end{french}
\end{lstlisting}
\end{leftfigure}
gives
\begin{leftfigure}
\lm%
Dexter cried,
\begin{french}
\lm%
«Omelette du\footnote{Yes, it's \emph{omelette au fromage}.
Direct all complaints to Genndy Tartakovsky.} fromage!»
\end{french}
\end{leftfigure}
\exercises{}
\begin{flushleft}
\begin{itemize}
\item See the \texttt{polyglossia} manual for language-specific commands.
\item Look into the \texttt{babel} package as an alternative to
\texttt{polyglossia}.\punckern\footnote{\texttt{polyglossia} has better
support for OpenType font features via \texttt{fontspec}.
However, it is newer and has a few known bugs.
\texttt{babel} is a fine substitute if you run into trouble.}
\item Try typesetting Japanese or Chinese with the \texttt{xeCJK} or
\monobox{luatex-ja} packages.
\end{itemize}
\end{flushleft}