[Tex/LaTex] package tikz error with pgfgantt

pgfgantttikz-pgf

I need to draw a gantt chart in my LaTex document and found the pgfgantt package that does just that. Unfortunately, it requires the TikZ` package, and it looks like I'm having trouble with it, and I can't tell why because I never used it.

Here's my code :

\documentclass[a4paper]{article}
\usepackage[latin1]{inputenc}
\usepackage[T1]{fontenc}
\usepackage[francais]{babel} 
\usepackage{tikz}
\usepackage{pgfgantt}
\usetikzlibrary{arrows,backgrounds,calc,patterns,shapes,positioning,shadows,trees}
\usepackage{pgfcalendar}
\begin{document}
\begin{figure}[ht!]
\begin{ganttchart}{1}{15}
    \gantttitle{Du 1er Février au 9 Mai}{15} \\
    \gantttitlelist{1,...,15}{1} \\
    \ganttgroup{Préparation}{1}{3} \\
    \ganttbar{Recherche de ressources}{1}{3} \\
    \ganttbar{Définition des contraintes}{1}{3} \\
    \ganttbar{Recherche de méthode d'archivage}{1}{1} \\
    \ganttlinkedbar{Mise en place archivage}{2}{3} \\
\end{ganttchart}
\caption{Diagramme de Gantt pour le projet SN3D}
\end{figure}
\end{document}

And here are the error messages :

!Package tikz Error : + or – expected (line of the \ganttlinkedbar command)

!Package tikz Error : Giving up on this path. Did you forget a semicolon? (same line)

I went through the pgfgantt documentation but couldn't find anything about that. I also searched google and didn't find anything that could help me.

Thanks for your help !

EDIT : I tried to use TikZ babel library but in created several errors in another part of my code using TikZ` that didn't have any problem earlier.

Here's my complete code :

\documentclass[a4paper]{article}
\usepackage[latin1]{inputenc}
\usepackage[T1]{fontenc}
\usepackage[francais]{babel} 
\usepackage{graphicx}
\usepackage{stmaryrd}
\usepackage{amssymb}
\usepackage{dsfont}
%Pour les images (gantt, WBS)
\usepackage{tikz}
%Pour délimiter les flottants
\usepackage{placeins}
\usepackage{pgfgantt}

\usetikzlibrary{arrows,backgrounds,calc,patterns,shapes,positioning,shadows,trees}
\usepackage{pgfcalendar}

