6

I am trying to compile a tex file that should display a gantt chart made with the help of the pgfgantt package.

During compilation I get the line Loading MPS to PDF converter (version 2006.09.02) and afterwards tex seems to stop compiling (even though it is still in compiling mode). My code is a slight alteration of what some other user poster here: Gantt chart package

For clarification: I want to have more than one bar in the same task line. I want to indicate a repeating task.

This my code:

\documentclass{article}
\usepackage{pgfgantt}
\begin{document}

\begin{figure}[ftbp]
\begin{center}

\begin{ganttchart}[y unit title=0.4cm,
y unit chart=0.5cm,
vgrid,hgrid, 
title label anchor/.style={below=-1.6ex},
title left shift=.05,
title right shift=-.05,
title height=1,
bar/.style={fill=gray!50},
incomplete/.style={fill=white},
progress label text={},
bar height=0.7,
group right shift=0,
group top shift=.6,
group height=.3,
group peaks={}{}{.2}]{24}
%labels
\gantttitle{Work Plan}{24}\\
\gantttitle{Year 1}{4} 
\gantttitle{Year 2}{4} 
\gantttitle{Year 3}{4} 
\gantttitle{Year 4}{4} 
\gantttitle{Year 5}{4} 
\gantttitle{Year 6}{4}\\
%tasks
\ganttbar{Task9}{1}{2}
\ganttbar{}{5} \\
\ganttbar{Task8}{2}
\ganttbar{}{4}
\ganttbar{}{6}
\ganttbar{}{8} 
\ganttbar{}{10}
\ganttbar{}{12}
\ganttbar{}{14}
\ganttbar{}{16}
\ganttbar{}{18}
\ganttbar{}{20}\\
\ganttbar{Task7}{7} \\
\ganttbar{Task6}{8}
\ganttbar{}{16}
\ganttbar{}{20} \\
\ganttbar{Task5}{9}{10} \\
\ganttbar{Task4}{15}
\ganttbar{19} \\
\ganttbar{Task3}{17}{18} \\
\ganttbar{Task2}{19}{24}\\
\ganttbar{Task1}{21}{23}


\end{ganttchart}
\end{center}
\caption{Gantt Chart}
\end{figure}

\end{document}

Thanks for any help!

Moriambar
  • 11,466

1 Answers1

3

Before it looped you would have had the error message

! Use of \\ganttbar doesn't match its definition.

It is best not to ignore TeX errors, the default recovery usually does something wrong.

\gantbar takes three arguments and in most cases you only gave it two. This runs without error although I made up the numbers. There is no f option for floats so I removed that as well.

\documentclass{article}
\usepackage{pgfgantt}
\begin{document}

\begin{figure}[tbp]
\begin{center}

\begin{ganttchart}[y unit title=0.4cm,
y unit chart=0.5cm,
vgrid,hgrid, 
title label anchor/.style={below=-1.6ex},
title left shift=.05,
title right shift=-.05,
title height=1,
bar/.style={fill=gray!50},
incomplete/.style={fill=white},
progress label text={},
bar height=0.7,
group right shift=0,
group top shift=.6,
group height=.3,
group peaks={}{}{.2}]{24}
%labels
\gantttitle{Work Plan}{24}\\
\gantttitle{Year 1}{4} 
\gantttitle{Year 2}{4} 
\gantttitle{Year 3}{4} 
\gantttitle{Year 4}{4} 
\gantttitle{Year 5}{4} 
\gantttitle{Year 6}{4}\\
%tasks
\ganttbar{Task9}{1}{2}
\ganttbar{}{4}{5} \\
\ganttbar{Task8}{1}{2}
\ganttbar{}{2}{4}
\ganttbar{}{5}{6}
\ganttbar{}{7}{8} 
\ganttbar{}{9}{10}
\ganttbar{}{11}{12}
\ganttbar{}{13}{14}
\ganttbar{}{15}{16}
\ganttbar{}{17}{18}
\ganttbar{}{19}{20}\\
\ganttbar{Task7}{6}{7} \\
\ganttbar{Task6}{7}{8}
\ganttbar{}{15}{16}
\ganttbar{}{19}{20} \\
\ganttbar{Task5}{9}{10} \\
\ganttbar{Task4}{14}{15}
\ganttbar{19}{19}{19} \\
\ganttbar{Task3}{17}{18} \\
\ganttbar{Task2}{19}{24}\\
\ganttbar{Task1}{21}{23}\\
\end{ganttchart}
\end{center}
\caption{Gantt Chart}
\end{figure}

\end{document}
Moriambar
  • 11,466
David Carlisle
  • 757,742