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 [2018/06/03 13:16] – joseph.wright | 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? ====== |
| - | title: Drawing with TeX | + | |
| - | category: graphics | + | |
| - | permalink: / | + | |
| - | --- | + | |
| - | There are many packages to do pictures in (La)TeX | + | Il existe de nombreux logiciels permettant de faire des dessins directement dans (La)TeX (plutôt que d' |
| - | importing graphics created externally), ranging from simple | + | |
| - | LaTeX `picture` environment, | + | |
| - | `eepic`, to | + | |
| - | sophisticated (but slow) drawing with PicTeX. Depending on your type | + | |
| - | of drawing, and setup, here are a few systems you may consider: | + | |
| - | | + | |
| - | - The `picture` environment provides rather primitive | + | ===== Avec les commandes de base ===== |
| - | drawing capabilities (anything requiring more than linear | + | |
| - | calculations is excluded, unless a font can come to your help). | + | |
| - | environment' | + | |
| - | basic measurement in a diagram, may be avoided by use of the | + | |
| - | [`picture`](https:// | + | |
| - | as a number or as a length, and acts accordingly. | + | |
| - | - [`epic`](https:// | + | |
| - | `picture` environment somewhat less agonising; | + | |
| - | [`eepic`](https:// | + | |
| - | `\special` commands to improve printing performance. | + | |
| - | `\special`s aren't available, the [`eepicemu`](https:// | + | |
| - | business, far less efficiently. | + | |
| - | - [`pict2e`](https:// | + | |
| - | [the LaTeX manual](FAQ-latex-books), | + | |
| - | ten years after publication of the book! It removes all the petty | + | |
| - | restrictions that surround the use of the `picture` | + | |
| - | environment. | + | |
| - | eccentric drawing language of the environment, | + | |
| - | useful tool than the original environment has ever been. (Note that | + | |
| - | [`pict2e`](https:// | + | |
| - | [`pspicture`](https:// | + | |
| - | - PicTeX is a venerable, and very powerful, system, that draws | + | |
| - | 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 [documentation](FAQ-docpictex). | + | |
| - | - [`PSTricks`](https:// | + | |
| - | PostScript via a set of TeX macros, which talk to PostScript using | + | |
| - | [`\special` commands](FAQ-specials). | + | |
| - | pretty powerful programming language, many astounding things can in | + | |
| - | principle be achieved using [`PSTricks`](https:// | + | |
| - | contributed packages, ranging from world mapping to lens design | + | |
| - | diagrams, is available). | + | |
| - | [`Pstricks`](https:// | + | |
| - | by default specific to `dvips`, but there is | + | |
| - | a [`Pstricks`](https:// | + | |
| - | operate under XeTeX. | + | |
| - | which (like [`epstopdf`](https:// | + | |
| - | [pdfLaTeX graphics](FAQ-pdftexgraphics)) generates | + | |
| - | PDF files using an auxiliary program, from [`PSTricks`](https:// | + | |
| - | commands ([`pst-pdf`](https:// | + | |
| - | the [`preview`](https:// | + | |
| - | | + | |
| - | There is a [`PSTricks`](https:// | + | L' |
| - | (<a href=" | + | à moins qu'une police de caractères ne puisse vous venir en aide. Cet environnement dispose de sa propre définition de la commande '' |
| - | [join](https:// | + | comme unité de mesure de base. Cette fonctionnalité pouvant être gênante, l'extension |
| - | just browse the | + | si une longueur est citée sous forme de nombre ou de longueur et agit en conséquence. |
| - | [list archives](https:// | + | |
| - | - [`pgf`](https:// | + | |
| - | convenient from " | + | |
| - | pretty tiresome: if you | + | |
| - | 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 [`PSTricks`](https:// | + | |
| - | use of the computation engine within PostScript. | + | |
| - | The [`pgf`](https:// | + | |
| - | allows the user to get a feel for the capabilities of the system, is | + | |
| - | available at < | + | |
| - | - MetaPost; you liked MetaFont, but never got to grips with font files? | + | |
| - | Try [MetaPost](FAQ-MP)& | + | |
| - | all the power of MetaFont, but it generates PostScript figures; MetaPost | + | |
| - | is nowadays part of most serious (La)TeX distributions. | + | |
| - | uses it for all his work& | + | |
| - | | + | |
| - | Note that you can | + | Voici un exemple d'utilisation |
| - | [" | + | |
| - | keep it in-line with your LaTeX code). | + | |
| - | - You liked MetaFont (or MetaPost), but find the language difficult? | + | |
| - | `Mfpic` makes up MetaFont or MetaPost code for you using | + | |
| - | familiar-looking (La)TeX macros. | + | |
| - | of MetaFont or MetaPost, but a friendlier interface, and with MetaPost output | + | |
| - | the results can be used equally well in either LaTeX or pdfLaTeX. | + | |
| - | - You liked PicTeX but don't have enough memory or time? Look | + | |
| - | at the late Eitan Gurari' | + | |
| - | 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", | + | |
| - | which remains available from on-line booksellers. | + | |
| - | In addition, there are several means of generating | + | <WRAP column 45ex> |
| - | graphics application | + | <code latex> |
| - | MetaPost, at least) in-line in your document, and then have them | + | \setlength\unitlength{1mm} |
| - | processed in a command spawned from your (La)TeX run. For details, | + | \begin{picture}(32,40)(-2,-2) |
| - | see [question](FAQ-inlgrphapp). | + | \put(0,0){\circle{1}} |
| + | \put(25, | ||
| + | \put(12,26){\circle*{15}} | ||
| + | \qbezier(5,5)(30, | ||
| + | \end{picture} | ||
| + | </ | ||
| + | </ | ||
| + | <WRAP column 30ex> | ||
| + | < | ||
| + | \documentclass{article} | ||
| + | \pagestyle{empty} | ||
| + | \begin{document} | ||
| + | \setlength\unitlength{1mm} | ||
| + | \begin{picture}(32, | ||
| + | \put(0, | ||
| + | \put(25, | ||
| + | \put(12, | ||
| + | \qbezier(5, | ||
| + | \end{picture} | ||
| + | \end{document} | ||
| + | </ | ||
| + | </ | ||
| + | <WRAP clear /> | ||
| + | ===== Avec les extensions “epic”, “eepic” et '' | ||
| + | |||
| + | L' | ||
| + | |||
| + | ===== Avec l' | ||
| + | |||
| + | L' | ||
| + | |||
| + | Voici des courbes de Bézier (quadratique et cubique) avec [[ctanpkg> | ||
| + | |||
| + | <code latex> | ||
| + | \documentclass{article} | ||
| + | \usepackage{ifpdf} | ||
| + | \ifpdf | ||
| + | \usepackage[pdftex]{pict2e} | ||
| + | \else | ||
| + | \usepackage[dvips]{pict2e} | ||
| + | \fi | ||
| + | \usepackage{color} | ||
| + | |||
| + | \newcommand*\FPOINT{ | ||
| + | \begingroup | ||
| + | \setlength\unitlength{.8pt} | ||
| + | \circle*{5} | ||
| + | \endgroup | ||
| + | } | ||
| + | |||
| + | \newcommand*\OPOINT{ | ||
| + | \begingroup | ||
| + | \setlength\unitlength{.8pt} | ||
| + | \circle{5} | ||
| + | \endgroup | ||
| + | } | ||
| + | |||
| + | \begin{document} | ||
| + | \setlength\unitlength{.007\linewidth} | ||
| + | |||
| + | \begin{picture}(100, | ||
| + | \put(-50, | ||
| + | \color{green} | ||
| + | \qbezier[0](-40, | ||
| + | \qbezier[0](0, | ||
| + | \put(-40, | ||
| + | \put(0, | ||
| + | \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> | ||
| + | |||
| + | {{htmlmetatags> | ||
| + | metatag-og: | ||
| + | metatag-og: | ||
| + | }} | ||

