I have this document which contains Vietnamese characters, and it doesn't compile correctly:
\documentclass[letterpaper]{article}
\usepackage[vietnam]{babel}
\begin{document}
Ðàn con chung một trái tim
\end{document}
The characters come out as gobbledygook. I don't know how to give Latex the ability to display characters in any language. It's rather frustrating because I'm used to just typing anything I want in UTF-8.
What are the steps to enabling a language in a Latex document? For the answer, you can use my Vietnamese example.
Best Answer
I copied the start of the Hanoi entry in the vietnamese Wikipedia:
The trick is to enable the
utf8
encoding for the packageinputenc
.Note The proper Unicode character for the capital "đê" (or "đờ") character is Đ (U+0110 LATIN CAPITAL LETTER D WITH STROKE) and not the one you're using, that is Ð (U+00D0 LATIN CAPITAL LETTER ETH). They are pretty similar, but distinct. The former is used in Croatian and Vietnamese, the latter in Icelandic (and its lowercase form is ð).
In case different languages must be used, they should be declared to
babel
:For short inserts in English,
\foreignlanguage{english}{some text in English}
can be used. One can also define a personal abbreviation, such asso to be allowed to write
\EN{some text in english}
. You can also abbreviate the environment form withSee the
babel
manual for the difference betweenotherlanguage
andotherlanguage*
.Alternatively, you can use XeLaTeX:
which gives a correct result:
Polyglossia issues a warning about missing hyphenation patterns for Vietnamese, which should not be a problem.
For declaring other languages to Polyglossia, one should use, for instance,
Note that the same commands as in
babel
can be used with Polyglossia, but in this case theenglish
environment would already be defined, so onlyenglish*
might need to be.