Graphics, Figures & TablesProblem compiling an example from texample for tikz

Information and discussion about graphics, figures & tables in LaTeX documents.
Post Reply
teotjunk
Posts: 18
Joined: Fri Sep 19, 2008 5:28 pm

Problem compiling an example from texample for tikz

Post by teotjunk »

I copied an example from texexample for tikz. But have problems compiling it. This is the latex code

Code: Select all

% Data flow diagram
% Author: David Fokkema
\documentclass{article}
\usepackage{tikz}
%%%<
\usepackage{verbatim}
\usepackage[active,tightpage]{preview}
\PreviewEnvironment{center}
\setlength\PreviewBorder{10pt}%
%%%>
\begin{comment}
:Title: Data flow diagram
:Tags: Nodes and shapes;Matrices;Styles;Computer science
:Author: David Fokkema
:Slug: data-flow-diagram

Data flow diagrams depict the flow of information in a system. This
figure shows experimental data being recorded, processed and ultimately
stored. This figure is a minor revision of the one included in
[my PhD thesis](http://dx.doi.org/10.3990/1.9789036534383).
\end{comment}
\usetikzlibrary{arrows}

% Defines a `datastore' shape for use in DFDs.  This inherits from a
% rectangle and only draws two horizontal lines.
\makeatletter
\pgfdeclareshape{datastore}{
  \inheritsavedanchors[from=rectangle]
  \inheritanchorborder[from=rectangle]
  \inheritanchor[from=rectangle]{center}
  \inheritanchor[from=rectangle]{base}
  \inheritanchor[from=rectangle]{north}
  \inheritanchor[from=rectangle]{north east}
  \inheritanchor[from=rectangle]{east}
  \inheritanchor[from=rectangle]{south east}
  \inheritanchor[from=rectangle]{south}
  \inheritanchor[from=rectangle]{south west}
  \inheritanchor[from=rectangle]{west}
  \inheritanchor[from=rectangle]{north west}
  \backgroundpath{
    %  store lower right in xa/ya and upper right in xb/yb
    \southwest \pgf@xa=\pgf@x \pgf@ya=\pgf@y
    \northeast \pgf@xb=\pgf@x \pgf@yb=\pgf@y
    \pgfpathmoveto{\pgfpoint{\pgf@xa}{\pgf@ya}}
    \pgfpathlineto{\pgfpoint{\pgf@xb}{\pgf@ya}}
    \pgfpathmoveto{\pgfpoint{\pgf@xa}{\pgf@yb}}
    \pgfpathlineto{\pgfpoint{\pgf@xb}{\pgf@yb}}
 }
}
\makeatother

\begin{document}
\begin{center}
\begin{tikzpicture}[
  font=\sffamily,
  source/.style={draw,thick,rounded corners,fill=yellow!20,inner sep=.3cm},
  process/.style={draw,thick,circle,fill=blue!20},
  sink/.style={source,fill=green!20},
  datastore/.style={draw,very thick,shape=datastore,inner sep=.3cm},
  dots/.style={gray,scale=2},
  to/.style={->,>=stealth',shorten >=1pt,semithick,font=\sffamily\footnotesize},
   every node/.style={align=center}]
  % Position the nodes using a matrix layout
\end{tikzpicture}
\end{center}
\end{document}


And this is the error messsage

Code: Select all

tikz: I do not know what to do with the option ``source/.style={draw,thick,rounded corners,fill=yellow!20,inner sep=.3cm}''. every node/.style={align=center}]
tikz: I do not know what to do with the option ``process/.style={draw,thick,circle,fill=blue!20}''. every node/.style={align=center}]
tikz: I do not know what to do with the option ``sink/.style={source,fill=green!20}''. every node/.style={align=center}]
tikz: I do not know what to do with the option ``datastore/.style={draw,very thick,shape=datastore,inner sep=.3cm}''. every node/.style={align=center}]
tikz: I do not know what to do with the option ``dots/.style={gray,scale=2}''. every node/.style={align=center}]
Missing \endcsname inserted every node/.style={align=center}]
Extra }, or forgotten \endgroup every node/.style={align=center}]
Extra \endcsname every node/.style={align=center}]
Missing \endcsname inserted every node/.style={align=center}]
Extra }, or forgotten \endgroup every node/.style={align=center}]
Extra \endcsname every node/.style={align=center}]
tikz: I do not know what to do with the option ``to/.style={->,
tikz: I do not know what to do with the option ``every node/.style={align=center}''. every node/.style={align=center}]
Last edited by teotjunk on Mon Jul 15, 2013 9:57 am, edited 1 time in total.

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org

NEW: TikZ book now 40% off at Amazon.com for a short time.

And: Currently, Packt sells ebooks for $4.99 each if you buy 5 of their over 1000 ebooks. If you choose only a single one, $9.99. How about combining 3 LaTeX books with Python, gnuplot, mathplotlib, Matlab, ChatGPT or other AI books? Epub and PDF. Bundle (3 books, add more for higher discount): https://packt.link/MDH5p

Stefan Kottwitz
Site Admin
Posts: 10335
Joined: Mon Mar 10, 2008 9:44 pm

Problem compiling an example from texample for tikz

Post by Stefan Kottwitz »

The example is not complete. A matrix and several \draw commands are missing in your copy of the original example.

Please use the "Code" button for marking inserted code, to make it readable. Usually I correct it when I see people forgot it. This time I did not, so you don't think somebody removed that piece of code.

Stefan
LaTeX.org admin
Post Reply