4

I use pgfgantt to draw a Gantt chart for my PhD proposal. Is there any way to insert other symbols than diamonds for creating milestones?

It would be great to have symbols like letters, smileys, floppy disks etc.

Hendrik
  • 133

1 Answers1

6

If you look at pgfgantt documentation will see that a milestone is not just a symbol but a pgfshape. Therefore you need to replace it with another shape.

But luckily, Alain Matthes wrote a shapes.emoticon library in his answer to Something between \frownie and \smiley. Once you have the file tikzlibraryshapes.emoticon.code.tex in your working folder, you'll be able to do something like:

\documentclass[tikz,border=2mm]{standalone}
\usepackage{pgfgantt}
\usetikzlibrary{shapes.emoticon}

\begin{document}
\begin{ganttchart}[
vgrid,
hgrid,
milestone/.append style={shape=emoticon happy,fill=yellow}
]{1}{12}
\gantttitle{Title}{12} \\
\ganttbar{Task 1}{1}{4} \\
\ganttlinkedbar{Task 2}{5}{6} \\
\ganttlinkedmilestone{M 1}{6} \\
\ganttlinkedbar{Task 3}{7}{11}
\end{ganttchart}
\end{document}

enter image description here

I could be wrong, but the only way I've found to use some other symbols as milestone is through milestone labels. With inline option, all labels for ganttbars and milestones are written on its corresponding element and not on then left side.

This solution is not very flexible, because it affects all labels, not only milestones and, even worse, different symbols have different sizes, baselines, margins, etc. Therefore, you'll have to adjust each particular symbols to your taste.

Next follows an example with \Letter (from ifsym).

\documentclass[tikz,border=2mm]{standalone}
\usepackage{pgfgantt}
\usepackage[misc]{ifsym}
\usetikzlibrary{shapes.emoticon}

\begin{document}
\begin{ganttchart}[
vgrid,
hgrid,
inline,
milestone/.append style={shape=rectangle,draw=none, fill=none},
milestone inline label anchor=south,
milestone label text={\Letter}
]{1}{12}
\gantttitle{Title \Letter}{12} \\
\ganttbar{Task 1}{1}{4} \\
\ganttlinkedbar{Task 2}{5}{6} \\
\ganttlinkedmilestone{M 1}{6} \\
\ganttlinkedbar{Task 3}{7}{11}
\end{ganttchart}
\end{document}

enter image description here

Ignasi
  • 136,588