Professional Documents
Culture Documents
Dessin
On pourrait rdiger plus dun livre sur le dessin avec LATEX. Dans ce
chapitre, on va rapidement passer sur les deux packages prdominants
que sont PSTricks et TikZ/PGF. On verra galement dirents packages
permettant de faire des dessins plus cibls comme des arbres gramma-
ticaux pour les linguistes, des molcules pour les chimistes, des circuits
pour les lectriciens . . .
11.1 Arbres
Il faut bien veiller ce que chaque crochet soit prcd dune espace.
Racine
Petit-fils
153
154 CHAPITRE 11. DESSIN
Enfin, on peut obtenir tout un sous-arbre sous forme dun triangle avec
la commande \qroof. On peut galement encadrer un sous-arbre avec
la commande \qframesubtree. Remarquez aussi quon nest pas oblig
davoir un texte pour chaque nud interne. Voici un exemple plus labor :
A
B C
Code qtree
\ n e w c o m m a n d {\ q l e a f h o o k }{\ bf }
\ Tree [. A
[. B
\ qroof { un sous - arbre }. D
[E ]
]
[. C
[. F ]
[. G [{ Une phrase } ] ]
] !{\ q f r a m e s u b t r e e }
]
11.2. TIKZ/PGF 155
11.2 TikZ/PGF
nud 1 B
Code tikz,pgf
\ begin { tikzpicture }
\ node [ draw , shape = rectangle ] ( A ) at (0 ,0) { n \ oe ud 1};
\ node [ draw , shape = circle ] ( B ) at (3 ,0) { B };
\ draw ( A ) edge [ dashed , - >] ( B );
\ end { tikzpicture }
a
S1
S0
b
S2
156 CHAPITRE 11. DESSIN
Code tikz,pgf
une fonction
30 des donnes
20
axe y
6 4 2 0 2 4 6
axe x
Code pgfplots
R1
+
vext
+ V1 C1
Code circuitikz
11.3 PSTricks
0
0 1 2
\ p s p i c t u r e (0 ,0)(8 ,5)
\ psframe [ l i n e w i d t h =2 pt , framearc =0.3 , fillstyle = solid ,
fillcolor = red ]( -0.2 , -0.3)(1.3 ,1.2)
\ psline [ l i n e w i d t h =4 pt , linearc =0.1]{ - >}(0 ,0)(1 ,1)(1 ,0)
\ pscircle [ l i n e w i d t h =2 pt ](3 ,1) {0.7}
\ pscircle [ l i n e w i d t h =2 pt , linestyle = dashed ](3.5 ,1.8) {0.7}
\ pscircle [ l i n e w i d t h =2 pt ](4 ,1) {0.7}
\ psbezier [ showpoints = true ]{ o -|}(1 ,2)(2 ,3)(0 ,4)(3 ,4)
\ psgrid [ origin ={6 ,0} , gridcolor = gray ,
subgridcolor = lightgray ](0 ,0)(0 ,0)(2 ,4)
\ psplot [ origin ={6 ,0} , plotpoints =100 ,
l i n e w i d t h =2 pt ]{0}{2}{ x x mul }
\ endpspicture
\ p s p i c t u r e (0 ,0)(8 ,5)
\ rput (1 ,1){\ p s s c a l e b o x {0.5}{\ psAnt }}
\ rput {45}(3 ,3){\ p s s c a l e b o x {0.4}{\ psAnt [ fillcolor = red ]}}
\ rput { -80}(1 ,4){\ p s s c a l e b o x {0.6}{\ psAnt [ fillcolor = black ]}}
\ endpspicture