Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

Quick links:

SummaryIntersections libraryArrow tips libraryCalc libraryMindmap LibraryShapes libraryPaper Folding LibraryChains LibraryShapes library


Very often I search a special library of TikZ. At the moment there is no package which loads every library.

Is there a list of all available libraries with a short introduction (2-3 sentences)?

Maybe we can collect them here

share|improve this question
25  
Part IV of the PGF manual is all the libraries; the TOC gives their names, and each section starts with a short introduction. –  Ryan Reich Jan 28 '12 at 19:56
2  
@RyanReich Why don't you add that as an answer? (If Marco still wants to collect libraries here, this question should probably be CW.) –  doncherry Jan 29 '12 at 9:10
3  
What about third party libraries? It would actually be more useful to list those. –  Faheem Mitha Jan 29 '12 at 12:43
1  
@doncherry: I don't think it would be a very good answer, and however correct, he must have known that already. Also, as an answer it would not be the first, whereas it is now the top comment :) –  Ryan Reich Jan 29 '12 at 17:23
    
I totally do not understand the purpose of this list that just mimics the very good PGF documentation. Apparently, other members consider it as very useful, given the number of favorite links, which is a mystery to me. Am I overlooking something? –  Daniel May 25 '12 at 19:07

10 Answers 10

up vote 64 down vote accepted

Summary

