You are not logged in.

#1 2014-01-03 07:32:29

Caocoa
Member
Registered: 2010-11-11
Posts: 22

(being solved) How to handle multilingualism and fonts use in LaTeX?

Hello all,

Happy New Year!

I'm facing big troubles to write documents with multiple languages inside. Below follows a minimal non-functional example. I would be more than happy to know what I shall do to make it to compile properly.

\documentclass[12pt]{article}

\usepackage[english,francais,spanish,chinese]{babel}
\usepackage[utf8x]{inputenc}
\usepackage[T1]{fontenc}

\renewenvironment{quote}{\og}{\fg}

\begin{document}

\selectlanguage{english}% Main language of the document.

In English we say:
\begin{quote}Where is the child?\end{quote}
It's quite easy to type in \LaTeX. Unfortunately, some languages are trickier to type.

For instance, Chinese would write: %
\foreignlanguage{chinese}{\begin{quote}哪裡的孩子?\end{quote}}. %
Simplified Chinese tenuously changes from the latter: %
\foreignlanguage{chinese}{\begin{quote}哪里的孩子?\end{quote}}. %
Keep in mind the Chinese question marks character is different from the English one.

French can express it in that way: %
\foreignlanguage{francais}{\begin{quote}Où l'enfant est-il~?\end{quote}} %
Be careful about the non-breaking space before the question mark.

Spaniards would type:
\foreignlanguage{spanish}{\begin{quote}¿Donde está lo niño?\end{quote}}.

\end{document}

I have several troubles with it. I'm using pdflatex with these arguments: -synctex=1 -interaction=nonstopmode. Here is the log output:

line 18: Package babel Error: You haven't defined the language chinese yet ...begin{quote}哪裡的孩子?\end{quote}}
line 18: ucs: Unknown Unicode character 21738 = U+54EA,(ucs) possibly declared in uni-84.def. ...begin{quote}哪裡的孩子?\end{quote}}
line 18: ucs: Unknown Unicode character 35041 = U+88E1,(ucs) possibly declared in uni-136.def. ...begin{quote}哪裡的孩子?\end{quote}}
line 18: ucs: Unknown Unicode character 30340 = U+7684,(ucs) possibly declared in uni-118.def. ...begin{quote}哪裡的孩子?\end{quote}}
line 18: ucs: Unknown Unicode character 23401 = U+5B69,(ucs) possibly declared in uni-91.def. ...begin{quote}哪裡的孩子?\end{quote}}
line 18: ucs: Unknown Unicode character 23376 = U+5B50,(ucs) possibly declared in uni-91.def. ...begin{quote}哪裡的孩子?\end{quote}}
line 18: ucs: Unknown Unicode character 65311 = U+FF1F,(ucs) possibly declared in uni-255.def. ...begin{quote}哪裡的孩子?\end{quote}}
line 20: Package babel Error: You haven't defined the language chinese yet ...{chinese}{\begin{quote}哪里的孩子?}
line 20: ucs: Unknown Unicode character 37324 = U+91CC,(ucs) possibly declared in uni-145.def. ...{chinese}{\begin{quote}哪里的孩子?}
line 20: \begin{document} ended by \end{quote}. ...begin{quote}哪里的孩子?}\end{quote}
line 20: Too many }'s ...egin{quote}哪里的孩子?}\end{quote}}
line 20: Unknown character 21738 = 0x54EA appeared again.
line 20: Unknown character 30340 = 0x7684 appeared again.
line 20: Unknown character 23401 = 0x5B69 appeared again.
line 20: Unknown character 23376 = 0x5B50 appeared again.
line 20: Unknown character 65311 = 0xFF1F appeared again.
line 17: Overfull \hbox (114.16321pt too wide) in paragraph
line 17: Overfull \hbox (190.48494pt too wide) in paragraph

I don't know whether LaTeX could make all my dreams to become reality ;-)

  • First of all, according to the preamble, what would be the default language of the document? Would I need to specify it after \begin{document}?

  • On this example I'm trying to use the babel package. Can we make it change the quotation marks used by \og \fg to use Chinese ones when necessary?

  • I would like to type in different languages directly in the LaTeX source document. Then, I made sure it's encoded in utf 8.

  • I tried to add the chinese parameter to babel but it doesn't seem to work properly. Is there any differences between how traditional and simplified Chinese are handled?

  • I would like to use this font for Chinese language, both traditional and simplified. I've installed it:

    [caocoa@c40c04 ~]$ yaourt -Qs ttf-tw
    local/ttf-tw 3.0-4
        Set of KAI and SONG fonts from the Ministry of Education of Taiwan. These fonts follow all the official recommendations and their shapes are 
        calligraphically correct.

    but I'm not sure to see it in the list below:

    [caocoa@c40c04 ~]$ fc-list :lang=ar | cut -d: -f1
    /usr/share/fonts/misc/9x15.pcf.gz
    /usr/share/fonts/TTF/DejaVuSansCondensed.ttf
    /usr/share/fonts/misc/10x20.pcf.gz
    /usr/share/fonts/TTF/times.ttf
    /usr/share/fonts/misc/cu12.pcf.gz
    /usr/share/fonts/TTF/DejaVuSansMono.ttf
    /usr/share/fonts/TTF/cour.ttf
    /usr/share/fonts/TTF/arialbd.ttf
    /usr/share/fonts/misc/9x15B.pcf.gz
    /usr/share/fonts/misc/arabic24.pcf.gz
    /usr/share/fonts/TTF/timesbd.ttf
    /usr/share/fonts/TTF/DejaVuSansMono-Bold.ttf
    /usr/share/fonts/TTF/DejaVuSansCondensed-Bold.ttf
    /usr/share/fonts/TTF/arial.ttf
    /usr/share/fonts/TTF/courbd.ttf
    /usr/share/fonts/TTF/DejaVuSans.ttf
    /usr/share/fonts/TTF/DejaVuSans-Bold.ttf

    Is it one of the *.pcf.gz? Would we have to do something farther to be able to use it in LaTeX?

