issue199:latex
Différences
Ci-dessous, les différences entre deux révisions de la page.
Prochaine révision | Révision précédente | ||
issue199:latex [2023/11/25 18:39] – créée auntiee | issue199:latex [2023/11/30 10:35] (Version actuelle) – auntiee | ||
---|---|---|---|
Ligne 1: | Ligne 1: | ||
- | This might be the easiest and simplest task to do in Latex that we have encountered. | + | **This might be the easiest and simplest task to do in Latex that we have encountered. |
To add hypertext links to a document, add the hyperref package to the document preamble. According to the documentation, | To add hypertext links to a document, add the hyperref package to the document preamble. According to the documentation, | ||
+ | |||
+ | \usepackage{inputenc, | ||
+ | |||
+ | Cela pourrait être la tâche la plus facile et la plus simple à faire dans LaTeX que nous ayons rencontrée. | ||
+ | |||
+ | Pour ajouter des liens hypertextes à un document, ajoutez le paquet hyperref au préambule du document. Selon la documentation, | ||
\usepackage{inputenc, | \usepackage{inputenc, | ||
- | As you can see in Figure 1, there are now links in the Table of Contents to all of the chapter headings. This happens automatically with the hyperref package. The formatting you see is the default formatting with this package. I do not like the red boxes around each link, and I will change those using features of the hyperref package. | + | |
+ | **As you can see in Figure 1, there are now links in the Table of Contents to all of the chapter headings. This happens automatically with the hyperref package. The formatting you see is the default formatting with this package. I do not like the red boxes around each link, and I will change those using features of the hyperref package. | ||
Looking at the recipe for Steamed Buns, you can see a citation. There is also a hot link to the work in the Bibliography to match this citation. This kind of link has a green box around it, again it’s not the formatting I like, so I hope to change it. | Looking at the recipe for Steamed Buns, you can see a citation. There is also a hot link to the work in the Bibliography to match this citation. This kind of link has a green box around it, again it’s not the formatting I like, so I hope to change it. | ||
- | I did not build any links for the items in the Glossary. I could add those links into the relevant files. I note there is no way in the initial document to return to the Table of Contents after having read a recipe. I will also take a look at using the Table of Contents to make a Bookmarks column in the generated PDF. | + | I did not build any links for the items in the Glossary. I could add those links into the relevant files. I note there is no way in the initial document to return to the Table of Contents after having read a recipe. I will also take a look at using the Table of Contents to make a Bookmarks column in the generated PDF.** |
- | Formatting links | + | Comme vous pouvez le voir à la figure 1 (ci-dessous à gauche), il y a maintenant des liens dans la table des matières vers tous les titres de chapitres. Cela se produit automatiquement avec le paquet hyperref. Le formatage que vous voyez est le formatage par défaut avec ce paquet. Je n’aime pas les cadres rouges autour de chaque lien, et je vais les changer en utilisant les fonctionnalités du paquet hyperref. |
+ | |||
+ | En regardant la recette pour les petits pains cuits à la vapeur, vous pouvez voir une citation. Il y a aussi un lien vers l' | ||
+ | |||
+ | Je n’ai pas créé de liens pour les éléments du Glossaire. Je pourrais ajouter ces liens dans les fichiers pertinents. Je constate qu’il n’y a aucun moyen dans le document initial de revenir à la Table des matières après avoir lu une recette. Je vais également jeter un coup d’œil à l’utilisation de la Table des matières pour créer une colonne Bookmarks (Signets) dans le PDF généré. | ||
+ | |||
+ | |||
+ | **Formatting links | ||
In order to learn how to format the automatically generated links using hyperref, I read through the documentation for the hyperref package. I know reading the manual is counter-intuitive for many people involved in IT. Things should be self-explanatory. I agree – most software should be self-explanatory, | In order to learn how to format the automatically generated links using hyperref, I read through the documentation for the hyperref package. I know reading the manual is counter-intuitive for many people involved in IT. Things should be self-explanatory. I agree – most software should be self-explanatory, | ||
The documentation that comes with the hyperref package is not beginner-friendly. In particular, it could use more examples. Perhaps a separate document containing examples would be better than more text. A large number of possible options are available. In the case of this cookbook, I wanted some indication there were links, but I wanted to eliminate the boxes. I used the instruction hypersetup with two options. | The documentation that comes with the hyperref package is not beginner-friendly. In particular, it could use more examples. Perhaps a separate document containing examples would be better than more text. A large number of possible options are available. In the case of this cookbook, I wanted some indication there were links, but I wanted to eliminate the boxes. I used the instruction hypersetup with two options. | ||
+ | |||
\hypersetup{pdfborder=0 0 0, colorlinks=true} | \hypersetup{pdfborder=0 0 0, colorlinks=true} | ||
+ | ** | ||
+ | |||
+ | |||
+ | Mise en forme des liens | ||
+ | |||
+ | Afin d’apprendre à formater les liens générés automatiquement en utilisant hyperref, j’ai lu la documentation pour le paquet hyperref. Je sais que la lecture du manuel est contre-intuitive pour de nombreuses personnes impliquées dans l' | ||
+ | |||
+ | La documentation fournie avec le paquet hyperref n’est pas adaptée aux débutants. En particulier, | ||
+ | |||
+ | \hypersetup{pdfborder=0 0 0, colorlinks=true} | ||
+ | |||
+ | |||
+ | **The default for pdfborder is 0 0 1. Setting the last digit to 0 turns off the boxes. Having any positive value as the last digit makes the boxes visible. I used colorlinks=-true in order to have a visible indication some text was different from the main text. The default is colorlinks=false, | ||
+ | |||
+ | La valeur par défaut pour pdfborder est 0 0 1. Le réglage du dernier chiffre à 0 désactive les cadres. Avoir une valeur positive comme dernier chiffre rend les cadres visibles. J’ai utilisé colorlinks=-true afin d’avoir une indication visible du fait que certaines parties du texte soient différents du texte principal. La valeur par défaut est colorlinks=false, | ||
- | The default for pdfborder is 0 0 1. Setting the last digit to 0 turns off the boxes. Having any positive value as the last digit makes the boxes visible. I used colorlinks=-true in order to have a visible indication some text was different from the main text. The default is colorlinks=false, | ||
- | Links to Glossary | + | **Links to Glossary |
Setting up links between text in the recipes and the Glossary is not difficult. I could use the same process described in Return links to the Table of Contents. However, the return links should all point back to the same spot unless you want to make a lot of “back links” in the Glossary. For example, there is an entry in the Glossary for sesame oil. Several recipes use sesame oil. (Check the index to see how many pages have this ingredient.) You could set up separate links to every recipe using sesame oil. Then the reader would have to choose which one to get back to the recipe they were reading or using. Having all the back links point to the Table of Contents means the reader would need to remember which recipe they were using, then click from the Glossary to the Table of Contents, and then to the recipe they wish to use. While this is a little inconvenient for the user, it simplifies the coding, greatly reduces the time needed for coding, and generates only one back link for each entry in the Glossary, not one back link for every recipe where a specific ingredient occurs. | Setting up links between text in the recipes and the Glossary is not difficult. I could use the same process described in Return links to the Table of Contents. However, the return links should all point back to the same spot unless you want to make a lot of “back links” in the Glossary. For example, there is an entry in the Glossary for sesame oil. Several recipes use sesame oil. (Check the index to see how many pages have this ingredient.) You could set up separate links to every recipe using sesame oil. Then the reader would have to choose which one to get back to the recipe they were reading or using. Having all the back links point to the Table of Contents means the reader would need to remember which recipe they were using, then click from the Glossary to the Table of Contents, and then to the recipe they wish to use. While this is a little inconvenient for the user, it simplifies the coding, greatly reduces the time needed for coding, and generates only one back link for each entry in the Glossary, not one back link for every recipe where a specific ingredient occurs. | ||
- | The simplest approach would be to put “see Glossary” in parentheses after the name of the ingredient. That might get tedious for the reader and would certainly get tiresome to input all those extra bits of text. Another solution would be to make a footnote in each recipe that contained an ingredient listed in the Glossary. The footnote would be “see Glossary”. Again that would be tiresome to type (or copy and paste) in all the relevant recipes but not so obtrusive for the reader. Neither of these methods takes advantage of the electronic links that are available with Latex in an on-screen PDF. | + | The simplest approach would be to put “see Glossary” in parentheses after the name of the ingredient. That might get tedious for the reader and would certainly get tiresome to input all those extra bits of text. Another solution would be to make a footnote in each recipe that contained an ingredient listed in the Glossary. The footnote would be “see Glossary”. Again that would be tiresome to type (or copy and paste) in all the relevant recipes but not so obtrusive for the reader. Neither of these methods takes advantage of the electronic links that are available with Latex in an on-screen PDF.** |
- | Ideally, every item in the Glossary would be matched to a pop-up item. If the user of the book hovers over an unknown term a box would pop up giving the information in the glossary. If I add the pdfcomment package to the document, this kind of popup or comment or annotation can be made available in the PDF version of the document. I hope it is obvious why popups are not available in printed documents. I hope it is also obvious why popups for the glossary are not necessary in a printed copy of this cookbook. | + | Liens vers le Glossaire |
+ | |||
+ | La mise en place de liens entre le texte des recettes et le Glossaire n’est pas difficile. Je pourrais utiliser le même processus décrit dans les liens de retour vers la Table des matières. Toutefois, les liens de retour doivent tous pointer vers le même endroit, à moins que vous ne vouliez faire beaucoup de « liens de retour » dans le Glossaire. Par exemple, il y a une entrée dans le Glossaire pour l’huile de sésame. Plusieurs recettes utilisent de l’huile de sésame. (Consultez l’index pour voir combien de pages contiennent cet ingrédient.) Vous pouvez créer des liens séparés vers chaque recette utilisant de l’huile de sésame. Ensuite, le lecteur devrait choisir lequel pour revenir à la recette qu’il lit ou utilise. Si tous les liens de retour pointent vers la Table des matières, le lecteur devra se souvenir de la recette qu’il utilise, puis cliquer du Glossaire vers la Table des matières, puis sur la recette qu’il souhaite utiliser. Bien que cela soit un peu gênant pour l’utilisateur, | ||
+ | |||
+ | L’approche la plus simple serait de mettre « voir le Glossaire » entre parenthèses après le nom de l’ingrédient. Cela pourrait devenir fastidieux pour le lecteur et serait certainement fatigant d’entrer tous ces morceaux supplémentaires de texte. Une autre solution serait de faire une note de bas de page dans chaque recette qui contient un ingrédient énuméré dans le Glossaire. La note de bas de page serait « voir Glossaire ». Encore une fois, il serait fastidieux de taper cela (ou de le copier-coller) dans toutes les recettes pertinentes, | ||
+ | |||
+ | |||
+ | **Ideally, every item in the Glossary would be matched to a pop-up item. If the user of the book hovers over an unknown term a box would pop up giving the information in the glossary. If I add the pdfcomment package to the document, this kind of popup or comment or annotation can be made available in the PDF version of the document. I hope it is obvious why popups are not available in printed documents. I hope it is also obvious why popups for the glossary are not necessary in a printed copy of this cookbook. | ||
A simple electronic solution for chapter navigation would be a bookmark system, very common in PDF (and HTML) files – see below for PDF bookmarks. | A simple electronic solution for chapter navigation would be a bookmark system, very common in PDF (and HTML) files – see below for PDF bookmarks. | ||
Ligne 34: | Ligne 70: | ||
To go from one place in a document to another, the clickable link has to be coded and the target for the link also has to be coded. One way to do this is to use label and pageref instructions. The target, the Table of Contents, has to include an appropriate label. | To go from one place in a document to another, the clickable link has to be coded and the target for the link also has to be coded. One way to do this is to use label and pageref instructions. The target, the Table of Contents, has to include an appropriate label. | ||
+ | |||
+ | \label{toc}** | ||
+ | |||
+ | Idéalement, | ||
+ | |||
+ | Une solution électronique simple pour la navigation des chapitres serait un système de signets, très courant dans les fichiers PDF (et HTML) – voir ci-dessous pour les signets PDF. | ||
+ | |||
+ | Liens de retour vers la Table des matières | ||
+ | |||
+ | Pour passer d’un endroit dans un document à un autre, le lien cliquable doit être codé et la cible du lien doit également être codée. Une façon de le faire est d’utiliser l’étiquette et les instructions pageref. La cible, la Table des matières, doit inclure une étiquette appropriée. | ||
\label{toc} | \label{toc} | ||
- | Once the hyperref package is being used, the pageref information automatically becomes a clickable link in the PDF document. | + | |
+ | **Once the hyperref package is being used, the pageref information automatically becomes a clickable link in the PDF document. | ||
\pageref{toc} | \pageref{toc} | ||
Ligne 54: | Ligne 101: | ||
Next issue, I will experiment with modifications of the title page. It needs to look more professional than standard text. After that, I will be ready to finish modifying this little cookbook and move on to another project using Latex. | Next issue, I will experiment with modifications of the title page. It needs to look more professional than standard text. After that, I will be ready to finish modifying this little cookbook and move on to another project using Latex. | ||
+ | ** | ||
+ | |||
+ | Une fois le paquet hyperref utilisé, les informations pageref deviennent automatiquement un lien cliquable dans le document PDF. | ||
+ | |||
+ | \pageref{toc} | ||
+ | |||
+ | Les noms d’étiquettes doivent être uniques dans un document (ou un ensemble de documents qui est ce que nous avons construit). J’ai choisi « toc » (pour Table of Contents)parce qu’il est facile de s’en souvenir et qu’il identifie évidemment la Table des matières. Toutefois, toute combinaison alphanumérique est acceptable. La phrase que j’ai utilisée est la suivante: | ||
+ | |||
+ | Retour vers la table des matières \pageref{toc} //AE : ceci n'est pas un titre// | ||
+ | |||
+ | Je pense que c’est assez clair pour que n’importe qui puisse comprendre. | ||
+ | |||
+ | De la Table des matières vers les signets //AE : C'est cela le titre// | ||
+ | |||
+ | C’est la partie la plus facile. Il n’y a rien à faire. Utilisez une visionneuse de document PDF ordinaire pour ouvrir le document PDF généré. Les signets ne sont pas visibles dans la vue du document PDF dans TeXstudio. Cependant, une visionneuse PDF régulière vous montrera la Table des matières comme des signets PDF standard. Si vous ne les voyez pas, parcourez les menus de la visionneuse PDF et activez les signets. | ||
+ | |||
+ | La prochaine fois | ||
+ | |||
+ | Dans le prochain numéro, j’expérimenterai des modifications de la page de titre. Elle doit être plus professionnelle que le texte standard. Après cela, je serai prêt à finir mes modifications de ce petit livre de cuisine et passer à un autre projet qui utilise LaTeX. | ||
issue199/latex.1700933990.txt.gz · Dernière modification : 2023/11/25 18:39 de auntiee