Différences
Ci-dessous, les différences entre deux révisions de la page.
Les deux révisions précédentesRévision précédenteProchaine révision | Révision précédente | ||
composition:illustrations:dessiner_avec_tex [2020/11/25 20:52] – Traduction en français du titre et de l'introduction. jejust | 3_composition:illustrations:dessiner_avec_tex [2022/10/04 12:52] (Version actuelle) – [Avec l'extension “TikZ”] Ajout de lien vers TeX4ht dbitouze | ||
---|---|---|---|
Ligne 1: | Ligne 1: | ||
====== Comment dessiner avec TeX? ====== | ====== Comment dessiner avec TeX? ====== | ||
+ | Il existe de nombreux logiciels permettant de faire des dessins directement dans (La)TeX (plutôt que d' | ||
- | There are many packages to do pictures in (La)TeX itself (rather than | + | ===== Avec les commandes de base ===== |
- | importing graphics created externally), | + | |
- | LaTeX '' | + | |
- | '' | + | |
- | sophisticated (but slow) drawing with PicTeX. Depending on your type | + | |
- | of drawing, and setup, here are a few systems you may consider: | + | |
- | Il existe de nombreux logiciels permettant de faire des dessins directement | + | L' |
- | dans (La)TeX (plutôt que d' | + | à moins qu'une police de caractères ne puisse vous venir en aide. Cet environnement dispose de sa propre définition de la commande |
- | allant de la simple utilisation de l' | + | comme unité de mesure de base. Cette fonctionnalité pouvant être gênante, l' |
- | avec ses versions améliorées comme '' | + | si une longueur est citée sous forme de nombre ou de longueur |
- | avec [[ctanpkg> | + | |
- | voici quelques systèmes à envisager : | + | |
+ | Voici un exemple d' | ||
- | $\Reponse$ | + | <WRAP column 45ex> |
- | drawing capabilities | + | <code latex> |
- | calculations is excluded, unless a font can come to your help). The | + | \setlength\unitlength{1mm} |
- | environment' | + | \begin{picture}(32,40)(-2,-2) |
- | basic measurement in a diagram, may be avoided by use of the | + | \put(0,0){\circle{1}} |
- | [[ctanpkg> | + | \put(25,0){\line(-1, |
- | as a number or as a length, and acts accordingly. | + | \put(12,26){\circle*{15}} |
- | + | \qbezier(5,5)(30, | |
- | $\Reponse$ | + | \end{picture} |
- | '' | + | </code> |
- | [[ctanpkg>eepic]] extends it, and is capable of using '' | + | </ |
- | '' | + | <WRAP column 30ex> |
- | '' | + | < |
- | business, far less efficiently. | + | \documentclass{article} |
+ | | ||
- | $\Reponse$ | + | \begin{document} |
- | [[FAQ-latex-books|the LaTeX manual]], but didn't appear for nearly | + | \setlength\unitlength{1mm} |
- | ten years after publication of the book! It removes all the petty | + | \begin{picture}(32, |
- | restrictions that surround the use of the '' | + | \put(0,0){\circle{1}} |
- | environment. | + | \put(25, |
- | eccentric drawing language of the environment, and is a far more | + | \put(12,26){\circle*{15}} |
- | useful tool than the original environment has ever been. | + | \qbezier(5, |
- | [[ctanpkg>pict2e]] supersedes David Carlisle' | + | \end{picture} |
- | [[ctanpkg>pspicture|pspicture]].) | + | \end{document} |
+ | </ | ||
+ | </ | ||
+ | <WRAP clear /> | ||
- | $\Reponse$ | + | ===== Avec les extensions “epic”, “eepic” et '' |
- | by placing dots on the page to give the effect of a line or curve. | + | |
- | this has the potential of great power, it is (of course) much slower | + | |
- | than any of the other established packages. | + | |
- | are problems with its [[FAQ-docpictex|documentation]]. | + | |
- | $\Reponse$ | + | L' |
- | PostScript via a set of TeX macros, which talk to PostScript using | + | |
- | [[FAQ-specials|'' | + | |
- | pretty powerful programming language, many astounding things can in | + | |
- | principle be achieved using [[ctanpkg> | + | |
- | contributed packages, ranging from world mapping to lens design | + | |
- | diagrams, is available). | + | |
- | [[ctanpkg> | + | |
- | by default specific to '' | + | |
- | a [[ctanpkg> | + | |
- | operate under XeTeX. | + | |
- | which (like [[ctanpkg> | + | |
- | [[FAQ-pdftexgraphics|pdfLaTeX graphics]]) generates | + | |
- | PDF files using an auxiliary program, from [[ctanpkg> | + | |
- | commands ([[ctanpkg> | + | |
- | the [[ctanpkg> | + | |
+ | ===== Avec l' | ||
- | There is a [[pstricks@tug.org|PSTricks mailing list]] | + | L' |
- | which you may [[https:// | + | |
- | just browse the [[https://tug.org/pipermail/pstricks/|list archives]]. | + | |
- | $\Reponse$ | + | Voici des courbes de Bézier |
- | convenient from " | + | |
- | simply want the graphical capabilities, | + | |
- | its " | + | |
- | bet for you. While PDF has (in essence) the same graphical | + | |
- | capabilities as PostScript, it isn't programmable; | + | |
- | LaTeX commands that will utilise the graphical capabilities of | + | |
- | both PostScript and PDF equally. | + | |
- | mathematical support, which allows it to rival [[ctanpkg> | + | |
- | use of the computation engine within PostScript. | + | |
- | The [[texdoc> | + | |
- | allows the user to get a feel for the capabilities of the system, is | + | |
- | available at [[http:// | + | |
- | $\Reponse$ | + | <code latex> |
- | Try [[FAQ-MP|MetaPost]] --- | + | \documentclass{article} |
- | all the power of MetaFont, but it generates PostScript figures; MetaPost | + | \usepackage{ifpdf} |
- | is nowadays part of most serious (La)TeX distributions. | + | |
- | uses it for all his work... | + | \usepackage[pdftex]{pict2e} |
- | + | | |
- | Note that you can [[FAQ-inlgrphapp|" | + | |
- | (i.e., keep it in-line with your LaTeX code). | + | \fi |
+ | \usepackage{color} | ||
- | $\Reponse$ | + | \newcommand*\FPOINT{ |
- | '' | + | \begingroup |
- | familiar-looking (La)TeX macros. Not //quite// the full power | + | |
- | of MetaFont or MetaPost, but a friendlier interface, and with MetaPost output | + | |
- | the results can be used equally well in either LaTeX or pdfLaTeX. | + | |
+ | } | ||
- | $\Reponse$ | + | \newcommand*\OPOINT{ |
- | at the late Eitan Gurari' | + | \begingroup |
- | but is an entirely new implementation which is not as hard on | + | |
- | memory, is much more readable, as well as in the author' | + | |
- | "TeX and LaTeX: Drawing and Literate Programming", | + | |
- | from on-line booksellers. | + | } |
- | ----- | + | \begin{document} |
+ | \setlength\unitlength{.007\linewidth} | ||
- | In addition, there are several means of generating code for your | + | \begin{picture}(100,120)(-50, |
- | graphics application | + | \put(-50,-60){\framebox(100, |
- | MetaPost, at least) in-line in your document, and then have them | + | |
- | processed in a command spawned from your (La)TeX run. For details, | + | \qbezier[0](-40,-30)(-30,10)(0,10) |
- | see [[FAQ-inlgrphapp|question]]. | + | |
+ | \put(-40,-30){\FPOINT}\put(-30, | ||
+ | | ||
+ | \put(30, | ||
+ | \color{black} | ||
+ | \cbezier[0](-40, | ||
+ | \put(-40, | ||
+ | \put(20, | ||
+ | \end{picture} | ||
+ | \end{document} | ||
+ | </ | ||
+ | ===== Avec l' | ||
- | ----- | + | L' |
+ | Vous avez aimé PicTeX mais il a été trop gourmand en mémoire ou en temps ? Testez l' | ||
+ | |||
+ | |||
+ | ===== Avec l' | ||
+ | |||
+ | L' | ||
+ | |||
+ | En voici un exemple : | ||
+ | |||
+ | <code latex> | ||
+ | \documentclass{report} | ||
+ | \usepackage{xy} | ||
+ | |||
+ | \begin{document} | ||
+ | \begin{xy} | ||
+ | (0,0)*+{A}; (20, | ||
+ | (0,20)*+{C} **\dir2{~} | ||
+ | \end{xy} | ||
+ | \end{document} | ||
+ | </ | ||
+ | |||
+ | ===== Avec l' | ||
+ | |||
+ | [[ctanpkg> | ||
+ | |||
+ | Les commandes '' | ||
+ | |||
+ | Il existe une liste de diffusion en anglais traitant de [[ctanpkg> | ||
+ | |||
+ | Voici un exemple de dessin réalisé avec [[ctanpkg> | ||
+ | |||
+ | <code latex> | ||
+ | \documentclass{report} | ||
+ | \usepackage{pstricks} | ||
+ | |||
+ | \begin{document} | ||
+ | \psset{unit=3pt} | ||
+ | \begin{pspicture}(-10, | ||
+ | \psline[linewidth=1, | ||
+ | {*-> | ||
+ | \psline[linewidth=1pt, | ||
+ | (-10, | ||
+ | \pspolygon(30, | ||
+ | \pscircle*[linewidth=5pt, | ||
+ | \pswedge*[linecolor=blue](40, | ||
+ | \psarc*[linecolor=green](40, | ||
+ | \psbezier{*-*}(0, | ||
+ | \psellipse(40, | ||
+ | \end{pspicture} | ||
+ | \end{document} | ||
+ | </ | ||
+ | |||
+ | |||
+ | ===== Avec l' | ||
+ | |||
+ | Alors que l' | ||
+ | son utilisation avec '' | ||
+ | à étudier pour faire des dessins. Il est conçu avec des // | ||
+ | qui lui donnent une grande souplesse. L' | ||
+ | Mais il est possible d' | ||
+ | Grâce aux interfaces dorsales, il fonctionne avec < | ||
+ | avec [[ctanpkg> | ||
+ | ce qui lui permet de rivaliser avec l' | ||
+ | |||
+ | L' | ||
+ | |||
+ | <WRAP column 45ex> | ||
+ | <code latex> | ||
+ | \documentclass{article} | ||
+ | \usepackage{tikz} | ||
+ | \usetikzlibrary{snakes} | ||
+ | \usetikzlibrary{trees} | ||
+ | |||
+ | \begin{document} | ||
+ | \tikzstyle{level 1}=[% | ||
+ | sibling angle=120] | ||
+ | \tikzstyle{level 2}=[% | ||
+ | sibling angle=60] | ||
+ | \tikzstyle{level 3}=[% | ||
+ | sibling angle=30] | ||
+ | \tikzstyle{every node}=[fill] | ||
+ | \tikzstyle{edge from parent}=[% | ||
+ | snake=expanding waves,% | ||
+ | segment length=1mm, | ||
+ | segment angle=10, | ||
+ | |||
+ | \tikz [grow cyclic, | ||
+ | very thick, | ||
+ | level distance=13mm, | ||
+ | \node {} child [color=\A] | ||
+ | foreach \A in {red, | ||
+ | { node {} child [color=\A!50!\B] | ||
+ | foreach \B in {red, | ||
+ | { node {} child [% | ||
+ | | ||
+ | | ||
+ | | ||
+ | { node {} } | ||
+ | } | ||
+ | }; | ||
+ | \end{document} | ||
+ | </ | ||
+ | </ | ||
+ | |||
+ | <WRAP column 45ex> | ||
+ | < | ||
+ | \documentclass{article} | ||
+ | \usepackage{tikz} | ||
+ | \usetikzlibrary{snakes} | ||
+ | \usetikzlibrary{trees} | ||
+ | \pagestyle{empty} | ||
+ | \begin{document} | ||
+ | \tikzstyle{level 1}=[sibling angle=120] | ||
+ | \tikzstyle{level 2}=[sibling angle=60] | ||
+ | \tikzstyle{level 3}=[sibling angle=30] | ||
+ | \tikzstyle{every node}=[fill] | ||
+ | \tikzstyle{edge from parent}=[snake=expanding waves, | ||
+ | | ||
+ | |||
+ | \tikz [grow cyclic, | ||
+ | level distance=13mm, | ||
+ | \node {} child [color=\A] | ||
+ | foreach \A in {red, | ||
+ | { node {} child [color=\A!50!\B] | ||
+ | foreach \B in {red, | ||
+ | { node {} child [color=\A!50!\B!50!\C] | ||
+ | | ||
+ | { node {} } | ||
+ | } | ||
+ | }; | ||
+ | \end{document} | ||
+ | </ | ||
+ | </ | ||
+ | <WRAP clear /> | ||
+ | |||
+ | Si le [[texdoc> | ||
+ | * le // | ||
+ | * // | ||
+ | * // | ||
+ | |||
+ | ===== Avec Metapost ===== | ||
+ | |||
+ | À la différence des solutions précédentes, | ||
+ | mais un programme et un langage développé par John B. Hobby. Il met à votre disposition toute la puissance de '' | ||
+ | pour générer des graphiques '' | ||
+ | comme évoqué dans la question «[[3_composition/ | ||
+ | |||
+ | De nombreuses documentations et exemples sont disponibles sur Internet : | ||
+ | * la [[https:// | ||
+ | * la [[http:// | ||
+ | * le [[http:// | ||
+ | * le [[http:// | ||
+ | |||
+ | ===== Avec l' | ||
+ | |||
+ | L' | ||
+ | du code < | ||
+ | est produit. Après avoir compilé le fichier obtenu avec Metafont ('' | ||
+ | |||
+ | <code latex> | ||
+ | \documentclass{article} | ||
+ | \usepackage{mfpic} | ||
+ | \begin{document} | ||
+ | \opengraphsfile{pics} | ||
+ | \begin{mfpic}[20]{-3}{3}{-3}{3} | ||
+ | \axes | ||
+ | \function{-2, | ||
+ | \tcaption{\raggedright{\it Fig. :} | ||
+ | Fonction dans un repère orthonormal.} | ||
+ | \end{mfpic} | ||
+ | \closegraphsfile | ||
+ | \end{document} | ||
+ | </ | ||
+ | |||
+ | [[ctanpkg> | ||
+ | |||
+ | ===== Avec du code d' | ||
+ | |||
+ | Il existe plusieurs moyens de générer du code pour votre application graphique ('' | ||
+ | avec du code placé dans votre document < | ||
+ | «[[3_composition: | ||
+ | |||
+ | ----- | ||
//Source:// [[faquk> | //Source:// [[faquk> | ||
{{htmlmetatags> | {{htmlmetatags> | ||
- | metatag-og: | + | metatag-og: |
metatag-og: | metatag-og: | ||
}} | }} | ||
- |