issue52:c_c
Différences
Ci-dessous, les différences entre deux révisions de la page.
| Prochaine révision | Révision précédente | ||
| issue52:c_c [2011/08/12 20:39] – créée fredphil91 | issue52:c_c [2011/10/14 21:38] (Version actuelle) – fredphil91 | ||
|---|---|---|---|
| Ligne 1: | Ligne 1: | ||
| - | Command & Conquer | + | **LaTeX: Asian languages support |
| - | + | ||
| - | LaTeX: Asian languages support | + | |
| I recently received an email from a reader, Chris, who can be found on launchpad.net as MrChris. He was asking me about Japanese input in LaTeX, as a follow-up to my article in FCM Issue #50. I didn't know the answer off the top of my head, but, together, we figured out a solution, which I felt I should share with anyone who may have the same question. Also, since the latex-cjk-* packages stand for “Chinese, Japanese, Korean”, I've covered (roughly) how to get each of the 3 languages working. | I recently received an email from a reader, Chris, who can be found on launchpad.net as MrChris. He was asking me about Japanese input in LaTeX, as a follow-up to my article in FCM Issue #50. I didn't know the answer off the top of my head, but, together, we figured out a solution, which I felt I should share with anyone who may have the same question. Also, since the latex-cjk-* packages stand for “Chinese, Japanese, Korean”, I've covered (roughly) how to get each of the 3 languages working. | ||
| Packages: | Packages: | ||
| + | texlive | ||
| + | texlive-latex-extra | ||
| + | latex-cjk-common | ||
| + | latex-cjk-japanese | ||
| + | latex-cjk-japanese-wadalab** | ||
| + | |||
| + | LaTeX : support des langues asiatiques | ||
| + | |||
| + | J'ai récemment reçu un courriel d'un lecteur, Chris, qui peut être trouvé sur launchpad.net sous le pseudo MrChris. Il me posait des questions sur la saisie en japonais avec LaTeX, suite à mon article dans le numéro 50 de FCM. Je n' | ||
| + | |||
| + | Paquets : | ||
| texlive | texlive | ||
| texlive-latex-extra | texlive-latex-extra | ||
| Ligne 12: | Ligne 21: | ||
| latex-cjk-japanese-wadalab | latex-cjk-japanese-wadalab | ||
| - | For Chinese (using Method #1 listed below), you'll also need: | + | **For Chinese (using Method #1 listed below), you'll also need: |
| latex-cjk-chinese | latex-cjk-chinese | ||
| latex-cjk-chinese-arphic-gkai00mp | latex-cjk-chinese-arphic-gkai00mp | ||
| For Japanese, I used the following template: | For Japanese, I used the following template: | ||
| - | http:// | + | http:// |
| - | \documentclass[12pt]{article} | + | Pour le chinois (en utilisant la méthode 1 ci-dessous), |
| + | latex-cjk-chinese | ||
| + | latex-cjk-chinese-arphic-gkai00mp | ||
| + | |||
| + | Pour le japonais, j'ai utilisé le modèle suivant : | ||
| + | http:// | ||
| + | |||
| + | **\documentclass[12pt]{article} | ||
| %------- | %------- | ||
| \usepackage{ucs} | \usepackage{ucs} | ||
| Ligne 38: | Ligne 54: | ||
| \begin{CJK}{UTF8}{} | \begin{CJK}{UTF8}{} | ||
| \begin{Japanese} | \begin{Japanese} | ||
| - | 日本Linux : 愛してる。 | + | 日本Linux : 愛してる。** |
| - | Note : English works too | + | |
| + | (traduction française inchangée) | ||
| + | |||
| + | **Note : English works too | ||
| \end{Japanese} | \end{Japanese} | ||
| \end{CJK} | \end{CJK} | ||
| writing English here is also possible but not Kanji and Furigana... | writing English here is also possible but not Kanji and Furigana... | ||
| + | \end{document}** | ||
| + | |||
| + | Note : le français fonctionne aussi | ||
| + | \end{Japanese} | ||
| + | \end{CJK} | ||
| + | on peut également écrire en français ici, mais pas de Kanji ni de Furigana... | ||
| \end{document} | \end{document} | ||
| - | As a brief explanation to the code: | + | **As a brief explanation to the code: |
| \usepackage{ucs} – unicode support | \usepackage{ucs} – unicode support | ||
| \usepackage[utf8x]{inputenc} – extended UTF-8 encoding (includes asian characters) | \usepackage[utf8x]{inputenc} – extended UTF-8 encoding (includes asian characters) | ||
| - | \usepackage[english]{babel} – sets the typographical rules (in this case, to English). This includes, among others, where to break words if it flows over a line. By assigning a typographical set of rules that doesn’t apply to Asian characters, you ensure that groups of Kanji aren’t separated when breaking over a line. In using a language that doesn' | + | \usepackage[english]{babel} – sets the typographical rules (in this case, to English). This includes, among others, where to break words if it flows over a line. By assigning a typographical set of rules that doesn’t apply to Asian characters, you ensure that groups of Kanji aren’t separated when breaking over a line. In using a language that doesn' |
| - | \usepackage[overlap, | + | Voici une brève explication de ce code : |
| + | |||
| + | \usepackage{ucs} – support de l' | ||
| + | \usepackage[utf8x]{inputenc} – encodage UTF-8 étendu (incluant les caractères asiatiques) ; | ||
| + | \usepackage[french]{babel} – fixe les règles typographiques (dans ce cas, au français). Cela comprend entre autres les endroits où couper les mots lorsqu' | ||
| + | |||
| + | **\usepackage[overlap, | ||
| \usepackage{CJKulem} – Used for certain options for CJK | \usepackage{CJKulem} – Used for certain options for CJK | ||
| Ligne 57: | Ligne 88: | ||
| \newenvironment{Japanese}{\CJKfamily{min} \CJKtilde \CJKnospace}{} - This creates a new environment (like “document”, | \newenvironment{Japanese}{\CJKfamily{min} \CJKtilde \CJKnospace}{} - This creates a new environment (like “document”, | ||
| - | The rest of the code is pretty self-explanatory. Once you compile the file, the PDF should contain the Japanese, in a nicely-formatted font. The only issue is that the text is not compiled top-to-bottom and right-to-left, | + | The rest of the code is pretty self-explanatory. Once you compile the file, the PDF should contain the Japanese, in a nicely-formatted font. The only issue is that the text is not compiled top-to-bottom and right-to-left, |
| + | |||
| + | \usepackage[overlap, | ||
| + | \usepackage{CJKulem} – utilisé pour certaines options de CJK | ||
| + | |||
| + | \renewcommand{\rubysep}{-0.2ex} – modifie l' | ||
| + | \newenvironment{Japanese}{\CJKfamily{min} \CJKtilde \CJKnospace}{} - Cela crée un nouvel environnement (comme « document », « enumerate », « itemize », etc.), qui configure les options pour la saisie en japonais. | ||
| + | |||
| + | Le reste du code est assez explicite. Lorsque que vous compilez le fichier, le fichier PDF devrait contenir le japonais, dans une police joliment formatée. Le seul problème est que le texte n'est pas compilé de haut en bas et de droite à gauche, comme c'est la norme pour le japonais. Je n'ai pas encore trouvé de solution qui fonctionne bien pour cela. Si quelqu' | ||
| - | For Chinese: | + | **For Chinese: |
| Method #1: | Method #1: | ||
| Ligne 70: | Ligne 109: | ||
| \CJKnospace}{} | \CJKnospace}{} | ||
| - | Also, the line “\begin{Japanese}” would logically have to be changed to “\begin{Chinese}”. Besides that, it will compile. As mentioned above, this will result in left-to-right and horizontal text. For top-to-bottom and right-to-left formatting, move on to Method #2. | + | Also, the line “\begin{Japanese}” would logically have to be changed to “\begin{Chinese}”. Besides that, it will compile. As mentioned above, this will result in left-to-right and horizontal text. For top-to-bottom and right-to-left formatting, move on to Method #2.** |
| - | Method #2: | + | Pour le chinois : |
| + | |||
| + | Méthode 1 : | ||
| + | |||
| + | Le même modèle qui fonctionne pour le japonais pourrait fonctionner pour le chinois aussi, avec les adaptations suivantes : | ||
| + | |||
| + | \newenvironment{Chinese}{ | ||
| + | \CJKfamily{gkai} | ||
| + | \CJKtilde | ||
| + | \CJKnospace}{} | ||
| + | |||
| + | La ligne " | ||
| + | |||
| + | **Method #2: | ||
| Disclaimer: I have not tried this method, nor do I know who originally wrote the script. However, Chris, the reader who originally posed the question, has tried it and gotten it to work, so I felt it deserved to be included here. | Disclaimer: I have not tried this method, nor do I know who originally wrote the script. However, Chris, the reader who originally posed the question, has tried it and gotten it to work, so I felt it deserved to be included here. | ||
| Ligne 81: | Ligne 133: | ||
| According to Chris, he had to make the following changes: | According to Chris, he had to make the following changes: | ||
| - | “Unfortunately, | + | “Unfortunately, |
| + | |||
| + | Méthode 2 : | ||
| + | |||
| + | Avertissement : je n'ai pas essayé cette méthode et je ne sais pas qui a écrit le script au départ. Cependant, Chris, le lecteur qui a initialement posé la question, a essayé et réussi à le faire fonctionner, | ||
| + | |||
| + | Téléchargez le script suivant: | ||
| + | http:// | ||
| + | |||
| + | Selon Chris, il a dû faire les modifications suivantes : | ||
| + | |||
| + | « Malheureusement, | ||
| - | After changing the fonts, using "xetex < | + | **After changing the fonts, using "xetex < |
| For Korean, the same method as used for Japanese can be used. You'd simply need to pick a font family for Korean, and install the following package: | For Korean, the same method as used for Japanese can be used. You'd simply need to pick a font family for Korean, and install the following package: | ||
| Ligne 89: | Ligne 152: | ||
| latex-cjk-korean | latex-cjk-korean | ||
| - | Since I don't speak Korean, I haven' | + | Since I don't speak Korean, I haven' |
| - | I hope you have found this article useful. If anyone has a specific issue (or question), you can reach me at lswest34@gmail.com. Please be sure to include “FCM” or “C& | + | Après avoir changé les polices, en utilisant « xetex < |
| + | |||
| + | Pour le coréen, la même méthode que celle utilisée pour le japonais peut être utilisée. Vous aurez tout simplement besoin de choisir une famille de polices pour le coréen, et d' | ||
| + | |||
| + | latex-cjk-korean | ||
| + | |||
| + | Comme je ne parle pas coréen, je n'ai pas pu essayer et trouver la famille de polices correcte, mais je suggère de l' | ||
| + | |||
| + | **I hope you have found this article useful. If anyone has a specific issue (or question), you can reach me at lswest34@gmail.com. Please be sure to include “FCM” or “C& | ||
| References: | References: | ||
| Ligne 98: | Ligne 169: | ||
| * Information on UCS is from here: http:// | * Information on UCS is from here: http:// | ||
| * A blog post by Chris on Japanese: http:// | * A blog post by Chris on Japanese: http:// | ||
| - | * A blog post by Chris on Chinese: http:// | + | * A blog post by Chris on Chinese: http:// |
| + | |||
| + | J' | ||
| + | |||
| + | Références : | ||
| + | |||
| + | * le document original de test en japonais vient d'ici : https:// | ||
| + | * l' | ||
| + | * un article de blog de Chris sur le japonais : http:// | ||
| + | * un article de blog de Chris sur le chinois : http:// | ||
issue52/c_c.1313174372.txt.gz · Dernière modification : 2011/08/12 20:39 de fredphil91