Could you help me, or give me links to page which could be useful for me?

I've put a lot of code in this message because I'm trying to provide you all data you would need to help me. Don't see it as flood ;-) Thanks in advance for helping me.

Last edited by Caocoa (2014-02-02 22:10:14)


caocoa@C40C04 ~:

Offline

#2 2014-01-03 08:35:02

Caocoa
Member
Registered: 2010-11-11
Posts: 22

Re: (being solved) How to handle multilingualism and fonts use in LaTeX?

Hello again,

Actually, I think my previous message involves many different and complex fields that I don't fully understand yet. Instead of immediately trying to write Chinese in LaTeX, I think I would need comprehensive sites to explain me about fonts and LaTeX. Do I need to change my compiler for that, that's to say to try to use LuaTeX or another? I've tried to find some sites, but it's not so easy. Would you have links? ;-)

Sorry for the double-post.


caocoa@C40C04 ~:

Offline

#3 2014-01-03 10:20:25

ball
Member
From: Germany
Registered: 2011-12-23
Posts: 164

Re: (being solved) How to handle multilingualism and fonts use in LaTeX?

I've never used asian languages but I guess it would be much easier to start if you just go with XeTeX or LuaTeX, which provide support for OpenType fonts and UTF8 out of the box. At least for XeTeX you'd have to switch from babel to polyglossia.

As I just use european languages with latin alphabet I never felt the urge to switch from (La)TeX, but if you need real, non hackish support of asian languages, you should check out the more modern alternatives. (Disclaimer: This is half knowledge)

Last edited by ball (2014-01-03 10:24:25)

Offline

#4 2014-01-03 10:38:43

GordonGR
Member
From: Thessaloniki, Greece
Registered: 2011-11-07
Posts: 235

Re: (being solved) How to handle multilingualism and fonts use in LaTeX?

Yes, XeLaTeX is the way to go. My usual everyday template is

\documentclass[12pt,a4paper]{article}

\usepackage[cm-default]{fontspec}
\usepackage{xunicode}
\usepackage{xltxtra}
\usepackage{xgreek}
\setmainfont[Mapping=tex-text]{Old Standard TT}
\usepackage{a4wide}
\textheight=620pt

\begin{document}

\title{}
\author{}\date{}
\maketitle

\end{document}

and you just type unicode text in it. The xgreek package contains polyglossia, I think, and handles greek
syllabification. At any rate, I recommend you take a look at http://wiki.xelatex.org/.


Intel(R) Celeron(R) CPU E3400 @ 2.60GHz, 1878 MB, XFCE 4.12, x86_64. AURs.

“No one without the knowledge of geometry may enter.“ Plato.

Offline

#5 2014-01-24 06:57:13

Caocoa
Member
Registered: 2010-11-11
Posts: 22

Re: (being solved) How to handle multilingualism and fonts use in LaTeX?

OK folks, xeLaTeX has convinced me :-) Sure it's pretty easier to handle multilingualism. Next question is: « how to install it? » cuz it seems not to be easy to find proper package!

[caocoa@c40c04 ~]$ yaourt -Ss xelatex
aur/minionpro 2.015-7 (23)
    Myriad and Minion for LaTeX (the not-xeLaTeX way)
[caocoa@c40c04 ~]$ yaourt -Ss xetex
aur/xecjk 2.3.15-1 (31)
    XeTeX macro for typesetting mixed Chinese documents with punctuation spacing adjustment and prohibitions
aur/xecjk-svn 273-1 (2)
    XeTeX macro for typesetting mixed Chinese documents with punctuation spacing adjustment and prohibitions
aur/zhspacing 080102-1 (18)
    XeTeX macro for typesetting mixed Chinese documents with punctuation spacing adjustment and prohibitions

Edit:
The best is it's alrady included into TeX Live big_smile then it's already installed, I just need to start to use it!

Last edited by Caocoa (2014-01-24 07:09:52)


caocoa@C40C04 ~:

Offline

#6 2014-02-02 21:52:14

Caocoa
Member
Registered: 2010-11-11
Posts: 22

Re: (being solved) How to handle multilingualism and fonts use in LaTeX?

Hello all,

I give you a simple example of what I got with XeLaTeX. I'm quite happy, it's doing the right way!

The code is here http://pastebin.com/xEyhHqCm.

With the « AR PL UMing TW » font Xe_La_Te_X_0.png
With the « TW-MOE-Std-Kai » font Xe_La_Te_X_1.png

Last edited by Caocoa (2014-02-02 22:08:21)


caocoa@C40C04 ~:

Offline

Board footer

Powered by FluxBB