issue213:latex
Différences
Ci-dessous, les différences entre deux révisions de la page.
Prochaine révision | Révision précédente | ||
issue213:latex [2025/02/01 12:16] – créée d52fr | issue213:latex [2025/02/08 15:38] (Version actuelle) – andre_domenech | ||
---|---|---|---|
Ligne 1: | Ligne 1: | ||
- | This time, I will introduce you to the babel package, the modern way to use a language other than English in Latex documents. It is also the modern way to use more than one language in a document. It works with UTF-8 encoding for fonts, essential for many languages. In addition to loading the babel package, you will also need to load a font package that is appropriate for your language of choice. The babel documentation outlines the basics: | + | **This time, I will introduce you to the babel package, the modern way to use a language other than English in Latex documents. It is also the modern way to use more than one language in a document. It works with UTF-8 encoding for fonts, essential for many languages. In addition to loading the babel package, you will also need to load a font package that is appropriate for your language of choice. The babel documentation outlines the basics: |
• Tell babel what language or languages are required. | • Tell babel what language or languages are required. | ||
• Select a suitable font or fonts if necessary. | • Select a suitable font or fonts if necessary. | ||
Ligne 8: | Ligne 8: | ||
\usepackage{babel} | \usepackage{babel} | ||
+ | |||
+ | \begin{document} | ||
+ | |||
+ | Plus \c{c}a change, plus c'est la m\^{e}me chose. | ||
+ | |||
+ | \end{document}** | ||
+ | |||
+ | Cette fois-ci, je vais vous présenter le paquet babel, le moyen moderne d' | ||
+ | - Indiquez à babel la ou les langues requises. | ||
+ | - Sélectionnez une ou plusieurs polices de caractères appropriées si nécessaire. | ||
+ | - Dans les documents multilingues, | ||
+ | |||
+ | Par exemple : | ||
+ | \documentclass[french]{article} | ||
+ | |||
+ | \n-usepackage{babel} | ||
\begin{document} | \begin{document} | ||
Ligne 15: | Ligne 31: | ||
\end{document} | \end{document} | ||
- | The [french] option in the document class informs Latex this document uses the French language and it is monolingual. To make a bilingual (or multilingual) document include two (or more) languages as options in the documentclass instruction. The last one will be the default language. To use French as the primary language and German as an occasional language, the option would be [german, | + | |
+ | **The [french] option in the document class informs Latex this document uses the French language and it is monolingual. To make a bilingual (or multilingual) document include two (or more) languages as options in the documentclass instruction. The last one will be the default language. To use French as the primary language and German as an occasional language, the option would be [german, | ||
Localization requires a lot more than simply spelling words correctly and using the correct letters. There is a 45-page chapter in volume 2 of The Latex Companion dedicated to this topic. There are more than sixty languages which can be produced with Latex. This includes many languages that use an alphabet and others which do not. Of course in order for a document to be produced, not only must a suitable font be used but the user must also know how to type that particular language. For example, unless you are familiar with typing French, would you have guessed what Latex command to use to generate ç or ê? | Localization requires a lot more than simply spelling words correctly and using the correct letters. There is a 45-page chapter in volume 2 of The Latex Companion dedicated to this topic. There are more than sixty languages which can be produced with Latex. This includes many languages that use an alphabet and others which do not. Of course in order for a document to be produced, not only must a suitable font be used but the user must also know how to type that particular language. For example, unless you are familiar with typing French, would you have guessed what Latex command to use to generate ç or ê? | ||
- | If you work in two languages, how to switch from one language to another and back in one document? Babel uses the command \selectlanguage for large blocks of text like paragraphs and \foreignlanguage for small bits inside paragraphs. Here is the example used on p. 303 of vol. 2 of The Latex Companion . Because of some limitations in my system I had to use the csquotes package as well in order to generate the appropriate quotation marks.. | + | If you work in two languages, how to switch from one language to another and back in one document? Babel uses the command \selectlanguage for large blocks of text like paragraphs and \foreignlanguage for small bits inside paragraphs. Here is the example used on p. 303 of vol. 2 of The Latex Companion . Because of some limitations in my system I had to use the csquotes package as well in order to generate the appropriate quotation marks.. |
- | Typesetting a document in a foreign language is not as simple as changing the words. Many languages require accents. Most languages in the world do not use what is often called the Latin alphabet. So relevant fonts have to be developed and then the font package used in the preamble in the Latex document. Different languages may require different shapes than English for numbers. | + | L' |
+ | |||
+ | La localisation nécessite bien plus que simplement épeler correctement les mots et utiliser les bonnes lettres. Il y a un chapitre de 45 pages dans le volume 2 de The LaTeX Companion consacré à ce sujet. Il existe plus de soixante langues qui peuvent être produites avec LaTeX. Cela inclut de nombreuses langues qui utilisent un alphabet et d' | ||
+ | |||
+ | Si vous travaillez dans deux langues, comment passer d'une langue à l' | ||
+ | |||
+ | |||
+ | **Typesetting a document in a foreign language is not as simple as changing the words. Many languages require accents. Most languages in the world do not use what is often called the Latin alphabet. So relevant fonts have to be developed and then the font package used in the preamble in the Latex document. Different languages may require different shapes than English for numbers. | ||
A very important part of typesetting a document is hyphenation. I do not use hyphenation when I write for FCM. I prefer ragged right margins to fully justified text so I do not need to be concerned about hyphenation. However many magazines, newspapers and journals use columns of text (like FCM) and set fully justified text to indicate the edges of columns. Without hyphenation, | A very important part of typesetting a document is hyphenation. I do not use hyphenation when I write for FCM. I prefer ragged right margins to fully justified text so I do not need to be concerned about hyphenation. However many magazines, newspapers and journals use columns of text (like FCM) and set fully justified text to indicate the edges of columns. Without hyphenation, | ||
- | Punctuation marks differ between languages. The example in the graphic shows three different types of quotation marks. There are other ways quotations are indicated in other languages. Even the simple period is not always used between sentences. In Chinese an open circle is often (although not exclusively) used. Sometimes it appears in the centre of the line of text ◦◦, | + | Punctuation marks differ between languages. The example in the graphic shows three different types of quotation marks. There are other ways quotations are indicated in other languages. Even the simple period is not always used between sentences. In Chinese an open circle is often (although not exclusively) used. Sometimes it appears in the centre of the line of text ◦◦, |
- | Babel provides translations for document element names Latex uses in its document classes. (This feature is not working on my machine.) Terms like chapter name, figure name, table name are called language dependent strings in babel and will be translated using commands like \figurename. | + | La composition d'un document dans une langue étrangère n'est pas aussi simple que de changer les mots. De nombreuses langues nécessitent des accents. La plupart des langues du monde n' |
+ | |||
+ | Une partie très importante de la composition d'un document est la césure. Je n' | ||
+ | |||
+ | Les signes de ponctuation diffèrent selon les langues. L' | ||
+ | |||
+ | |||
+ | **Babel provides translations for document element names Latex uses in its document classes. (This feature is not working on my machine.) Terms like chapter name, figure name, table name are called language dependent strings in babel and will be translated using commands like \figurename. | ||
Dates are formatted differently in different languages, some languages have more than one way to format dates. In Canada, we cannot decide which method to use. Many organizations use the international standard of largest to smallest: yyyy mm dd. Others reverse this international standard:: dd mm yyyy. Still others use the American standard: mm dd yyyy. Despite the complications which occurred before the year rolled to 2000, many continue to use a two-digit year. Of course there is no problem understanding dates so long as the name of the month is in letters. If in numbers, there can be confusion: is 9/12/2024 the ninth of December or the twelfth of September. | Dates are formatted differently in different languages, some languages have more than one way to format dates. In Canada, we cannot decide which method to use. Many organizations use the international standard of largest to smallest: yyyy mm dd. Others reverse this international standard:: dd mm yyyy. Still others use the American standard: mm dd yyyy. Despite the complications which occurred before the year rolled to 2000, many continue to use a two-digit year. Of course there is no problem understanding dates so long as the name of the month is in letters. If in numbers, there can be confusion: is 9/12/2024 the ninth of December or the twelfth of September. | ||
Ligne 32: | Ligne 63: | ||
Many languages have a standard format for dates. Perhaps the month name is always in letters. In Bulgarian, the month is indicated by upper case Roman numerals. In Greek, numbers can be written with letters (two different systems) or with numbers. Dates in Greek can be written with any of the three possible ways to represent numbers or by spelling the name of the month. | Many languages have a standard format for dates. Perhaps the month name is always in letters. In Bulgarian, the month is indicated by upper case Roman numerals. In Greek, numbers can be written with letters (two different systems) or with numbers. Dates in Greek can be written with any of the three possible ways to represent numbers or by spelling the name of the month. | ||
- | Generally, numerical values are shown with the same Arabic numbers we all know. As mentioned in Bulgarian and Greek, numbers can be represented with letters. That is also true in a few other languages, although this usage seems to be slowly disappearing. According to The Latex Companion (vol 2, p. 319), Icelandic documents require special formatting for numbers and need the command \tala. In French, there are shorthand commands to generate the first four ordinal numbers \primo, \secundo, \tertia, \quattro. | + | Generally, numerical values are shown with the same Arabic numbers we all know. As mentioned in Bulgarian and Greek, numbers can be represented with letters. That is also true in a few other languages, although this usage seems to be slowly disappearing. According to The Latex Companion (vol 2, p. 319), Icelandic documents require special formatting for numbers and need the command \tala. In French, there are shorthand commands to generate the first four ordinal numbers \primo, \secundo, \tertia, \quattro. |
- | If you typeset documents using either the Greek or one of the Cyrillic alphabets, you should read the documentation available in The Latex Companion and any other helpful documentation. The authors recommend using either XeTex or LuaTex instead of pdfTex for Greek. | + | Babel fournit des traductions pour les noms d' |
+ | |||
+ | Les dates sont formatées différemment selon les langues, certaines langues ont plus d'une façon de formater les dates. Au Canada, nous ne pouvons pas décider quelle méthode utiliser. De nombreuses organisations utilisent la norme internationale du plus grand au plus petit : aaaa mm jj. D' | ||
+ | |||
+ | De nombreuses langues ont un format standard pour les dates. Il est possible que le nom du mois soit toujours en lettres. En bulgare, le mois est indiqué par des chiffres romains majuscules. En grec, les nombres peuvent être écrits avec des lettres (deux systèmes différents) ou avec des chiffres. Les dates en grec peuvent être écrites avec l'une des trois manières possibles de représenter les nombres ou en épelant le nom du mois. | ||
+ | |||
+ | En général, les valeurs numériques sont affichées avec les mêmes chiffres arabes que nous connaissons tous. Comme mentionné en bulgare et en grec, les nombres peuvent être représentés par des lettres. C'est également vrai dans quelques autres langues, bien que cet usage semble disparaître lentement. Selon The LaTeX Companion (vol 2, p. 319), les documents islandais nécessitent un formatage spécial pour les nombres et nécessitent la commande \tala. En français, il existe des commandes abrégées pour générer les quatre premiers nombres ordinaux \primo, \secundo, \tertio, \quattro. | ||
+ | |||
+ | |||
+ | **If you typeset documents using either the Greek or one of the Cyrillic alphabets, you should read the documentation available in The Latex Companion and any other helpful documentation. The authors recommend using either XeTex or LuaTex instead of pdfTex for Greek. | ||
Typing in Chinese or Korean or Japanese requires additional support. It is necessary to be able to input the appropriate code for each character in these languages. In Chinese, the most common method to “spell” a Chinese character is pinyin. The input method accepts the keyboard input and presents a series of choices which match the pinyin which has been typed (something like a spell checker). The writer then picks the correct form and it displays on the screen. That is how I typed these four characters: 我是老师. Unlike Chinese and Japanese, Korean is written using an alphabet. However the letter forms change depending on which vowel is combined with which consonant and in what order. Each syllable is represented by one character, the same as Chinese and Japanese. | Typing in Chinese or Korean or Japanese requires additional support. It is necessary to be able to input the appropriate code for each character in these languages. In Chinese, the most common method to “spell” a Chinese character is pinyin. The input method accepts the keyboard input and presents a series of choices which match the pinyin which has been typed (something like a spell checker). The writer then picks the correct form and it displays on the screen. That is how I typed these four characters: 我是老师. Unlike Chinese and Japanese, Korean is written using an alphabet. However the letter forms change depending on which vowel is combined with which consonant and in what order. Each syllable is represented by one character, the same as Chinese and Japanese. | ||
Ligne 45: | Ligne 85: | ||
\usepackage{noto-serif} %Load a font for this document. | \usepackage{noto-serif} %Load a font for this document. | ||
+ | |||
+ | \begin{document}** | ||
+ | |||
+ | Si vous composez des documents en utilisant l' | ||
+ | |||
+ | La saisie en chinois, en coréen ou en japonais nécessite une assistance supplémentaire. Il est nécessaire de pouvoir saisir le code approprié pour chaque caractère dans ces langues. En chinois, la méthode la plus courante pour « épeler » un caractère chinois est le pinyin. La méthode de saisie accepte la saisie au clavier et présente une série de choix qui correspondent au pinyin qui a été tapé (un peu comme un correcteur orthographique). L' | ||
+ | |||
+ | Pour écrire dans l'une de ces trois langues, il faut avoir accès à des jeux de caractères correspondant à la méthode de saisie. Le premier et le meilleur ensemble de paquets permettant d' | ||
+ | |||
+ | \documentclass[12pt]{article} | ||
+ | |||
+ | \usepackage{CJKutf8} %Charger la version UTF8 de CJK | ||
+ | |||
+ | \usepackage{noto-serif} %Charger une police pour ce document. | ||
\begin{document} | \begin{document} | ||
- | While it is possible to write Chinese in columns starting in the top-right corner of the writing space, normally Chinese is written left-to-right top-down in rows the same as English. | + | **While it is possible to write Chinese in columns starting in the top-right corner of the writing space, normally Chinese is written left-to-right top-down in rows the same as English. |
I can type pinyin to generate Chinese characters. In order to generate Chinese characters (or Japanese or Korean), I need to add a package to Latex. Either CJK or CTEX are recommended. See image below. | I can type pinyin to generate Chinese characters. In order to generate Chinese characters (or Japanese or Korean), I need to add a package to Latex. Either CJK or CTEX are recommended. See image below. | ||
Ligne 55: | Ligne 109: | ||
As you may know Hebrew and Arabic are written right-to-left. The Hebrew and Arabic alphabets contain only consonants. Arabic consonants change shape depending on their position in a word: beginning, middle, end. The letters in a Mongolian word are written top-down. Words in a Mongolian sentence are written right-to-left. (Humans have used many variations in order to communicate using writing.) The problem of writing in other than left-to-right order requires at least one other package: bidi (for bidirectional). The difficulties caused by Mongolian text are overcome with Unicode. | As you may know Hebrew and Arabic are written right-to-left. The Hebrew and Arabic alphabets contain only consonants. Arabic consonants change shape depending on their position in a word: beginning, middle, end. The letters in a Mongolian word are written top-down. Words in a Mongolian sentence are written right-to-left. (Humans have used many variations in order to communicate using writing.) The problem of writing in other than left-to-right order requires at least one other package: bidi (for bidirectional). The difficulties caused by Mongolian text are overcome with Unicode. | ||
- | This excursion into the world of typesetting for more than one language points out a feature of Tex that is hidden from users who install a variant of Tex in one language. Some variants of Tex are fully compatible with Unicode, others are not. This is similar to issues between some variations of Linux. For example, to install krecipes on Linux that is not based in Ubuntu requires the addition of many packages because krecipes uses features of Ubuntu that are not normally installed with other variants of Linux. If you never want to use krecipes you never have to think about this situation. | + | This excursion into the world of typesetting for more than one language points out a feature of Tex that is hidden from users who install a variant of Tex in one language. Some variants of Tex are fully compatible with Unicode, others are not. This is similar to issues between some variations of Linux. For example, to install krecipes on Linux that is not based in Ubuntu requires the addition of many packages because krecipes uses features of Ubuntu that are not normally installed with other variants of Linux. If you never want to use krecipes you never have to think about this situation.** |
- | I did find some workaround code that makes my plain vanilla Latex work with and produce characters I do not often use. The other choice would have been to install at least one other version of Tex, probably pdfTex or LuaTex. I chose not to add more files to my machine. This is in keeping with Knuth’s original design idea. Do not make the user install any more bits of software than they need. Unlike some other versions of Latex, mine does not automatically install any required packages. Instead, it generates an error which indicates it cannot find a particular package the user requires. | + | Bien qu'il soit possible d' |
+ | |||
+ | Je peux taper du pinyin pour générer des caractères chinois. Pour générer des caractères chinois (ou japonais ou coréens), je dois ajouter un paquet à LaTeX. Il est recommandé d' | ||
+ | |||
+ | Comme vous le savez peut-être, l' | ||
+ | |||
+ | Cette excursion dans le monde de la composition typographique pour plusieurs langues met en évidence une fonctionnalité de Tex qui est cachée aux utilisateurs qui installent une variante de Tex dans une langue. Certaines variantes de Tex sont entièrement compatibles avec Unicode, d' | ||
+ | |||
+ | **I did find some workaround code that makes my plain vanilla Latex work with and produce characters I do not often use. The other choice would have been to install at least one other version of Tex, probably pdfTex or LuaTex. I chose not to add more files to my machine. This is in keeping with Knuth’s original design idea. Do not make the user install any more bits of software than they need. Unlike some other versions of Latex, mine does not automatically install any required packages. Instead, it generates an error which indicates it cannot find a particular package the user requires. | ||
One of the operations I will examine in the near future is the installation of new packages. Depending on when I get to that topic I may also look at updating Latex to a new version. | One of the operations I will examine in the near future is the installation of new packages. Depending on when I get to that topic I may also look at updating Latex to a new version. | ||
- | This is the end for this time. Keep exploring Tex / Latex. Ask me any questions you have about it. | + | This is the end for this time. Keep exploring Tex / Latex. Ask me any questions you have about it.** |
+ | |||
+ | J'ai trouvé un code de contournement qui permet à mon LaTeX de fonctionner avec des caractères que je n' | ||
+ | |||
+ | L'une des opérations que j' | ||
+ | |||
+ | C'est la fin pour cette fois. Continuez à explorer Tex/LaTeX. Posez-moi toutes les questions que vous avez à ce sujet. | ||
issue213/latex.1738408580.txt.gz · Dernière modification : 2025/02/01 12:16 de d52fr