issue184:latex
Différences
Ci-dessous, les différences entre deux révisions de la page.
Les deux révisions précédentesRévision précédente | |||
issue184:latex [2022/08/28 18:18] – d52fr | issue184:latex [2022/08/30 15:09] (Version actuelle) – d52fr | ||
---|---|---|---|
Ligne 1: | Ligne 1: | ||
- | **Above is the code Erik used in Part 3 of this series, using Latex to produce documents: | + | **Above is the code Erik used in Part 3 of this series, using LaTeX to produce documents: |
The following are required to make a complete document with an image: | The following are required to make a complete document with an image: | ||
Ligne 13: | Ligne 13: | ||
\usepackage{lipsum} %To add lipsum dummy text | \usepackage{lipsum} %To add lipsum dummy text | ||
- | All three of these packages should be available in any standard installation of Latex. The begin{document} code has to be closed in order to compile without error. Putting all the pieces together yields the code shown top right. | + | All three of these packages should be available in any standard installation of LaTeX. The begin{document} code has to be closed in order to compile without error. Putting all the pieces together yields the code shown top right. |
Some of this code should be self-explanatory. Other parts need some words to make their effects clear. The obvious ones are explained first.** | Some of this code should be self-explanatory. Other parts need some words to make their effects clear. The obvious ones are explained first.** | ||
- | **Image files are imported size-as or to fit the text-width or line-width of the selected location. Height and width arguments in the includegraphics instruction should be obvious. | + | Ci-dessus se trouve le code qu' |
+ | |||
+ | Les éléments suivants sont nécessaires pour créer un document complet avec une image : | ||
+ | |||
+ | \documentclass[letterpaper]{book} | ||
+ | |||
+ | \usepackage{graphicx} | ||
+ | |||
+ | Ces deux paquets sont également utiles : | ||
+ | |||
+ | \usepackage{subcaption} % Crée des légendes personnalisées pour les images, les tableaux, etc. | ||
+ | |||
+ | \usepackage{lipsum} % Ajoute du texte factice lipsum | ||
+ | |||
+ | Ces trois paquets devraient être disponibles dans toute installation standard de LaTeX. Le code begin{document} doit être fermé afin de compiler sans erreur. En assemblant tous les éléments, on obtient le code illustré en haut à droite. | ||
+ | |||
+ | Une partie de ce code devrait être explicite. D' | ||
+ | |||
+ | **Image files are imported size-as or to fit the text-width or line-width of the selected location. Height and width arguments in the includegraphics instruction should be obvious. | ||
The centering instruction should also be obvious. Any element inside the figure environment will be centred between the left and right margins. The caption instruction gives text to the caption. Notice the caption is automatically given the name “Fig.”, and the next number in the sequence of figures. Fig is short for figure, the number (visible in the pdf output) will change if other figures come before this one. | The centering instruction should also be obvious. Any element inside the figure environment will be centred between the left and right margins. The caption instruction gives text to the caption. Notice the caption is automatically given the name “Fig.”, and the next number in the sequence of figures. Fig is short for figure, the number (visible in the pdf output) will change if other figures come before this one. | ||
There is a label instruction in the code which is not required. Labels are very useful for providing cross references. They can be used to generate hot links in the pdf file, very useful for both author and reader. | There is a label instruction in the code which is not required. Labels are very useful for providing cross references. They can be used to generate hot links in the pdf file, very useful for both author and reader. | ||
- | The instruction includegraphics[height=3cm, | + | The instruction includegraphics[height=3cm, |
\includegraphics{sample-image.pdf}** | \includegraphics{sample-image.pdf}** | ||
- | **Latex also assumes image files are stored in the same folder / directory as the tex document. It is possible to store graphics files in another directory. The location of the graphics file must be indicated in the includegraphics instruction. Either absolute or relative paths may be used. For example: | + | Les fichiers d' |
+ | |||
+ | L' | ||
+ | |||
+ | Le code contient une instruction d' | ||
+ | |||
+ | L' | ||
+ | |||
+ | \includegraphics{sample-image.pdf} | ||
+ | |||
+ | |||
+ | **LaTeX also assumes image files are stored in the same folder / directory as the tex document. It is possible to store graphics files in another directory. The location of the graphics file must be indicated in the includegraphics instruction. Either absolute or relative paths may be used. For example: | ||
\includegraphics{./ | \includegraphics{./ | ||
Ligne 39: | Ligne 69: | ||
Location on the page is obviously important to the page design. The image environment floats images to the best location. If there is not room for the image on the selected page then it is moved to the next page, generating a new page if necessary. This action can be controlled through options in the beginfigure instruction. In it, you will see [h] which indicates the graphic image should be inserted “here”, at the location where the instruction is typed. Options are h=here, t=top of this page, b=bottom of this page, p=a separate page dedicated to floated elements, a different page in other words. If " | Location on the page is obviously important to the page design. The image environment floats images to the best location. If there is not room for the image on the selected page then it is moved to the next page, generating a new page if necessary. This action can be controlled through options in the beginfigure instruction. In it, you will see [h] which indicates the graphic image should be inserted “here”, at the location where the instruction is typed. Options are h=here, t=top of this page, b=bottom of this page, p=a separate page dedicated to floated elements, a different page in other words. If " | ||
+ | |||
+ | LaTeX suppose également que les fichiers graphiques sont stockés dans le même dossier/ | ||
+ | |||
+ | \includegraphics{./ | ||
+ | |||
+ | Les fichiers image peuvent également être mis à l' | ||
+ | |||
+ | \includegraphics[scale=.5]{sample-image.png} % met la largeur et la hauteur à l' | ||
+ | |||
+ | Les images peuvent être pivotées : | ||
+ | |||
+ | \includegraphics[angle=10]{sample-image.png} % fait pivoter l' | ||
+ | |||
+ | L' | ||
+ | |||
**I leave it to you to experiment with the position of text in relation to the position of the code for the image. Note: using lipsum to generate imitation text does not allow for inserting the image between paragraphs. | **I leave it to you to experiment with the position of text in relation to the position of the code for the image. Note: using lipsum to generate imitation text does not allow for inserting the image between paragraphs. | ||
- | One way to control the position of an image is to resize it so it fits where you want it. Setting both height and width options to fixed values can distort images because it can change the aspect-ratio. Images can look squashed or stretched if both height and width are fixed values. (See image bottom left in which both height and width are fixed.) If only one of height and width is fixed, | + | One way to control the position of an image is to resize it so it fits where you want it. Setting both height and width options to fixed values can distort images because it can change the aspect-ratio. Images can look squashed or stretched if both height and width are fixed values. (See image bottom left in which both height and width are fixed.) If only one of height and width is fixed, |
A similar way to resize an image is to use the [scale] instruction which alters both height and width by the same multiplier. This keeps the aspect ratio the same as the original. If [scale=1] the image is displayed in its original size, if [scale> | A similar way to resize an image is to use the [scale] instruction which alters both height and width by the same multiplier. This keeps the aspect ratio the same as the original. If [scale=1] the image is displayed in its original size, if [scale> | ||
- | I hope this article has given you a few ideas about working with images in Tex / Latex. Next time, I will discuss setting up columns, a necessary skill for many online and printed publications.** | + | I hope this article has given you a few ideas about working with images in Tex / LaTeX. Next time, I will discuss setting up columns, a necessary skill for many online and printed publications.** |
+ | |||
+ | Je vous laisse le soin d' | ||
+ | |||
+ | Une façon de contrôler la position d'une image est de la redimensionner pour qu' | ||
+ | |||
+ | Une manière similaire de redimensionner une image est d' | ||
+ | |||
+ | J' | ||
issue184/latex.1661703515.txt.gz · Dernière modification : 2022/08/28 18:18 de d52fr