XeLaTeX: Unicode font fallback for unsupported characters
This blog post was published 10 years ago and may or may not have aged well. While reading
please keep in mind that it may no longer be accurate or even relevant.
When typesetting with LaTeX, it is easy when you wring in a single language. But as soon as you want to typeset Unicode text in multiple languages, you’re quickly out of luck. LaTeX is just not made for Unicode, and you need a lot of helper packages, documentation reading, and complicated configuration in your document to get it all right.
All I wanted was to typeset the following example text (Unicode). It contains regular latin characters, chinese characters, modern greek and polytonic (ancient) greek.
Latin text. Chinese text: 紫薇北斗星 Modern greek: Διαμ πριμα εσθ ατ, κυο πχιλωσοπηια Ancient greek: Μῆνιν ἄειδε, θεά, Πηληϊάδεω Ἀχιλῆος. And regular latin text.
I thought that this was a simple task. I thought: let’s just use XeLaTeX, which has out-of-the-box Unicode support. In the end, it was a simple task, but only after struggling to solve a particular problem. To show you the problem, I ran the following straightforward code through XeLaTeX…
\\documentclass\[\]{book}
\\usepackage{fontspec}
\\begin{document}
Latin text. Chinese text: 紫薇北斗星 Modern greek: Διαμ πριμα εσθ ατ, κυο πχιλωσοπηια
Ancient greek: Μῆνιν ἄειδε, θεά, Πηληϊάδεω Ἀχιλῆος. And regular latin text.
\\end{document}
… and the following PDF was produced:
If you found a mistake in this blog post, or would like to suggest an improvement to this blog post,
please me an e-mail to michael@franzl.name; as subject
please use the prefix "Comment to blog post" and append the post title.