Here's the list of libraries, and a brief summary of the purpose of each (any code supplied is for LaTeX and/or Plain TeX, not ConTeXt):

  • Arrow tip library with \usetikzlibrary{arrows}. See details below.
  • Automata Drawing Library, accessed by \usetikzlibrary{automata}, and is used for drawing "finite state automata and Turing Machines". To draw these graphs, each node, its name and relative position is defined, as well as the types of path between each.
  • Background Library, accessed by \usetikzlibrary{backgrounds}, and "defines background for pictures". To use this in a Tikzpicture, an option is passed, e.g. \begin{tikzpicture}[show background rectangle], with a background rectangle style defined before the picture. (e.g. \tikzstyle{background rectangle}=[define background rectangle here]
  • Calc library, accessed throgh \usetikzlibrary{calc} to make complex coordinate caculations. See details below.
  • Calendar Library, accessed through \usetikzlibrary{calendar}. This library is used to display calendars (I guess it's a Ronseal thing). You define a calendar as \calendar[display options and date options](Name (optional)).
  • Chain library to align nodes o chains. See details below.
  • Entity Relationship Diagram Library, accessed by \usetikzlibrary{er}, as in the automata drawing library, each node is defined, as is each edge between each node, as well as any attributes. As a note of warning, underlining should be used for attributes, but this is not used as it is both ugly and difficult to implement. Italics are used instead.
  • Intersection library, accessed through \usetikzlibrary{intersections}, to calculate intersections of paths. See details below.
  • Mind map library, accessed through \usetikzlibrary{mindmap}. See details below.
  • Matrix Library, accessed through \usetikzlibrary{matrix}. Matrices are defined in the same way as in maths mode, however, each item in the matrix as assigned a value as a node, starting from 1. Each node can then be identified and manipulated. Delimiters can also be selected in the matrix options and can be "any delimiter that is acceptable to TeX’s \left command".
  • Paper folding library \usetikzlibrary{folding}. See details below.
  • Pattern Library \usetikzlibrary{patterns}. This package "defines patterns for filling areas". In the documentation, each pattern is named and an example given.
  • Petri-Net Library. This is used to draw Petri Nets, as used for mathematical modelling. As with other similar flowchart style diagrams, each node and edge is defined, as well as their style and position. Tokens can also be embedded within nodes, by treating them as children and child nodes.
  • Plot handler Library, accessed through \usetikzlibrary{plothandlers}. TikZ loads this library automatically. Each point is defined (as a node) for the plot and the each point has a curve placed
    • Plot Mark Library, accessed through \usetikzlibrary{plotmarks} is used to define additional styles for plots as used above. Each point is defined as \pgfuseplotmark{Plot description}.
  • Shape library, used to define shapes other than rectangle, circle and co-ordinate. Accessed through either \usetikzlibrary{shapes} or \usetikzlibrary{shapes.shape type}. The following additional types are available: geometric shapes, either named shapes (star, diamond, etc.) or polygons of specified side numbers; symbol shapes, e.g. "forbidden sign" as used in No Smoking signs; "multipart" shapes, with "multiple (text) parts"; and finally, "misc" shapes which "do not fit in the previous categories", such as strikethrough crosses. See details below.
  • Snake library, as accessed through \usetikzlibrary{snakes} and can be best described as curved lines, and are used either between nodes or as a border to a shape , or as independent shapes.
  • To Path library, accessed through \usetikzlibrary{topaths}. This library is used to define paths between two points, and is loaded automatically. Additionally, it can take the form of curved lines between two shapes or as a loop back to a node.
  • Tree library, accessed through \usetikzlibrary{trees}. Each point on the tree is defined as a node, with children, and each child can have its own children. The tree's direction can also be specified, as well as the angle at which children emerge, however, when left to its own devices, the results are acceptable.

Sources: Anything in inverted commas has been lifted from the tikzpgfmanual, as well as the calendar sample.

share|improve this answer
1  
+1 super My new look up table ;-) –  Marco Daniel Jan 29 '12 at 12:50
1  
Thank you very much, glad it's been useful –  jClark94 Jan 29 '12 at 13:02
5  
How about making a CW answer for each library including an example image. So one can easily add new librarys. I would make an example and start to port your list to separated answers if it’s ok with you. –  Tobi Jan 29 '12 at 13:04
1  
@Tobi: The draw back of the cw is that jClark94 doens't earned any reputation though he provides a great answer. –  Marco Daniel Jan 29 '12 at 13:06
1  
I'd rather it was useful, than I got rep for it, whatever's best for the community –  jClark94 Jan 29 '12 at 13:07

Arrow tips library

Accessed by \usetikzlibrary{arrows}

Description Provides various new arrow tips

Example

\documentclass[parskip]{scrartcl}
\usepackage[margin=15mm]{geometry}
\usepackage{tikz}
\usetikzlibrary{arrows}

\newcommand{\sampleline}[1]{%
\xdef\ca{#1}%
\ca & \ask{\ca-\ca} & \asn{\ca-\ca} & \adk{\ca-\ca} & \adn{\ca-\ca} \\%
}

\newcommand{\ask}[1]{\tikz \draw[#1,thick] (0,0) -- (2,0);}
\newcommand{\asn}[1]{\tikz \draw[#1,thin] (0,0) -- (2,0);}
\newcommand{\adk}[1]{\tikz \draw[#1,double,thick] (0,0) -- (2,0);}
\newcommand{\adn}[1]{\tikz \draw[#1,double,thin] (0,0) -- (2,0);}
\newcommand{\ca}{}


\begin{document}

\begin{tabular}{|l|c|c|c|c|} \hline
\textbf{arrow} & \textbf{thick} & \textbf{thin} & \textbf{double, thick} & \textbf{double, thin} \\ \hline \hline

\sampleline{to}
\sampleline{to reversed}
\sampleline{implies} \hline \hline

\sampleline{latex}
\sampleline{latex reversed}
\sampleline{latex'}
\sampleline{latex' reversed} \hline
\sampleline{stealth}
\sampleline{stealth reversed}
\sampleline{stealth'}
\sampleline{stealth' reversed} \hline
\sampleline{triangle 90}
\sampleline{triangle 90 reversed}
\sampleline{triangle 60}
\sampleline{triangle 60 reversed}
\sampleline{triangle 45}
\sampleline{triangle 45 reversed} \hline
\sampleline{open triangle 90}
\sampleline{open triangle 90 reversed}
\sampleline{open triangle 60}
\sampleline{open triangle 60 reversed}
\sampleline{open triangle 45}
\sampleline{open triangle 45 reversed} \hline \hline

\sampleline{angle 90}
\sampleline{angle 90 reversed}
\sampleline{angle 60}
\sampleline{angle 60 reversed}
\sampleline{angle 45}
\sampleline{angle 45 reversed} \hline \hline

\sampleline{[}
\sampleline{]}
\sampleline{(}
\sampleline{)}
\sampleline{|} \hline \hline

\sampleline{o}
\sampleline{*}
\sampleline{diamond}
\sampleline{open diamond}

\sampleline{square}
\sampleline{open square} \hline \hline

\sampleline{serif cm} \hline\hline

\sampleline{left to}
\sampleline{left to reversed}
\sampleline{right to}
\sampleline{right to reversed} \hline
\sampleline{left hook}
\sampleline{left hook reversed}
\sampleline{right hook}
\sampleline{right hook reversed} \hline
\end{tabular}
\end{document}

enter image description here

Reference
pgfmanual.pdf, pages 256 and 257

share|improve this answer
1  
it looks like double, thin uses single lines, but this is due to the shrunk image. If you run the code given you'll see that it's really double lines. –  Tom Bombadil Jan 29 '12 at 17:29
    
GREAT!!!!!!!!!!! –  Marco Daniel Jan 29 '12 at 18:13

Intersections library

Accessed by \usetikzlibrary{intersections}

Description
Allows automated calculation of path intersections.

Example 1

\documentclass{standalone}

\usepackage{tikz}
\usetikzlibrary{intersections}

\begin{document}
\begin{tikzpicture}
    % Draw to path and give a name to them
    \draw [red, name path={red line}] (0,0) -- (4,3);
    \draw [blue, name path={blue curve}] (1,-0.5) to[out=80, in=100] (3,2);
    % use the intersections on a path to giv them coordinates
    % and draw a line between them
    \draw [green, name intersections={of=red line and blue curve, 
           by={first intersect, second intersect}}]
       (first intersect) -- (second intersect);
    % one can use the coordinates furtheron
    \node [above] at (first intersect) {A};
    \node [below] at (second intersect) {B};
\end{tikzpicture}
\end{document}

result

Example 2

\documentclass{standalone}% or wathever you want

% load packages
\usepackage{tikz, xcolor}
% load libraries
\usetikzlibrary{intersections,shapes.arrows,calc}

% define light and dark gray
\definecolor{lgray}{cmyk}{0,0,0,0.2}
\definecolor{dgray}{cmyk}{0,0,0,0.7}

% make some settings
\tikzset{%
    % style for the intersecting path, which
    % are nessesary for the calculation but
    % shouldn't be drawn in the final image
    ipath/.style={
%       draw,% comment this aout after construction
        red
    },
    % style for an arrow used as object
    optical arrow/.style={%
        fill=dgray,
        inner sep=3pt,
        shape=single arrow,
        minimum width=0.5cm,
        minimum height=1.5cm,
        outer sep=0pt,
        shape border rotate=90,
    },
    % style for the virtual image
    virtual optical arrow/.style={%
        fill=lgray,
        inner sep=3pt,
        shape=single arrow,
        minimum width=0.5cm,
        minimum height=1.5cm,
        outer sep=0pt,
        shape border rotate=90,
    },
    % style for the mirror
    mirror/.style={%
        line width=2pt,
    },
    % style for the axis
    optical axis/.style={%
        thin,
    },
    % style for light rays
    ray/.style={%
        thin,
        ->,
    },
    % style for imagined rays, which ar not real
    % but help by constructin the image
    imagined ray/.style={%
        ray, dgray, -,
    },
    % alias
    virtual ray/.style={imagined ray},
    % style for (focal) points
    point/.style={%
        fill=black,
        radius=0.8pt,
        inner sep=1pt,
        shape=circle,
        minimum size=2pt,
        outer sep=2pt
    },
}

% set three layers
\pgfdeclarelayer{background}
\pgfdeclarelayer{foreground}
\pgfsetlayers{background,main,foreground}
% and define shortcuts to access them
\newcommand{\bglayer}[1]{%
    \begin{pgfonlayer}{background}%
    #1%
    \end{pgfonlayer}%
}
\newcommand{\fglayer}[1]{%
    \begin{pgfonlayer}{foreground}%
    #1%
    \end{pgfonlayer}%
}

\begin{document}
\begin{tikzpicture}
    % define the bounding box is nessesarx because the ipaths
    % make it bigger than needed
    \path [use as bounding box] (-5.2,-5) rectangle (6.2,5);
    % define variables, you may vary them a little
    %% radius
    \def\radius{5}
    \def\radiusII{5.05}
    %% focal distancs = \radius/2
    \def\focal{2.5}
    %% object size
    \def\size{1.cm}
    %% object width
    \def\owidth{1.25}
    % draw mirror
    %% the extra ipath is nessesary to get nicer rays
    \path [ipath, name path=M] (\radius,0) ++(90:\radius)
          arc (90:270:\radius);
    \fglayer{%
        \draw [mirror] (\radiusII-0.05,0) ++(130:\radiusII)
              arc (130:240:\radiusII);
    }
    % draw focal point
    \node (B) at (\focal,0) [point] {};
    % draw object
    \node (O) [optical arrow,anchor=tail, minimum height=\size] %
          at (\owidth,0) {};
    %% description
    \node [above right] at (O.tip) {object};
    % rays
    %% draw axis ray
    \draw [ray] (O.tip) -- (0,0) -- ($(0,0)!3!(\owidth,-\size)$);
    %% draw parallel ray
    \path [ipath, name path=PS] (O.tip) -- ++(-3,0);
    \draw [ray, name intersections={of=M and PS, by=M-PS}]
        (O.tip) -- (M-PS) -- ($(M-PS)!2!(B)$);
    %% caculate virtual axis ray
    \path [ipath, name path=AS-V] ($(0,0)!-4!(\owidth,-\size)$) -- (0,0);
    %% calculate virtual parallel ray
    \path [ipath, name path=PS-V] ($(M-PS)!-4!(B)$) -- (M-PS);
    %% draw virtual axis ray
    \draw [imagined ray, name intersections={of=AS-V and PS-V, by=Tip-V}]
        (Tip-V) -- (0,0);
    %% draw virtual axis ray
    \draw [imagined ray] (Tip-V) -- (M-PS);
    % draw virtual object
    \bglayer{\path let \p{1}=(Tip-V) in 
        (Tip-V) node (V) [minimum height=\size,
                          scale={\y{1}/\size*0.665},
                          virtual optical arrow,anchor=tip
                         ] {};}
    %% description
    \path (V.west) node [left] {virtual image};
    % draw optical axis
    \fglayer{\draw [optical axis] (-5,0) --++(11,0);}
\end{tikzpicture}
\end{document}

width drawn ipaths

final image

Reference
pgfmanual.pdf, pp. 131 et sec.

share|improve this answer
3  
Your great example 2 should IMHO be sent to TeXample.net. –  Speravir Jan 30 '12 at 0:11
    
@Speravir: Thanks you, I’ll send it :-) –  Tobi Jan 30 '12 at 15:23

Calc library

Accessed by \usetikzlibrary{calc}

Description
Allows extended coordinate calculation

Example

\documentclass{standalone}

\usepackage{tikz}
\usetikzlibrary{calc}

\begin{document}
\begin{tikzpicture}
    % make some mathematical calculations
    \node (a) at (1,1) {A};
    \fill [red] ($(a) + 1/3*(1cm,0)$) circle (2pt);
    % draw a segment of a path between two points
    \coordinate (b) at (0,0);
    \coordinate (c) at (0.5,3);
    \fill (b) circle (1pt) (c) circle (1pt);
    \draw [blue!50!green, ->] (b) -- ($(b)!1.5!(c)$);
    \draw [blue, ->] (b) -- ($(b)!0.5!(c)$);
    % draw a parallel line
    \draw [green] (2,0) coordinate (d) -- (3,4) coordinate (e);
    \draw [green, dashed] (2.5,1) -- ++($(e)-(d)$);
\end{tikzpicture}
\end{document}

result

Reference
pgfmanual.pdf, pp. 134 et sec.

share|improve this answer

Shapes library

Accessed by \usetikzlibrary{shapes}

Description
Allows shapes to be placed as part of a flowchart

Example

\documentclass{standalone}

\usepackage{tikz, xcolor}
\usetikzlibrary{shapes,arrows}


\tikzstyle{decision} = [diamond, draw, text width=4.5em, 
                        text badly centered, node distance=2cm, 
                        inner sep=0pt]
\tikzstyle{block} = [rectangle, draw, text width=5em, 
                     text centered, rounded corners, 
                     minimum height=4em, node distance=3cm]
\tikzstyle{line} = [draw, -latex']
\tikzstyle{cloud} = [draw, ellipse, node distance=2.5cm, minimum height=2em]
\tikzstyle{blank} = [node distance=1cm]

\begin{document}
\begin{tikzpicture}[node distance = 3cm, auto]
    % Place nodes
    \node [cloud] (init) {n};    
    \node [blank, below of=init] (sup) {};
    \node [decision, below of=sup] (square) {$n^2 \le 1$};
    \node [cloud, right of=square] (end) {End};
    \node [block, left of=square] (newN) {$n = \frac{2}{n}$};

    % Draw edges
    \path [line] (init) -- (square);
    \path [line] (square) -- node [near start] {yes} (end);
    \path [line] (square) -- node [near start] {no} (newN);
    \path [line] (newN) |- (sup);
\end{tikzpicture}
\end{document}

result

Reference
http://www.texample.net/tikz/examples/simple-flow-chart/ Used as a base to get started, additional style (blank) used as a support, example from a question asked at university interview.

share|improve this answer

Mindmap Library

Accessed by \usetikzlibrary{mindmap}

Description

The main focus point, is placed in the middle, with sub-points branching off. Each node is defined, as are its children. Nodes can also be separate from each other, and each node can also be coloured differently and interconnected. Annotations are also available.

Example

\documentclass{standalone}
\usepackage{tikz}
\usetikzlibrary{mindmap,backgrounds}

\begin{document}
\tikzstyle{root concept}+=[concept color=blue!20,minimum size=2cm]
\tikzstyle{level 1 concept}+=[sibling angle=45]

\begin{tikzpicture}[mindmap]
\node [concept] (n1) {Stack Exchange Sites}
    child[concept color=red,grow=45] {node[concept] (c1) {Meta}}
    child[concept color=orange,grow=0] {node[concept] (c2) {Q \& A}}
    child[concept color=green,grow=-45] {node[concept] (c3) {Chat}};
\begin{pgfonlayer}{background}
\draw [concept connection] (c1) edge (c2)
                                edge (c3)
                           (c2) edge (c3);
\end{pgfonlayer}

\node [extra concept] at (0,10) (n2) {\TeX {} and \LaTeX {}Stack Exchange}
    child[concept color=red,grow=45] {node[concept] (s1) {Meta}}
    child[concept color=orange,grow=0] {node[concept] (s2) {Q \& A}}
    child[concept color=green,grow=-45] {node[concept] (s3) {Chat}};

\begin{pgfonlayer}{background}
    \draw [concept connection] (s1) edge (s2)
                                    edge (s3)
                               (s2) edge (s3)
                               (n1) edge (n2);
\end{pgfonlayer}
\end{tikzpicture}

\end{document}

result

Reference
pgfmanual.pdf, pp. 207 et sec.

share|improve this answer

Paper Folding Library

Accessed by \usetikzlibrary{folding}

Description

It contains a single command, but it is useful for producing real calendars (as used on a desktop).

Example

\documentclass{standalone}

\usepackage{tikz, xcolor}
\usetikzlibrary{folding,calendar}
\begin{document}
\sffamily\scriptsize
\begin{tikzpicture}[transform shape]
\tikzstyle{every calendar}=
[
    %Formats calendars and sets positions
    at={(-8ex,4ex)},
    week list,
    month label above centered,
    month text=\bfseries\textcolor{red}{\%mt} \%y0,
    if={(Sunday) [black!50]}
    ]
\tikzfoldingdodecahedron
[
    %Sets size of calendar
    folding line length=2.5cm,
    %Adds calendar image to each face
    face 1={ \calendar [dates=\the\year-01-01 to \the\year-01-last];},
    face 2={ \calendar [dates=\the\year-02-01 to \the\year-02-last];},
    face 3={ \calendar [dates=\the\year-03-01 to \the\year-03-last];},
    face 4={ \calendar [dates=\the\year-04-01 to \the\year-04-last];},
    face 5={ \calendar [dates=\the\year-05-01 to \the\year-05-last];},
    face 6={ \calendar [dates=\the\year-06-01 to \the\year-06-last];},
    face 7={ \calendar [dates=\the\year-07-01 to \the\year-07-last];},
    face 8={ \calendar [dates=\the\year-08-01 to \the\year-08-last];},
    face 9={ \calendar [dates=\the\year-09-01 to \the\year-09-last];},
    face 10={\calendar [dates=\the\year-10-01 to \the\year-10-last];},
    face 11={\calendar [dates=\the\year-11-01 to \the\year-11-last];},
    face 12={\calendar [dates=\the\year-12-01 to \the\year-12-last];},
];
\end{tikzpicture}
\end{document}

result

Reference
pgfmanual.pdf, pp. 202 et sec.

share|improve this answer
    
You may make the examples work like an MWE. E.g. using the standalone class; see my answers how to use it. –  Tobi Jan 29 '12 at 15:05
    
OK, thanks, I've also updated my answer below to a (hopefully) MWE –  jClark94 Jan 29 '12 at 15:10

Chains Library

Accessed by \usetikzlibrary{chains}

Description

Chains are sequences of nodes that are arranged in a row or a column and that are, typically, connected by edges. More generally, they can be used to position nodes of a branching network in a systematic manner. For the positioning of nodes in rows and columns you can also use matrices (see Section 17 of pgfmanual.pdf) but chains can also be used to describe the connections between nodes that have already been connected using, say, matrices. Thus, it often makes sense to use matrices for the positioning of elements and chains to describe the connections.

Example with Chains

\documentclass{standalone}

\usepackage{tikz}
\usetikzlibrary{shapes,% for the rectangle
                chains,% provides the chains
                scopes}% allows to replace \begin{scope} \end{scope} with {}

\begin{document}
\begin{tikzpicture}[
  nonterminal/.style={
    rectangle, 
    minimum size=6mm, 
    very thick, 
    draw=red!50!black!50, 
    top color=white, % a shading that is white at the top...
    bottom color=red!50!black!20, % and something else at the bottom
    font=\itshape
  },
  terminal/.style={
    rectangle,minimum size=6mm,rounded corners=3mm,
    very thick,draw=black!50,
    top color=white,bottom color=black!20,
    font=\ttfamily
  },
  node distance=5mm, every on chain/.style={join}, every join/.style={->}
]
{ [start chain]
  \node [on chain,nonterminal] {unsigned integer};
  \node [on chain,terminal] {.};
  \node [on chain,terminal] {digit};
  \node [on chain,terminal] {E};
  { [start branch=plus]
    \node (plus) [terminal,on chain=going above right] {+};
  }
  { [start branch=minus]
    \node (minus) [terminal,on chain=going below right] {-};
  }
  \node [on chain, nonterminal, join=with chain/plus-end, join=with chain/minus-end] {unsigned integer};
}
\end{tikzpicture}
\end{document}

chains

Example with Matrix and Chains

\documentclass{standalone}

\usepackage{tikz}
\usetikzlibrary{shapes,% for the rectangle
                chains,% provides the chains
                scopes}% allows to replace \begin{scope} \end{scope} with {}

\begin{document}
\begin{tikzpicture}[
  nonterminal/.style={
    rectangle, 
    minimum size=6mm, 
    very thick, 
    draw=red!50!black!50, 
    top color=white, % a shading that is white at the top...
    bottom color=red!50!black!20, % and something else at the bottom
    font=\itshape
  },
  terminal/.style={
    rectangle,minimum size=6mm,rounded corners=3mm,
    very thick,draw=black!50,
    top color=white,bottom color=black!20,
    font=\ttfamily
  },
  every on chain/.style={join}, every join/.style={->}
]

\matrix[column sep=4mm] {
  % First row:
  & & & & \node (plus) [terminal] {+};&\\
  % Second row:
  \node (ui1)   [nonterminal] {unsigned integer};&
  \node (dot)   [terminal]    {.};               &
  \node (digit) [terminal]    {digit};           &
  \node (e)     [terminal]    {E};               &
  & % space in between
  \node (ui2) [nonterminal] {unsigned integer};\\
  % Third row:
  & & & & \node (minus)[terminal] {-};&\\
  };

{ [start chain]
  \chainin (ui1);
  \chainin (dot);
  \chainin (digit);
  \chainin (e);
  { [start branch=plus]
    \chainin (plus);
  }
  { [start branch=minus]
    \chainin (minus);
  }
  \chainin (ui2) [join=with chain/plus-end, join=with chain/minus-end];
}
\end{tikzpicture}
\end{document}

matrix

Chains with Labels

Some times one needs to add labes to the edges created by the chains library (it happened to me before). Although it is not supported natively by the library, you can do it by tweaking the library.

An example is:

\documentclass{standalone}

\usepackage{tikz}
\usetikzlibrary{shapes,% for the rectangle
                chains,% provides the chains
                scopes}% allows to replace \begin{scope} \end{scope} with {}

\makeatletter
\def\tikz@lib@parse@join#1{%
  \def\tikz@temp{#1}%
  \ifx\tikz@temp\pgfutil@empty%
    \tikz@lib@parse@join@by by \pgf@stop%
  \else%
    \pgfutil@in@{with }{#1}% 
    \ifpgfutil@in@% 'with [by] [label]'
      \pgfutil@in@{by }{#1}%
      \ifpgfutil@in@% 'with by [label]'
        \pgfutil@in@{label }{#1}%
        \ifpgfutil@in@% 'with by label'
          \tikz@lib@parse@join@with@by@label#1\pgf@stop%
        \else% 'with by'
          \tikz@lib@parse@join@with@by#1\pgf@stop%
        \fi%
      \else% 'with [label]'
        \pgfutil@in@{label }{#1}%
        \ifpgfutil@in@% 'with label'
          \tikz@lib@parse@join@with@label#1\pgf@stop%
        \else% with
          \tikz@lib@parse@join@with@by#1 by \pgf@stop%
        \fi%
      \fi%
    \else% '[by] [label]'
      \pgfutil@in@{by }{#1}%
      \ifpgfutil@in@% 'by [label]'
        \pgfutil@in@{label }{#1}%
        \ifpgfutil@in@% 'by label'
          \tikz@lib@parse@join@by@label#1\pgf@stop%
        \else% 'by'
          \tikz@lib@parse@join@by#1\pgf@stop%
        \fi%
      \else% '[label]'
        \pgfutil@in@{label }{#1}%
        \ifpgfutil@in@% 'label'
          \tikz@lib@parse@join@label#1\pgf@stop%
        \else%
          \tikz@lib@parse@join@by#1 by \pgf@stop%
        \fi%
      \fi%
    \fi%
  \fi%
}
\def\tikz@lib@parse@join@with@by@label with #1 by #2 label #3\pgf@stop{%
  \tikzset{after node path={(#1)edge[every join,#2]#3(\tikzchaincurrent)}}%
}
\def\tikz@lib@parse@join@with@label with #1 label #2\pgf@stop{%
  \tikzset{after node path={(#1)edge[every join]#2(\tikzchaincurrent)}}%
}
\def\tikz@lib@parse@join@by@label by #1 label #2\pgf@stop{%
  \tikzset{after node path={\ifx\tikzchainprevious\pgfutil@empty\else(\tikzchainprevious)edge[every join,#1]#2(\tikzchaincurrent)\fi}}%
}
\def\tikz@lib@parse@join@label label #1\pgf@stop{%
  \tikzset{after node path={\ifx\tikzchainprevious\pgfutil@empty\else(\tikzchainprevious)edge[every join]#1(\tikzchaincurrent)\fi}}%
}
\makeatother

\begin{document}
\begin{tikzpicture}[
  nonterminal/.style={
    rectangle, 
    minimum size=6mm, 
    very thick, 
    draw=red!50!black!50, 
    top color=white, % a shading that is white at the top...
    bottom color=red!50!black!20, % and something else at the bottom
    font=\itshape
  },
  terminal/.style={
    rectangle,minimum size=6mm,rounded corners=3mm,
    very thick,draw=black!50,
    top color=white,bottom color=black!20,
    font=\ttfamily
  },
  every on chain/.style={join}, every join/.style={->}
]

\matrix[column sep=4mm] {
  % First row:
  & & & & \node (plus) [terminal] {+};&\\
  % Second row:
  \node (ui1)   [nonterminal] {unsigned integer};&
  \node (dot)   [terminal]    {.};               &
  \node (digit) [terminal]    {digit};           &
  \node (e)     [terminal]    {E};               &
  & % space in between
  \node (ui2) [nonterminal] {unsigned integer};\\
  % Third row:
  & & & & \node (minus)[terminal] {-};&\\
  };

{ [start chain]
  \chainin (ui1);
  \chainin (dot);
  \chainin (digit);
  \chainin (e);
  { [start branch=plus]
    \chainin (plus) [join=label {node[above left]{a label}}];
  }
  { [start branch=minus]
    \chainin (minus);
  }
  \chainin (ui2) [join=with chain/plus-end label {node[above right] {plus label}}, join=with chain/minus-end by dashed label {node [below right]{minus label}}];
}
\end{tikzpicture}
\end{document}

with edges

Reference

pgfmanual.pdf, pp. 284 et sec. The examples are a simplified version of the Tutorial: Putting a Diagram in Chains, of pp. 60

share|improve this answer

Shapes library

Accessed by \usetikzlibrary{shapes, shapes.geometric, shapes.symbols, shapes.arrows, shapes.multipart, shapes.callouts, shapes.misc}

Description
Provide several shapes besides the standard ones

Example

\documentclass[parskip]{scrartcl}
\usepackage[margin=5mm,a3paper]{geometry}
\usepackage{kerkis}
\usepackage{tikz}
\usetikzlibrary{
    shapes,
    shapes.geometric,
    shapes.symbols,
    shapes.arrows,
    shapes.multipart,
    shapes.callouts,
    shapes.misc}

\begin{document}

\tikzset{every node/.style={draw=red!20!black,fill=orange!50!red!50!white,text=black,inner sep=2pt}}

{\LARGE \textbf{Standard shapes}}\\
\foreach \shape in {circle,rectangle}
{   \begin{tikzpicture}
        \node[shape=\shape] {\shape};
    \end{tikzpicture}
}
\\\hrule

{\LARGE \textbf{Geometric shapes}}\\
\foreach \shape in {diamond,ellipse,trapezium,semicircle,regular polygon,star,isosceles triangle,kite,dart,circular sector,cylinder}
{   \begin{tikzpicture}
        \node[shape=\shape] {\shape};
    \end{tikzpicture}
}
\\\hrule

{\LARGE \textbf{Symbol shapes}}\\
\foreach \shape in {forbidden sign,magnifying glass,cloud,starburst,signal,tape}
{   \begin{tikzpicture}
        \node[shape=\shape] {\shape};
    \end{tikzpicture}
}
\\\hrule

{\LARGE \textbf{Arrow shapes}}\\
\foreach \shape in {single arrow,double arrow,arrow box}
{   \begin{tikzpicture}
        \node[shape=\shape] {\shape};
    \end{tikzpicture}
}
\\\hrule

{\LARGE \textbf{Multipart shapes}}\\
\foreach \shape in {circle split,circle solidus,ellipse split,rectangle split}
{   \begin{tikzpicture}
        \node[shape=\shape] {\shape};
    \end{tikzpicture}
}
\\\hrule

{\LARGE \textbf{Callout shapes}}\\
\foreach \shape in {ellipse callout,rectangle callout,cloud callout}
{   \begin{tikzpicture}
        \node[shape=\shape] {\shape};
    \end{tikzpicture}
}
\\\hrule

{\LARGE \textbf{Miscellaneous shapes}}\\
\foreach \shape in {cross out,strike out,rounded rectangle,chamfered rectangle}
{   \begin{tikzpicture}
        \node[shape=\shape] {\shape};
    \end{tikzpicture}
}

\end{document}

enter image description here

Reference
pgfmanual.pdf, pages 419 to 461

share|improve this answer
    
Shouldn't this answer be merged with tex.stackexchange.com/a/42675/5049? –  cgnieder Jun 26 '13 at 11:57

I created a PDF with all the libraries and a short definition from the pfdmanual.

enter image description here

You can find the PDF here table-library

It's a first version and I have not reread or corrected and I think the order is not fine. The last libraries about graphs need luatex.

share|improve this answer
    
Your pdf link is dead. Could you update it, please. Thank you. –  Hotschke May 27 at 8:09
    
I added the PDF to the my site. With pgf 3.0 I need to update now the document. –  Alain Matthes May 31 at 9:32
    
Thank you very much. Highly appreciated, the pgf/tikz documentation is very large but unhandy. –  Hotschke May 31 at 17:38

protected by Marco Daniel Jan 30 '12 at 17:46

Thank you for your interest in this question. Because it has attracted low-quality answers, posting an answer now requires 10 reputation on this site.

Would you like to answer one of these unanswered questions instead?

Not the answer you're looking for? Browse other questions tagged or ask your own question.