\tikzset{
  basic/.style  = {draw, text width=2cm, drop shadow, font=\sffamily, rectangle},
  root/.style   = {basic, rounded corners=2pt, thin, align=center,
                   fill=green!30},
  level 2/.style = {basic, rounded corners=6pt, thin,align=center, fill=green!60,
                   text width=8em},
  level 3/.style = {basic, thin, align=left, fill=pink!60, text width=6.5em}
}
\title{Plan de développement}
\author{Groupe PEI n\textsuperscript{o}44 \\ \\ Entreprise SN3D}
\date{le 3 Février 2016}
\begin{document}
\maketitle
\tableofcontents
\newpage
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%                              PARTIE 1                                 %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\section{Définition du projet}
\subsection{Contexte du projet}
\subsection{Objectifs de la mission}
\subsection{Livrables}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%                              PARTIE 2                                 %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\section{Modalités d'exécution}
\subsection{Cycle de vie}
\subsection{Work Breakdown Structure du projet}
L'objectif fixé est de rendre au client un livrable recensant une sélection de capteurs intégrés ou modules assortie de cas d'utilisation précis. \`A cette fin, le travail sera décomposé de la manière suivante : \newline
%%%%%%%%%%% WBS %%%%%%%%%%%%%%%
\FloatBarrier
\begin{figure}[ht!]
%makebox pour centrer les figures trop larges
\makebox[\textwidth][c]{
\begin{tikzpicture}[level 1/.style={sibling distance=40mm},
edge from parent/.style={->,draw},>=latex]
% root of the the initial tree, level 1
\node[root] {Projet SN3D}
% The first level, as children of the initial tree
  child {node[level 2] (c1) {Choix des outils de travail}}
  child {node[level 2] (c2) {Recherche des capteurs}}
  child {node[level 2] (c3) {Définition de cas d'usage}}
    child {node[level 2] (c4) {Synthèse et mise en forme}};

% The second level, relatively positioned nodes
\begin{scope}[every node/.style={level 3}]
\node [below of = c1, xshift=15pt] (c11) {Archivage};
\node [below of = c11] (c12) {Sources};
\node [below of = c12] (c13) {Mise en forme};

\node [below of = c2, xshift=15pt] (c21) {Intensive};
\node [below of = c21] (c22) {Veille};


\node [below of = c3, xshift=15pt] (c31) {Scénari};
\node [below of = c31] (c32) {Aspects techniques};
\node [below of = c32] (c33) {Illustrations};

\node [below of = c4, xshift=15pt] (c41) {Livrable};
\node [below of = c41] (c42) {Rapport};
\node [below of = c42] (c43) {Poster};
\end{scope}

% lines from each level 1 node to every one of its "children"
\foreach \value in {1,2,3}
  \draw[->] (c1.195) |- (c1\value.west);

\foreach \value in {1,...,2}
  \draw[->] (c2.195) |- (c2\value.west);

\foreach \value in {1,...,3}
  \draw[->] (c3.195) |- (c3\value.west);

\foreach \value in {1,...,3}
  \draw[->] (c4.195) |- (c4\value.west);
\end{tikzpicture}
}
\caption{WBS du projet}
\end{figure}
\FloatBarrier
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\subsection{Planning (diagramme de Gantt)}
Les différentes tâches s'enchaînent assez naturellement du fait de leur forte dépendance. Le planning initialement prévu que l'on donne ci-après a une forme simple. Le projet en tant que tel démarrera le 1er Février pour une durée de 15 semaine.
\begin{figure}[ht!]
\begin{ganttchart}{1}{15}
    \gantttitle{Du 1er Février au 9 Mai}{15} \\
    \gantttitlelist{1,...,15}{1} \\
    \ganttgroup{Préparation}{1}{3} \\
    \ganttbar{Recherche de ressources}{1}{3} \\
    \ganttbar{Définition des contraintes}{1}{3} \\
    \ganttbar{Recherche de méthode d'archivage}{1}{1} \\
    \ganttlinkedbar{Mise en place archivage}{2}{3} \\
\end{ganttchart}
\caption{Diagramme de Gantt pour le projet SN3D}
\end{figure}
\subsection{Ressources}
Le groupe de travail est constitué de cinq membres : Telem Avidor, Léo En terme d'exécution, il est prévu que tous les membres de l'équipe jouent des rôles interchangeables en fonction de la situation.
\subsection{Communication}
\end{document}

Best Answer

You're missing the textcomp package I think, at least I needed to add that. After adding that and the babel library for TikZ I also had to add braces around the \draw in the \foreach. Not entirely sure why that is that case, but going from

\foreach \value in {1,2,3}
  \draw[->] (c1.195) |- (c1\value.west);

\foreach \value in {1,...,2}
  \draw[->] (c2.195) |- (c2\value.west);

\foreach \value in {1,...,3}
  \draw[->] (c3.195) |- (c3\value.west);

\foreach \value in {1,...,3}
  \draw[->] (c4.195) |- (c4\value.west);

to

\foreach \myvalue in {1,2,3}{
  \draw[->] (c1.195) |- (c1\myvalue.west);
  \draw[->] (c3.195) |- (c3\myvalue.west);
  \draw[->] (c4.195) |- (c4\myvalue.west);
}

\foreach \myvalue in {1,...,2}{
  \draw[->] (c2.195) |- (c2\myvalue.west);
}

solved it.

Using \value may be a bad idea as that is an existing macro. Complete code.

\documentclass[a4paper]{article}
\usepackage[latin1]{inputenc}
\usepackage[T1]{fontenc}
\usepackage[francais]{babel} 
\usepackage{graphicx}
\usepackage{stmaryrd,textcomp}
\usepackage{amssymb}
\usepackage{dsfont}
%Pour les images (gantt, WBS)
\usepackage{tikz}
%Pour délimiter les flottants
\usepackage{placeins}
\usepackage{pgfgantt}

\usetikzlibrary{arrows,backgrounds,calc,patterns,shapes,positioning,shadows,trees,babel}
\usepackage{pgfcalendar}

\tikzset{
  basic/.style  = {draw, text width=2cm, drop shadow, font=\sffamily, rectangle},
  root/.style   = {basic, rounded corners=2pt, thin, align=center,
                   fill=green!30},
  level 2/.style = {basic, rounded corners=6pt, thin,align=center, fill=green!60,
                   text width=8em},
  level 3/.style = {basic, thin, align=left, fill=pink!60, text width=6.5em}
}
\title{Plan de développement}
\author{Groupe PEI n\textsuperscript{o}44 \\ \\ Entreprise SN3D}
\date{le 3 Février 2016}
\begin{document}
\maketitle
\tableofcontents
\newpage
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%                              PARTIE 1                                 %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\section{Définition du projet}
\subsection{Contexte du projet}
\subsection{Objectifs de la mission}
\subsection{Livrables}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%                              PARTIE 2                                 %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\section{Modalités d'exécution}
\subsection{Cycle de vie}
\subsection{Work Breakdown Structure du projet}
L'objectif fixé est de rendre au client un livrable recensant une sélection de capteurs intégrés ou modules assortie de cas d'utilisation précis. \`A cette fin, le travail sera décomposé de la manière suivante : \newline
%%%%%%%%%%% WBS %%%%%%%%%%%%%%%
\FloatBarrier
\begin{figure}[ht!]
%makebox pour centrer les figures trop larges
\makebox[\textwidth][c]{
\begin{tikzpicture}[level 1/.style={sibling distance=40mm},
edge from parent/.style={->,draw},>=latex]
% root of the the initial tree, level 1
\node[root] {Projet SN3D}
% The first level, as children of the initial tree
  child {node[level 2] (c1) {Choix des outils de travail}}
  child {node[level 2] (c2) {Recherche des capteurs}}
  child {node[level 2] (c3) {Définition de cas d'usage}}
    child {node[level 2] (c4) {Synthèse et mise en forme}};

% The second level, relatively positioned nodes
\begin{scope}[every node/.style={level 3}]
\node [below of = c1, xshift=15pt] (c11) {Archivage};
\node [below of = c11] (c12) {Sources};
\node [below of = c12] (c13) {Mise en forme};

\node [below of = c2, xshift=15pt] (c21) {Intensive};
\node [below of = c21] (c22) {Veille};


\node [below of = c3, xshift=15pt] (c31) {Scénari};
\node [below of = c31] (c32) {Aspects techniques};
\node [below of = c32] (c33) {Illustrations};

\node [below of = c4, xshift=15pt] (c41) {Livrable};
\node [below of = c41] (c42) {Rapport};
\node [below of = c42] (c43) {Poster};
\end{scope}

% lines from each level 1 node to every one of its "children"
\foreach \myvalue in {1,2,3}{
  \draw[->] (c1.195) |- (c1\myvalue.west);
  \draw[->] (c3.195) |- (c3\myvalue.west);
  \draw[->] (c4.195) |- (c4\myvalue.west);}

\foreach \myvalue in {1,...,2}{
  \draw[->] (c2.195) |- (c2\myvalue.west);
}
\end{tikzpicture}
}
\caption{WBS du projet}
\end{figure}
\FloatBarrier
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\subsection{Planning (diagramme de Gantt)}
Les différentes tâches s'enchaînent assez naturellement du fait de leur forte dépendance. Le planning initialement prévu que l'on donne ci-après a une forme simple. Le projet en tant que tel démarrera le 1er Février pour une durée de 15 semaine.
\begin{figure}[ht!]
\begin{ganttchart}{1}{15}
    \gantttitle{Du 1er Février au 9 Mai}{15} \\
    \gantttitlelist{1,...,15}{1} \\
    \ganttgroup{Préparation}{1}{3} \\
    \ganttbar{Recherche de ressources}{1}{3} \\
    \ganttbar{Définition des contraintes}{1}{3} \\
    \ganttbar{Recherche de méthode d'archivage}{1}{1} \\
    \ganttlinkedbar{Mise en place archivage}{2}{3} \\
\end{ganttchart}
\caption{Diagramme de Gantt pour le projet SN3D}
\end{figure}
\subsection{Ressources}
Le groupe de travail est constitué de cinq membres : Telem Avidor, Léo En terme d'exécution, il est prévu que tous les membres de l'équipe jouent des rôles interchangeables en fonction de la situation.
\subsection{Communication}
\end{document}
Related Question