Outils pour utilisateurs

Outils du site


issue189:latex

Last issue, we made a one page poster advertising a lost dog. Of course the subject matter for a poster could be anything you wish. The poster got us started into an exploration of font use in Latex / Tex. Before we start, there are at least two guides you might wish to look at if this topic interests you. The first is more recent: LATEX 2ε Font Selection, compiled by the Latex Project Team (2021 March). The second is LATEX Font Encodings by Frank Mittelbach, Robin Fairbairns, and Werner Lemberg (2016 February). Because they deal with the same topic, there is some duplication of contents of course.

La dernière fois, nous avons fait une affiche « Animal perdu ». Bien entendu, le sujet de cette affiche peut être ce que vous voulez. Cette affiche était pour nous le moyen d’appréhender l'utilisation des polices en LaTeX/Tex. Avant de commencer, il y au moins deux guides que vous devriez regarder si le sujet vous intéresse. Le premier est le plus récent : LATEX 2ε Font Selection compilé par la Latex Project Team (2021 March). Le second est LATEX Font Encodings by Frank Mittelbach, Robin Fairbairns, et Werner Lemberg (2016 February). Comme ils abordent le même sujet, il y a bien sûr de nombreuses redites.

While pointing you to references, I should also point out The Tex Book by Donald Knuth is also available for download. It is a tex file, a large tex file, so you can open it in any text editor and examine the coding required to make this particular book. You can also compile it into a PDF (with TexStudio or whichever environment you use). If you download it, you are not allowed to distribute it or sell it. Printed copies are available through the usual sources.

Puisque nous en sommes aux références, je voudrais aussi ajouter The Tex Book écrit par Donald Knuth qui est disponible en téléchargement. C'est un document tex, un gros document tex. Vous pouvez voir comment il est fait avec n'importe quel éditeur de texte. Vous pouvez aussi le compiler en PDF avec TexStudio ou votre environnement préféré. Si vous le téléchargez, vous n’êtes pas autorisé à le distribuer ou à le vendre. Des versions imprimées sont disponibles via les moyens habituels.

As mentioned last time, there is a series of keywords which indicate the ten default sizes for fonts. Depending on the size of the base font selected (10pt, 11pt, 12pt), the keyword sizes increase from about 5pt to almost 25pt. We used the \selectfont command to change the existing font to a new one. (Note: Although not technically correct, I will use font and typeface to mean the same thing in this article.) If you make a change in the code, but do not use \selectfont where you want the change to occur, the change will not be visible.

Comme mentionné la dernière fois, il y a une série de 10 mots clés indiquant les tailles de police par défaut. Selon la taille de la police sélectionnée (10 pt, 11 pt, 12 pt), les mots clés l'augmentent d'environ 5 pt jusqu'à presque 25 pt. Nous utilisons la commande \selectfont pour changer la police actuelle vers la nouvelle. (Note : ce n'est pas tout à fait exact, mais j'utilise ici « font » et police de caractères pour parler de la même chose). Si vous modifiez le code, mais n'utilisez pas \selectfont là où vous voulez que le changement se produise, le changement ne sera pas visible.

