16

It is not immediately obvious how to properly and easily write the Esperanto diacritic characters in LaTeX. I have some ideas, which I will post as my own answer below, but I am interested if anybody knows any other/better ways. Thanks!

Ne tuj evidentas kiel ĝuste kaj facile skribi la ĉapelitajn literojn de Esperanto en LaTeX. Mi havas kelkajn ideojn, kiujn mi metos sube kiel mian propran respondon, sed interesas min ĉu iu konas aliajn/pli bonajn manierojn. Dankon!

4 Answers 4

11

If you use XeLaTeX, you can use any Unicode characters in your document without doing anything special: to XeLaTeX, Ĝ is no more special than G. Its default font is Latin Modern, which is a Unicode-compliant version of Computer Modern; you can use the fontspec package to load any OpenType or TrueType font. As a bonus, you get excellent support for OpenType fonts' advanced typography features.

11

Probably the easiest way is to simply use the Esperanto setting for the Babel package (\usepackage[esperanto]{babel}). This allows you to use ^s for the letter ŝ, ^C for the letter Ĉ, ^u for the letter ŭ, etc. Downside is that you have to type these a bit more awkwardly than you usually would, but it's a very easy implementation.

Verŝajne la plej facila maniero estas simple uzi la esperantoagordo por la Babel pakaĵo (\usepackage[esperanto]{babel}). Tio ebligas vin uzi ^s por la litero ŝ, ^C por la litero Ĉ, ^u por la litero ŭ, ktp. Malavantaĝo estas tio, ke vi devas tajpi tiujn ĉi iom pli plumpe ol kutime, sed ja estas facilega funkciigo.


Another way is one that I like better but that requires slightly more work to set up, which is to put the below code in the preamble. This allows you to type the letters as you normally would in the code itself, and they will be properly rendered for the document.

Alia maniero estas unu, kiun mi pli ŝatas, sed kiu postulas iomete pli da laboro por funkciigi, kiu estas meti la suban kodon en la prefacon. Tio ĉi ebligas vin tajpi la literojn kiel vi normale farus tuj en la kodon, kaj ili ĝuste montrotas en la dokumenton.

\usepackage[utf8]{inputenc} \DeclareUnicodeCharacter{0108}{\^{C}} % Esperanta litero Ĉ \DeclareUnicodeCharacter{0109}{\^{c}} % Esperanta litero ĉ \DeclareUnicodeCharacter{011C}{\^{G}} % Esperanta litero Ĝ \DeclareUnicodeCharacter{011D}{\^{g}} % Esperanta litero ĝ \DeclareUnicodeCharacter{0124}{\^{H}} % Esperanta litero Ĥ \DeclareUnicodeCharacter{0125}{\^{h}} % Esperanta litero ĥ \DeclareUnicodeCharacter{0134}{\^{J}} % Esperanta litero Ĵ \DeclareUnicodeCharacter{0135}{\^{\j}} % Esperanta litero ĵ \DeclareUnicodeCharacter{015C}{\^{S}} % Esperanta litero Ŝ \DeclareUnicodeCharacter{015D}{\^{s}} % Esperanta litero ŝ \DeclareUnicodeCharacter{016C}{\u{U}} % Esperanta litero Ŭ \DeclareUnicodeCharacter{016D}{\u{u}} % Esperanta litero ŭ

5
  • 2
    Krome metu \usepackage[T1]{fontenc} super ĉi ĉion. Vidu ĉi tion (angle). Commented Jan 3, 2017 at 13:44
  • Ha, bone, dankon! Commented Jan 3, 2017 at 14:17
  • Nedankinde, :). Commented Jan 3, 2017 at 14:23
  • I wouldn't recommend babel, fontenc in 2017. That's the way it worked in the 1990. Nowadays we have polyglossia and fontspec in combination with XeLaTeX and LuaLaTeX using proper Unicode. Commented Apr 7, 2017 at 10:24
  • I am definitely not very knowledgeable about LaTeX, that is why I asked the question. If you would, I would love it if you could expound on these alternate ways to make Esperanto work in LaTeX and explain why they are better. (I know XeLaTeX was mentioned already in Max's comment, but not the other elements you mentioned.) Commented Apr 9, 2017 at 11:37
5

With teTeX and the later TeX Live distributions, I've successfully used UTF-8 encoded source files (complete with the ĉapelitaj literoj) by adding the following packages in the document header:

\usepackage{ucs}   
\usepackage[utf8]{inputenc}
5

In my opinion, the most elegant solution to this is to use a Unicode typesetting engine, such as XeLaTeX or LuaLaTeX, which enables you to input the special characters used for writing Esperanto.

However, this does raise additional questions, two of which are: "How do you input the Esperanto characters in the first place?" and "Don't I need a font which contains those characters?".

The answer to the first question will doubtless have been answered in greater length elsewhere but my own solution for problems like this is to create a custom keyboard layout using the Microsoft Keyboard Layout Creator (on Windows; similar tools are available for Mac).

As for the second question, yes, many of which already come bundled with (La)TeX but another option is to use a package such as fontspec or even mathspec to load a desired locally-stored font. You could also use the noto package which I believe covers the Esperanto characters (and then some). (Information on the packages available on CTAN, of course.)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.