9

i'm trying to reproduce this workflow diagram enter image description here

i just tried to reproduce the blocks before the relations but it's freezing when i compile this chunk of code and i'm forced to kill pdflatex could somebody help me i'm a complete noob to tikz thank you by advance

\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage[francais]{babel}
\usepackage{tikz}
\usetikzlibrary{arrows,shapes,positioning,shadows,trees}
\usepackage{capt-of}

\title{a graph}
\author{Author}
\date{Janvier 2018}

\begin{document}

\begin{center}
\tikzset{
basic/.style  = {draw, text width=2cm, drop shadow, font=\sffamily, rectangle},
root/.style   = {basic, thin, align=center,
           fill=gray!45},
level 2/.style = {basic, thin,align=center, fill=gray!30,
           text width=8em},
level 3/.style = {basic, thin, align=left, fill=gray!20, text width=6.5em}
}
\begin{tikzpicture}[
level 1/.style={sibling distance=40mm},
edge from parent/.style={<->,draw},>=
\node[block](1) {"blessed repository"}
\node [block, right=5cm of 1] (2) {public developer}
\node [block, right =5cm of 2] (3) {public developer}
\node [block, below=4cm of 1] (4) {integration manager}
\node [block, below=2cm of 2] (5) {private developer}
\node [block, below =2cm of 3] (6) {private developer}
\end{tikzpicture}
\end{center}

\end{document}
8

There are three things that create errors, as mentioned by Phelype as well:

  1. You've forgotten the closing ] for the options to the tikzpicture, i.e. you have \begin{tikzpicture}[... instead of \begin{tikzpicture}[...]

  2. You've forgotten the mandatory semicolon at the end of each \node statement.

  3. You've used a style called block for all the nodes, but you haven't actually defined that style.

Here is a slightly different approach to Phelype's, using a style that takes an argument to set the fill colour of the node, and a loop to draw the arrows. I removed all the tree stuff (e.g. level 1/.style) as you're not drawing a tree, and the custom distances for the nodes. The default distance (1cm, I think) seems OK here.

output of code

\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage[francais]{babel}
\usepackage{tikz}
\usetikzlibrary{
  arrows.meta, % supersedes arrows
  positioning,
  shadows,
  babel % fixes some problems that sometimes occur when babel is used
}

\begin{document}
\begin{center}
\begin{tikzpicture}[
  block/.style = {
    draw,
    text width=2cm,
    align=center,
    drop shadow,
    font=\sffamily,
    rectangle,
    fill=#1 % fill color is argument to style
  },
 % set default value for fill
 block/.default={black!20},
]
\node [block=orange!80] (1) {``blessed repository''};
\node [block=blue!80!red!50!white, right=of 1] (2) {public developer};
\node [block=blue!80!red!50!white, right=of 2] (3) {public developer};
\node [block=red!80, below=of 1] (4) {integration manager};
\node [block, below=of 2] (5) {private developer};
\node [block, below=of 3] (6) {private developer};

\foreach \x/\y in {1/5,1/6,2/4,3/4,4/1,5/2,6/3}
  \draw [thick,black!50,-Latex] (\x) -- (\y);

\end{tikzpicture}
\end{center}
\end{document}
  • Maybe also change " to `` and '' to typeset "blessed repository" properly – Nathaniel Feb 7 '18 at 13:54
6

Your code had a few problems. There was an unmatched bracket ([) and there was no semicolon (;) after the nodes, that's why it didn't compile.

Edit:

Improved a little with @TeXnician's suggestion.

enter image description here

\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage[francais]{babel}
\usepackage{tikz}
\usetikzlibrary{%
arrows,
shapes,
positioning,
shadows,
trees,
arrows.meta,
decorations,
decorations.markings,
decorations.text}
\usepackage{capt-of}

\title{a graph}
\author{Author}
\date{Janvier 2018}

\begin{document}

\begin{center}
\tikzset{
myblock/.style = {text width=2cm, text=white, font=\sffamily, rectangle,align=center},
byellow/.style = {myblock, fill=yellow!80!black},
bblue/.style =   {myblock, fill=green!50!blue},
bred/.style =    {myblock, fill=red!90!yellow},
bgray/.style =   {myblock, fill=black!10, text=black},
arrow/.style={>={Stealth},thick,black!50}
}

\begin{tikzpicture}%[level 1/.style={sibling distance=40mm},edge from parent/.style={<->,draw},>=]
\node [byellow, xshift=0cm, yshift=0cm] (1) {``blessed repository''};
\node [bblue  , xshift=3cm, yshift=0cm] (2) {public developer};
\node [bblue  , xshift=6cm, yshift=0cm] (3) {public developer};
\node [bred   , xshift=0cm, yshift=-2cm] (4) {integration manager};
\node [bgray  , xshift=3cm, yshift=-2cm] (5) {private developer};
\node [bgray  , xshift=6cm, yshift=-2cm] (6) {private developer};
\draw [->,arrow] (4.north) -- (1.south);
\draw [->,arrow] (1.south) -- (5.north);
\draw [->,arrow] (1.south) -- (6.north);
\draw [->,arrow] (5.north) -- (2.south);
\draw [->,arrow] (2.south) -- (4.north);
\draw [->,arrow] (3.south) -- (4.north);
\draw [->,arrow] (6.north) -- (3.south);
\end{tikzpicture}
\end{center}

\end{document}
  • 1
    Maybe you could do something about the arrows by using arrows.meta and \tikzset{>={Stealth}}. – TeXnician Feb 7 '18 at 12:49

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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