TikZ Examples

This is awesome!

It is widely known that you can use TeX in Sphinx documentation to create mathematical formulas. However, it is also possible to create excellent vector graphics directly in Sphinx! This means you no longer need to create your vector illustrations in external software, export them to SVG or PNG, include them with the rest of the assets in the documentation system, etc. Let Sphinx do the work for you.

The main advantages are:

  1. Out-of-the-box support for PGF/TikZ via the Sphinx extension sphinxcontrib-tikz.

  2. Need to modify an illustration? No problem, just edit its code directly in the documentation text and rebuild.

  3. Plaintext-based system: easy to control revisions via your favorite VCS.

  4. Integrates easily and flawlessly with Read The Docs.

Based on instructions from sphinxcontrib-tikz extension and a Sphinx primer by Li-Pro.Net.

Inline Examples

Basic example:

Figure made with TikZ

The obligatory ubiquitous example, with caption:

Figure made with TikZ

An Example Directive with Caption

An example inline role:

Examples of TikZ drawings loaded from files

Classical physics: a free-body diagram

Figure made with TikZ

A classical physics problem

Control systems: a basic diagram

Figure made with TikZ

Control system principles (PGF/TikZ example)

Drawing demo by author of the package tikz-3dplot [source]

Figure made with TikZ

Demo of tikz-3dplot

3D Cube 1 (plain TikZ)

Figure made with TikZ

Cube in 3D (without view transform)

3D Cube 2 (drawn using tikz-3dplot)

Figure made with TikZ

Cube in 3D (after view transform)

Spherical Polar coordinate system (drawn using tikz-3dplot)

Figure made with TikZ

Spherical polar coordinate system

Spherical Elevation coordinate system (drawn using tikz-3dplot)

Figure made with TikZ

Spherical elevation coordinate system