2.6. PGF/TikZ LaTeX Pictures¶
- 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:
latexwith thetikzand theamsmathpackagesA 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:
See Configuration in the extension documentation for more details.
-
: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) {㎁}; \node[draw,dotted,right of=a] {㏈} edge[<-] (a);`- Which gives
An example role
![[thick] \node[blue,draw] (a) {㎁};
\node[draw,dotted,right of=a] {㏈} edge[<-] (a);](../_images/tikz-fc3841fe412c2d428e1b9c385ebb05010043df49.png)
-
.. tikz::¶ For more details, see Usage in the extension documentation.
explicit markup
- The example
1 2 3 4
.. rst-class:: centered .. tikz:: [dotted,thick,>=latex'] \draw[->] (0,0) -- (1,1) -- (1,0) -- (2,0); :libs: arrows
- Which gives
![[dotted,thick,>=latex'] \draw[->] (0,0) -- (1,1) -- (1,0)
-- (2,0);](../_images/tikz-0f3d6937e3a6269be560f782bbf73751c1a5fb72.png)
from source file
- The example
1 2 3 4 5
.. _tikz/srcfile/ctrloop: .. rst-class:: centered .. tikz:: Control system principles (PGF/TikZ example) :include: /extensions/tikz/srcfile/ctrloop.tex :libs: arrows,shapes
- Which gives
![\begin{tikzpicture}[
auto,
node distance = 2cm,
>=latex'
]
\tikzstyle{block} = [
draw,
rectangle,
fill = blue!20,
minimum height = 3em,
minimum width = 6em
]
\tikzstyle{sum} = [
draw,
circle,
fill = blue!20,
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);
\end{tikzpicture}
%Local variables:
% coding: utf-8
% mode: text
% mode: rst
% End:
% vim: fileencoding=utf-8 filetype=tex :](../_images/tikz-8e8cdb0f5e4df4298206542e0b9795f3974526bd.png)
Figure 2.1 Control system principles (PGF/TikZ example)
- 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 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57
\begin{tikzpicture}[ auto, node distance = 2cm, >=latex' ] \tikzstyle{block} = [ draw, rectangle, fill = blue!20, minimum height = 3em, minimum width = 6em ] \tikzstyle{sum} = [ draw, circle, fill = blue!20, 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); \end{tikzpicture}
List of Examples