Drawing with TikZ
This page needs a recent browser (with SharedArrayBuffer support). Please update Chrome, Edge, Firefox or Safari to the latest version.
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:
\usepackage{tikz}
...
\begin{tikzpicture}
\draw (0,0) -- (2,1);
\end{tikzpicture}
\draw (0,0) -- (2,1);draws a line from one point to another. Every command ends with;.
Shapes and paths
- Chain points with
--to make any shape;cyclereturns to the start:
\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.
Inside the tikzpicture, \draw a triangle: connect the points (0,0), (3,0) and (1.5,2) and close it with cycle. The tikz package is loaded for you.
Click Run to compile and preview the PDF.