2.6. PGF/TikZ LaTeX Pictures¶
Attention
Only practicable and usable for HTML and LaTeX builder.
- PyPI Package
- Documentation
- Git Repository
Sphinx extension, which enables the use of the PGF/TikZ LaTeX package to draw nice pictures.
This extension relies on two software packages being installed on your computer:
latex
with thetikz
and theamsmath
packagesA software package that is able to convert a PDF to an image. Currently, four different ways of doing this conversion are supported, called conversion “suites”. Below is a list for each suite what must be installed on your computer. Only one such suite need to be installed:
pdf2svg suite:
pdf2svg
(preferred, default)Netpbm suite:
pdftoppm
(part of the Poppler PDF library) andpnmtopng
(part of the Netpbm package)ImageMagick suite:
pdftoppm
(part of the Poppler PDF library) andconvert
(part of the ImageMagick package)GhostScript suite:
ghostscript
See Configuration in the extension documentation for more details.
Todo
activate “PGF/TikZ LaTeX Pictures” extension.
-
:tikz:
¶ For more details, see Usage in the extension documentation.
inline content
- The example
1 2
An example role :tikz:`[thick] \node[blue,draw] (a) {A}; \node[draw,dotted,right of=a] {B} edge[<-] (a);`
:which gives: .. include:: tikz-inline-example.rsti
-
.. tikz::
¶ For more details, see Usage in the extension documentation.
explicit markup
- The example
1 2 3 4
.. rst-class:: centered .. tikz:: [>=latex',dotted,thick] \draw[->] (0,0) -- (1,1) -- (1,0) -- (2,0); :libs: arrows
:which gives: .. include:: tikz-explicit-example.rsti
from source file
- The example
1 2 3 4
.. rst-class:: centered .. tikz:: Control system principles (PGF/TikZ example) :include: tikz/ctrloop.tikz :libs: arrows,shapes
:which gives: .. include:: tikz-srcfile-example.rsti
- Which needs
The example above comes from the Control system principles web page and processed the following TikZ file content:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32
[auto, node distance=2cm,>=latex'] \tikzstyle{block} = [draw, fill=blue!20, rectangle, minimum height=3em, minimum width=6em] \tikzstyle{sum} = [draw, fill=blue!20, circle, node distance=1cm] \tikzstyle{input} = [coordinate] \tikzstyle{output} = [coordinate] \tikzstyle{pinstyle} = [pin edge={to-,thin,black}] % placing the blocks \node [input, name=input] {}; \node [sum, right of=input] (sum) {}; \node [block, right of=sum] (controller) {Controller}; \node [block, right of=controller, pin={[pinstyle]above:Disturbances}, node distance=3cm] (system) {System}; % draw an edge between the controller and system block to calculate % the coordinate -- need it to place the measurement block \draw [->] (controller) -- node[name=u] {$u$} (system); \node [output, right of=system] (output) {}; \node [block, below of=u] (measurements) {Measurements}; % once the nodes are placed, connecting them is easy \draw [draw,->] (input) -- node {$r$} (sum); \draw [->] (sum) -- node {$e$} (controller); \draw [->] (system) -- node [name=y] {$y$}(output); \draw [->] (y) |- (measurements); \draw [->] (measurements) -| node[pos=0.99] {$-$} node [near end] {$y_m$} (sum); %Local variables: % coding: utf-8 % mode: text % mode: rst % End: % vim: fileencoding=utf-8 filetype=tex :