Gantt
Pour inclure des Gantt LaTeX dans votre pdf, vous pouvez ajouter l'inclusion suivante dans le fichier header.md
- \usepackage{pgfgantt}
Intégrez et utilisez ensuite les commandes LaTeX suivantes pour créer votre diagramme de Gantt
gantt.md
:
<!--
================================================================================
COMMANDS DEFINITION
Available commands:
- \begin{coolGantChart}{start}{end}
Create a new Gantt from start to end indexes.
Thoses indexes are used to generate the gantt bars afterwards
- \end{coolGantChart}
End the gantt chart
- \gantttitle and \gantttitlelist
See Titles section in [pgfgantt documentation](https://texdoc.org/serve/pgfgantt.pdf/0)
- \coolNewGroup{Group title}
Create a group title for the following gantt bars
- \definecolor{actual}{RGB}{68,114,196}
Defines the `actual` color to RGB(68, 114, 196).
The `actual` color is used by default for the coolNewBar command
- \coolNewBar[color]{Bar title}{start_index}{end_index}
Create a gantt bar from start_index to end_index
Color defaults to `actual`
- \coolNewLink[line_count]{from}{to}
Create a link from the `from` bar to the `to` bar
The first bar created in the chart is indexed 0 and it increments for each bar created.
`line_count` correspond to the how much lines are between from and to to make the arrow turns at the right places
- \coolNewRevertLink[1]{1}{2}
Same as \coolNewLink but the turns are centered the opposite way (try it to understand fully)
Are are some nice colors to use for the bars
\definecolor{actual}{RGB}{68,114,196} % Blue
\definecolor{actual}{RGB}{112,173,71} % Light green
\definecolor{actual}{RGB}{255,217,102} % Yellow
\definecolor{actual}{RGB}{255,75,75} % Light red
\definecolor{actual}{RGB}{0,188,208} % Cyan
\definecolor{actual}{RGB}{237,125,49} % Orange
\definecolor{actual}{RGB}{112,48,160} % Purple
================================================================================
-->
\newcounter{test}
\newenvironment{coolGantChart}[2]{
\begin{ganttchart}[
x unit=0.50cm,
group left shift=0,
group top shift=0.4,
group right shift=0,
group height=0.7,
bar height=.5,
group peaks height=.0,
group peaks width=.0,
y unit chart=0.5cm,
y unit title=0.5cm,
title height=0.8
]{#1}{#2}
\setcounter{test}{0}
}{
\end{ganttchart}
}
\makeatletter
\newcommand\removeSpecialCharacters[1]{
\begingroup
\let\c\relax
\renewcommand\add@accent[2]{##2}
#1
\endgroup
}
\makeatother
\newcommand\coolNewBar[4][actual]{
\ganttbar[bar/.append style={fill=#1},name=\thetest]{#2}{#3}{#4}
\stepcounter{test}
}
\newcommand\coolNewGroup[1]{%
\ganttgroup[group/.append style={draw=black}]{#1}{-100}{-100}
}
\newcommand\coolNewLink[3][1]{
\ganttlink[link mid=(1 - 1/(2*#1))]{#2}{#3}
}
\newcommand\coolNewRevertLink[3][1]{
\ganttlink[link mid=(1/(2*#1))]{#2}{#3}
}
<!--
================================================================================
EXAMPLE GANT
================================================================================
-->
\begin{coolGantChart}{1}{36}
\gantttitle{1ère année}{12}\gantttitle{2ème année}{12}\gantttitle{3ème année}{12}\\
\gantttitlelist{1,...,36}{1} \\
\definecolor{actual}{RGB}{68,114,196}
\coolNewGroup{Groupe 1}{1}{36}\\
\coolNewBar{Barre 1}{1}{36}\\
\coolNewBar{Barre 2}{1}{6}\\
\coolNewBar{Barre 3}{7}{13}\\
\coolNewBar{Barre 4}{7}{11}\\
\coolNewLink[1]{1}{2}
\definecolor{actual}{RGB}{112,173,71}
\coolNewGroup{Groupe 2}{1}{12}\\
\coolNewBar{Barre 5}{1}{2}\\
\coolNewBar{Barre 6}{3}{7}\\
\coolNewRevertLink[2]{1}{3}
\coolNewLink[1]{4}{5}
\definecolor{actual}{RGB}{255,217,102}
\coolNewGroup{Groupe 3}{8}{29} \\
\coolNewBar{Barre 7}{12}{15} \\
\coolNewBar{Barre 8}{8}{15}\\
\coolNewBar{Barre 9}{16}{24} \\
\coolNewBar{Barre 10}{23}{29} \\
\coolNewLink[3]{3}{6}
\definecolor{actual}{RGB}{255,75,75}
\coolNewGroup{Groupe 3}{1}{24}l\\
\coolNewBar{Barre 11}{1}{3}
\addtocounter{test}{-1}
\coolNewBar{}{13}{18}\\
\coolNewBar{Barre 12}{3}{7}\\
\coolNewBar{Barre 13}{7}{24}\\
\coolNewBar{Barre 14}{1}{24}\\
\coolNewBar{Barre 15}{5}{11}\\
\coolNewRevertLink[14]{1}{12}
\definecolor{actual}{RGB}{237,125,49}
\coolNewGroup{Groupe 4}{1}{24}\\
\coolNewBar{Barre 16}{1}{8}\\
\coolNewBar{Barre 17}{13}{20}\\
\coolNewBar{Barre 18}{13}{18}\\
\coolNewLink{5}{16}
\coolNewLink[1]{3}{16}
\coolNewLink[1]{3}{17}
\definecolor{actual}{RGB}{112,48,160}
\coolNewGroup{Groupe 5}{1}{16}\\
\coolNewBar{Barre 19}{1}{6}\\
\coolNewBar{Barre 20}{3}{7}\\
\coolNewBar{Barre 21}{8}{10}\\
\coolNewBar{Barre 22}{11}{16}\\
\coolNewLink[2]{18}{20}
\coolNewLink[1]{20}{21}
\coolNewLink[2]{6}{8}
\coolNewLink[1]{7}{8}
\definecolor{actual}{RGB}{0,188,208}
\coolNewGroup{Grouope 6}{1}{13}\\
\coolNewBar{Barre 23}{1}{7}\\
\coolNewBar{Barre 24}{8}{13}\\
\coolNewLink[1]{22}{23}
\end{coolGantChart}