I have a pretty complex pgfgantt chart. Several people are collaboratively working on it and it is subject to frequent change.
In this chart the individual \ganttbar
items are linked with the \ganttlink
command. The ganttbar items are referred to by elem0, elem1, …, elemn.
To illustrate my problem consider this minimal pgfgantt example:
\begin{ganttchart}{3}{1}
\ganttbar {Task 1}{1}{2} \\
\ganttbar {Task 2}{2}{3} \\
\ganttbar {Task 3}{1}{2} \\
\ganttbar {Task 4}{2}{3}
\ganttlink {elem0}{elem1}
\ganttlink {elem2}{elem3}
\end{ganttchart}
Now lets assume that "Task 2" is removed:
\begin{ganttchart}{3}{1}
\ganttbar {Task 1}{1}{2} \\
\ganttbar {Task 3}{1}{2} \\
\ganttbar {Task 4}{2}{3}
\ganttlink {elem1}{elem2}
\end{ganttchart}
Of course I have to remove \ganttlink {elem0}{elem1}
. However I also have to change all subsequent links as well in order to maintain the correct relationships. In the example above \ganttlink {elem2}{elem3}
had to be changed to \ganttlink {elem1}{elem2}
. In a complex gantt chart this quickly becomes tedious and very error prone .
So my question is: Is it possible to reference a \ganttbar
rather by a custom name than by elemn, e.g. \ganttlink{mytask1}{mytask2}
?
Best Answer
The option
name
toganttbar
allows you to change the name of the element to whatever you want. Use this asand thereafter refer to this element as
myname
.