LaTeX: Drawing with TikZ

This page was translated from German with AI. It has not been checked by a native speaker. Original page in German

In the extra part you draw the experimental set-up directly in the source text, with the package TikZ. The drawing stays sharp at any size and uses the same font as text and formulas.

The video

In the video you see TeXstudio under Linux. The orange frame always shows the spot in question. Under Windows and macOS TeXstudio looks exactly the same. The practice file above is the state at the start of the video – so you can follow along with each part separately.

Subtitles are available in ten languages. Choose them at the bottom right of the video.

Contents of the video

  1. 0:00 What it is about
  2. 0:25 Preparation
  3. 0:36 Coordinates
  4. 1:12 Pendulum
  5. 1:40 Angle and length
  6. 2:03 Labels
  7. 2:17 Result
  8. 2:28 Summary

The most important points

The most important commands

\usepackage{tikz}, drawing in \begin{tikzpicture} … \end{tikzpicture} · \draw (0,0) -- (3,6); connects points (values in cm: first to the right, then up) · ++(-70:4.7) goes from a point in the direction −70° by 4.7 cm, coordinate (K) gives the end a name · circle, arc, [dashed], [<->] · \node at (…) {Text}; labels.

A helper grid makes the coordinates visible: \draw[help lines] (-1,0) grid (7,7);. At the end you delete it again.
A helper grid makes the coordinates visible: \draw[help lines] (-1,0) grid (7,7);. At the end you delete it again.

String and ball use the same point K: that way the ball always hangs exactly at the end of the string, even if you change the angle. Formula symbols in labels stand as usual between dollar signs, e.g. $\varphi$ and $l$.

The finished code of the drawing in the editor.
The finished code of the drawing in the editor.
The experimental set-up as a TikZ drawing; caption, number and reference remain.
The experimental set-up as a TikZ drawing; caption, number and reference remain.

The worksheet

Here you can see the worksheet for the video (in German). You download the practice files above and work in your own editor. The hints are printed upside down – turn the sheet only when you cannot get on by yourself. You can also open it as a PDF.

📄 Open worksheet (PDF, German)

The worksheet – Page 1
Page 1/3
The worksheet – Page 2
Page 2/3
Show the worksheet solutions
The worksheet – Page 3
Page 3/3

Try it yourself

Task

The ball is to be deflected more, with 30° instead of 20°. Which number in the string command \draw (3,6) -- ++(-70:4.7) coordinate (K); do you change, and to what value?

Show solution

The angle: −70° is the direction, measured from the x-axis. Straight down would be −90°, 20° deflection gives −70°. For 30° that is ++(-60:4.7). The ball moves along because it hangs at K; you adjust the angle arc as well (end angle=-60).

Keep learning with a language model

In my Facharbeit I want to draw a simple sketch with TikZ: [describe the sketch in words]. Help me step by step: first ask me about the important points and their coordinates, and let me write the draw and node commands myself. Use only plain TikZ, no pgfplots.

How this was made: The idea and the choice of topics are mine. A language model (LLM) drafted the script, the sample paper, the tasks and this page following my instructions. The screen recordings were made automatically by a script in TeXstudio under Linux, which checked the finished PDF after every step: are margins, font, numbers and references right, are there warnings? The voice was generated with Qwen3-TTS, modelled on my own voice.

The sample paper about the thread pendulum is invented, and so are the person “Alex Beispiel” and the two sources in the bibliography.

The videos, worksheets, practice files, texts and prompts in this series are licensed under CC BY 4.0: you may use, change and share them if you name the source.