Drawing with TikZ · Dessin avec TikZ
Drawing inside LaTeX
- You can draw diagrams with code using the TikZ package — no image files needed.
- Load it once, then draw inside a
tikzpicture:
\draw (0,0) -- (2,1);draws a line from one point to another. Every command ends with;.
Dessiner dans LaTeX
- Vous pouvez dessiner des diagrammes avec du code en utilisant le package TikZ — pas besoin de fichiers images.
- Chargez-le une fois, puis dessinez à l'intérieur d'un
tikzpicture:
\usepackage{tikz}
...
\begin{tikzpicture}
\draw (0,0) -- (2,1);
\end{tikzpicture}
\draw (0,0) -- (2,1);trace une ligne d'un point à un autre. Chaque commande se termine par;.
Shapes and paths
- Chain points with
--to make any shape;cyclereturns to the start:
Formes et chemins
- Enchaînez des points avec
--pour créer n'importe quelle forme ;cycleretourne au début :
\draw (0,0) -- (2,0) -- (1,1.5) -- cycle; % a triangle
\draw (0,0) circle (1); % a circle, radius 1
\draw (0,0) rectangle (3,2); % a box
Why code a drawing?
- It stays sharp at any size (it is vector graphics, not a photo).
- It is exact — perfect for geometry, graphs, and circuit diagrams.
- Now draw your own triangle in the task.
Pourquoi coder un dessin ?
- Il reste net à toutes les tailles (c'est de la vectorielle, pas une photo).
- C'est précis — parfait pour la géométrie, les graphes et les schémas de circuits.
- Maintenant, dessinez votre propre triangle dans l'exercice.
Common mistakes
- Every
\drawcommand ends with a semicolon;. - Wrap the drawing in a
tikzpictureenvironment.
Erreurs courantes
- Chaque commande
\drawse termine par un point-virgule;. - Encadrez le dessin dans un environnement
tikzpicture.
Inside the tikzpicture, \draw a triangle: connect the points (0,0), (3,0) and · et (1.5,2) and close it with cycle. The tikz package is loaded for you. · À l'intérieur de tikzpicture, \draw un triangle : connectez les points (0,0), (3,0) et (1.5,2) et fermez-le avec cycle. Le package tikz est chargé pour vous.
Draw two shapes this time. Add a circle · cercle of radius 1 with \draw (0,0) circle (1); and a rectangle with \draw (2,-1) rectangle (4,1);. · Dessinez deux formes cette fois. Ajoutez un cercle de rayon 1 avec \draw (0,0) circle (1); et un rectangle avec \draw (2,-1) rectangle (4,1);.