There are six commands which can be used to change the appearance of the text: fontencoding {⟨encoding⟩}, fontfamily {⟨family⟩}, fontseries {⟨series⟩}, \fontshape {⟨shape⟩}, fontsize {⟨size⟩} {⟨baselineskip⟩}, linespread {⟨factor ⟩. These individual commands can be shortened to usefont {⟨encoding⟩} {⟨family⟩} {⟨series⟩} {⟨shape⟩}. In this article, I will focus on family, series, and shape. You have probably made changes to these features of a typeface when using a word processor.

Il y a six commandes qui peuvent être utilisées pour changer l'apparence du texte : fontencoding {⟨encoding⟩}, fontfamily {⟨family⟩}, fontseries {⟨series⟩}, \fontshape {⟨shape⟩}, fontsize {⟨size⟩} {⟨baselineskip⟩}, linespread {⟨factor⟩. Les commandes peuvent être regroupées dans usefont {⟨encoding⟩} {⟨family⟩} {⟨series⟩} {⟨shape⟩}. Dans cet article, je vais me concentrer sur family, series et shape (famille, séries et forme). Vous avez déjà dû modifier ces options de police dans un traitement de texte.

There are far too many font families to list. If you have done any HTML-CSS coding, you will be familiar with some font families. Word processors often use the term “font name” as a substitute for the font family. Then word processors use buttons or menus to set the series and shape. In Latex / Tex, a chosen series refers to the one of ten weights, and one of ten widths, of the font (Bold, Condensed, Light, etc.) Shape refers to normal, italic, small caps, and five others. Font size must be specified separately with the fontsize command if it is to be different from the default. Different measuring units can be used. If no unit is specified, then point (pt) is assumed.

Il y a beaucoup trop de familles de polices à lister. Si vous avez fait de la programmation HTML-CSS, vous serez familier avec certaines familles de polices. Les traitements de texte utilisent souvent le terme « nom de police » pour remplacer la famille de polices. Ensuite, les traitements de texte utilisent des boutons ou des menus pour définir la série et la forme. Dans LaTeX/Tex, une série choisie se réfère à l’un des dix poids, et l’une des dix largeurs, de la police (Gras, Condensé, Lumière, etc.) Forme se réfère à la normale, italique, petites majuscules, et cinq autres. La taille de police doit être spécifiée séparément avec la commande fontsize si elle doit être différente de la valeur par défaut. Différentes unités de mesure peuvent être utilisées. Si aucune unité n’est spécifiée, le point (pt) est supposé.

\paragraph*{} The quick fox jumped over the lazy yellow dog. \paragraph*{}\fontfamily{cmtt}\selectfont The quick fox jumped over the lazy yellow dog. \paragraph*{}\fontfamily{phv}\selectfont The quick fox jumped over the lazy yellow dog. This code produces: The \paragraph*{} code gives more space between lines of text than two presses of <enter>. The * means the paragraph is not numbered, and the {} means the paragraph does not have a name (title).

\paragraph*{} The quick fox jumped over the lazy yellow dog. \paragraph*{}\fontfamily{cmtt}\selectfont The quick fox jumped over the lazy yellow dog. \paragraph*{}\fontfamily{phv}\selectfont The quick fox jumped over the lazy yellow dog.

Ce code produit :

\paragraph*{} donne plus d’espace entre les lignes de texte que deux appuis sur <entrée>. Le * signifie que le paragraphe n’est pas numéroté, et le {} signifie que le paragraphe n’a pas de nom (titre).

As usual with Latex, there are other ways to vary fonts. The next method is suggested for small sections of text although it could be used for any quantity of text. There are at least nine additions to the \text command. All enclose the text to be modified in curly braces. The general form of the command is \text\_\_{modified text here}. When used, the underscore is replaced by two letters which indicate the desired effect. The two-letter codes try to indicate what the effect is. [Note: Not all fonts will have the appropriate letter set for the change.]

Comme d’habitude avec LaTeX, il existe d’autres façons de varier les polices. La méthode suivante est suggérée pour les petites sections de texte bien qu’elle puisse être utilisée pour n’importe quelle quantité de texte. Il y a au moins neuf ajouts à la commande \text. Tous contiennent le texte à modifier entre accolades. La forme générale de la commande est \text\__\_{texte modifié ici}. Lorsqu’il est utilisé, le soulignement est remplacé par deux lettres qui indiquent l’effet désiré. Les codes à deux lettres essaient d’indiquer ce qu'est l’effet. [Remarque : Ce ne sont pas toutes les polices qui auront la lettre appropriée réglée pour le changement.]

On my machine with the default font, UC did nothing and lf generated an error.

Sur ma machine avec la police par défaut, UC n’a rien fait et lf a généré une erreur.

It is possible to nest the codes to get various combinations. For example, some people like to use bold and italic together. In Latex that means: • writing the first code ending with curly braces • writing the second code inside the first set of curly braces • writing the text inside the inside curly braces \textbf{\textit{The quick fox jumped over the lazy yellow dog}}

Il est possible d’imbriquer les codes pour obtenir diverses combinaisons. Par exemple, certaines personnes aiment utiliser les caractères gras et italiques ensemble. En LaTeX cela signifie :

  • écrire le premier code se terminant par des accolades
  • écrire le deuxième code dans le premier ensemble d’accolades
  • écrire le texte à l’intérieur des accolades à l'intérieur des accolades

\textbf{\textit{The quick fox jumped over the lazy yellow dog}}

Here is the code and result: \paragraph*{}\textit{The quick fox jumped over the lazy yellow dog.} \paragraph*{}\texttt{The quick fox jumped over the lazy yellow dog.} \paragraph*{}\textbf{The quick fox jumped over the lazy yellow dog.} \paragraph*{}\textbf{\textit{The quick fox jumped over the lazy yellow dog}}

Voici le code et le résultat : \paragraph*{}\textit{The quick fox jumped over the lazy yellow dog.} \paragraph*{}\texttt{The quick fox jumped over the lazy yellow dog.} \paragraph*{}\textbf{The quick fox jumped over the lazy yellow dog.} \paragraph*{}\textbf{\textit{The quick fox jumped over the lazy yellow dog}}

It is possible to use three of the same two-letter abbreviations with another command to achieve similar results: \rmfamily, \sffamily, \ttfamily. A space is required between the command and the start of the text. Do not use curly braces around the text. I assume you can handle this code on your own.

Il est possible d’utiliser trois des mêmes abréviations de deux lettres avec une autre commande pour obtenir des résultats similaires : rmfamily, sffamily, ttfamily. Une espace est nécessaire entre la commande et le début du texte. N’utilisez pas d’accolades autour du texte. Je suppose que vous pouvez gérer ce code tout seul.

If you are eager to explore using different fonts in Latex, I suggest you start at tug.org/FontCatalogue. There are hundreds available – most Adobe Type 1 fonts, Open Type fonts and TrueType fonts can be used. The FontCatalogue page for each font will tell you if a particular font is installed by default or needs to be downloaded and installed. The page will also tell you if you need to use a specific package in the preamble of your document. Some fonts appear in the preamble as packages, others need one or more commands in order to be available to a Latex compiler. Here is an example from TexStudio.

Si vous désirez explorer l’utilisation de différentes polices dans LaTeX, je vous suggère de commencer par tug.org/FontCatalogue. Il en existe des centaines, la plupart des polices Adobe Type 1, Open Type et TrueType peuvent être utilisées. La page FontCatalogue de chaque police vous indiquera si une police spécifique est installée par défaut ou doit être téléchargée et installée. La page vous indiquera également si vous devez utiliser un paquet précis dans le préambule de votre document. Certaines polices apparaissent dans le préambule comme des paquets, d’autres nécessitent une ou plusieurs commandes pour être disponibles pour un compilateur LaTeX. Voici un exemple de TexStudio.

And here is what is needed for the preamble in order to change the default typeface in this document to Tex Gyre Adventor. (This is a sans serif typeface derived from the URW Gothic family.)

Et voici ce qui est nécessaire pour le préambule afin de changer la police par défaut dans ce document en Tex Gyre Adventor. (Cela est une police sans serif dérivée de la famille URW Gothic.)

\usepackage{tgadventor} \renewcommand*\familydefault{\sfdefault} \usepackage[T1]{fontenc}

\usepackage{tgadventor} \renewcommand*\familydefault{\sfdefault} \usepackage[T1]{fontenc}

Fonts are usually installed in /usr/share/fonts/, then under type (opentype, truetype, type1). In each type is a directory for each font name, for example my truetype directory has several subdirectories including: arphic, cm-unicode, dejavu, liberation, and others. If you want to know what fonts are available to you, without downloading anything, this is where to look. Have fun with Latex / Tex until next time.

Les polices sont généralement installées dans /usr/share/fonts/, puis sous le type (opentype, truetype, type1). Dans chaque type se trouve un répertoire pour chaque nom de police ; par exemple, mon répertoire truetype contient plusieurs sous-dossiers notamment arphic, cm-unicode, dejavu, liberation… Si vous voulez savoir quelles polices sont disponibles sans rien télécharger, c'est ici qu'il faut regarder. Amusez-vous bien avec LaTeX/TeX jusqu'à la prochaine fois.

issue189/latex.txt · Dernière modification : 2023/02/11 17:45 de andre_domenech