Drawing with TikZ · Dibujar con 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;.
Dibujar dentro de LaTeX
- Puedes crear diagramas con código utilizando el paquete TikZ — no se necesitan archivos de imagen.
- Cárgalo una sola vez, luego dibuja dentro de un entorno
tikzpicture:
\usepackage{tikz}
...
\begin{tikzpicture}
\draw (0,0) -- (2,1);
\end{tikzpicture}
\draw (0,0) -- (2,1);traza una línea desde un punto hasta otro. Cada comando termina con;.
Shapes and paths
- Chain points with
--to make any shape;cyclereturns to the start:
Formas y trayectorias
- Encadena puntos con
--para crear cualquier figura;cycleregresa al inicio:
\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.
¿Por qué codificar un dibujo?
- Permanece nítido a cualquier tamaño (es gráficos vectoriales, no una fotografía).
- Es exacto — ideal para geometría, gráficos y diagramas de circuitos.
- Ahora dibuja tu propio triángulo en la tarea.
Common mistakes
- Every
\drawcommand ends with a semicolon;. - Wrap the drawing in a
tikzpictureenvironment.
Errores comunes
- Cada comando
\drawtermina con un punto y coma;. - Envuelve el dibujo en un entorno
tikzpicture.
Inside the tikzpicture, \draw a triangle: connect the points (0,0), (3,0) and · y (1.5,2) and close it with cycle. The tikz package is loaded for you. · Dentro del tikzpicture, usa \draw para dibujar un triángulo: conecta los puntos (0,0), (3,0) y (1.5,2) y ciérralo con cycle. El paquete tikz ya está cargado.
Draw two shapes this time. Add a circle · círculo of radius 1 with \draw (0,0) circle (1); and a rectangle with \draw (2,-1) rectangle (4,1);. · Dibuja dos figuras esta vez. Añade un círculo de radio 1 con \draw (0,0) circle (1); y un rectángulo con \draw (2,-1) rectangle (4,1);.