Text FormattingGantt chart - borders and heading for task list and spacing in lines

Information and discussion about LaTeX's general text formatting features (e.g. bold, italic, enumerations, ...)
Post Reply
freddybearxx
Posts: 1
Joined: Sat Oct 01, 2022 8:39 pm

Gantt chart - borders and heading for task list and spacing in lines

Post by freddybearxx »

Code: Select all

\documentclass[tikz]{standalone}
    % Uncomment the following line to allow the usage of graphics (.png, .jpg)
    %\usepackage[pdftex]{graphicx}
    % Comment the following line to NOT allow the usage of umlauts
    
    \usepackage{pgfgantt}
    \title{Gantt chart showing PhD activity time lines over four month intervals beyond the confirmation review}
    
    \usepackage{amsfonts}
    
    % Start the document
    \begin{document}
    
    \definecolor{barblue}{RGB}{153,204,254}
    \definecolor{groupblue}{RGB}{51,102,254}
    \definecolor{linkred}{RGB}{165,0,33}
    \renewcommand\sfdefault{phv}
    \renewcommand\mddefault{mc}
    \renewcommand\bfdefault{bc}
    \setganttlinklabel{s-s}{START-TO-START}
    \setganttlinklabel{f-s}{FINISH-TO-START}
    \setganttlinklabel{f-f}{FINISH-TO-FINISH}
    \sffamily
    \begin{ganttchart}[
      [
        canvas/.append style={fill=none, draw=black!5, line width=.75pt},
        hgrid style/.style={*1{draw=black!5, line width=.75pt}},
        vgrid={*1{draw=black!5, line width=.75pt}},
        today=7,
        today rule/.style={
          draw=black!64,
          dash pattern=on 3.5pt off 6.5pt,
          line width=1.5pt
        },
        today label font=\small\bfseries,
        title/.style={draw=none, fill=none},
        title label font=\bfseries\footnotesize,
        title label node/.append style={below=7pt},
        include title in canvas=false,
        bar label font=\mdseries\small\color{black!70},
        bar label node/.append style={left=2cm},
        bar/.append style={draw=none, fill=black!63},
        bar incomplete/.append style={fill=barblue},
        bar progress label font=\mdseries\footnotesize\color{black!70},
        group incomplete/.append style={fill=groupblue},
        group left shift=0,
        group right shift=0,
        group height=.5,
        group peaks tip position=0,
        group label node/.append style={left=.6cm},
        group progress label font=\bfseries\small,
        link/.style={-latex, line width=1.5pt, linkred},
        link label font=\scriptsize\bfseries, 
        link label node/.append style={below left=-2pt and 0pt}
      ]{1}{41}
      \gantttitle[
       ]{QUARTER:\quad1}{2}
      \gantttitle{2022}{12}                        
      \gantttitle{2023}{12}
        \gantttitle{2024}{12} \\  
        \gantttitle{Q3}{4}           
      \gantttitle{Q4}{4}
      \gantttitle{Q1}{4}
      \gantttitle{Q2}{4}
      \gantttitle{Q3}{4}
      \gantttitle{Q4}{4}
      \gantttitle{Q1}{4}
      \gantttitle{Q2}{4}
      \gantttitle{Q3}{4}
      \gantttitle{Q4}{4}
    \\
    
      
      \ganttbar[
        progress=100,
        name=WBS1A
      ]{\textbf{Literature review \& thesis aims clarification }} {1}{4} \\
        \ganttbar[
        progress=100,
        name=WBS1A
      ]{\textbf{To carry out a comprehensive check whether the Lagrangian self-consistently implies the correct physics via its resulting Euler-Lagrange equations}}{3}{5}\\
      \ganttbar[
        progress=100,
        name=WBS1D
      ]{\textbf{to address HAVING IDENITIFIED X XANNOATE SOLUITON HODGE PR SOMEHTIGN  the short-comings of the article in the BOTHEJM/B-paper}}{4}{6} \\
       \ganttbar[
        progress=0,
        name=WBS1C
      ]{\textbf{Paper preperation and submission: Hodge decomposition, suggestion of a Lagrangian and computing the Euler-Lagrange equations}}{6}{8} \\
        \ganttbar[
        progress=100,
        name=WBS1A
      ]{\textbf{To work out a systematic approach based on the second variation technique by which in case of compressible flow a linear acoustic model is obtained straight forwardly from an arbitrary Lagrangian}}{3}{4} \\
      \ganttbar[
        progress=100,
        name=WBS1B
      ]{\textbf{To apply the forementioned approach developed in to our Lagrangian and compare with classical results }}{4}{5} \\
     
       \ganttbar[
        progress=100,
        name=WBS1C
      ]{\textbf{to extend the analysis outlined IN TASK X? to weakly nonlinear acoustic models by amending the second variation technique by cubic terms of the respective Taylor expansion}}{4}{5} \\
      \ganttbar[
        progress=0,
        name=WBS1D
      ]{\textbf{Paper preperation and submission: second variational acoustics- linear (both Lagrangians), non-linear from simple Lagrangian}}{7}{9} \\
       \ganttbar[
        progress=0,
        name=NONLAG
      ]{\textbf{ (expect intermediate results)To apply the approach developed in TASK XX OUR Lagrangian, compare the result with existing models in open literature, and to discuss the physical implications of the result}}{6}{12} \\
      
      \ganttbar[
        progress=0,
        name=REL
      ]{\textbf{Paper preperation and submission: second variational acoustics- linear (both Lagrangians), non-linear from simple Lagrangian}}{10}{14} \\
      
      
    
      
         \ganttbar[
        progress=0,name=POI]{\textbf{
     To work out a stability analysis for a simple flow example (Poiseuille, Couette or film flow) based on the second variation technique with comparison to existing stability results in literature}}{14}{18} \\
    
       
      \ganttbar[
        progress=0,
        name=FEM
      ]{\textbf{to figure out a FEM approach for incompressible flow based on the new Lagrangian (but without implementing a computer code for the latter) for future applications }}{16}{20} \\
    
      \ganttbar[progress=15]{\textbf{Thesis writing / and submission}}{1}{41} \\
       \ganttbar[progress=15]{\textbf{Oral Exam}}{40}{41}
       
    
      \ganttlink[link type=s-s]{POI}{FEM}
     
      %\ganttlink[link type=f-s]{NONLAG}{REL}
      \ganttlink[link type=f-s]{REL}{POI}
     
     
    \end{ganttchart}
    
    \end{document}
[![enter image description here][1]][1]


[1]: https://i.stack.imgur.com/rc5Bb.jpg


1) I would like to have the entire Gantt chart bordered, including the heading quarter and the labels of the Gantt bars.

2) I want to put some of the Gantt bar labels over two lines. \\ does not work.

3) I would like the heading TASKS above the Gantt bar labels.

Thanks

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org

NEW: TikZ book now 40% off at Amazon.com for a short time.

rais
Posts: 419
Joined: Sun Nov 16, 2014 8:51 pm

Gantt chart - borders and heading for task list and spacing in lines

Post by rais »

Hi,
freddybearxx wrote:

Code: Select all

    % Uncomment the following line to allow the usage of graphics (.png, .jpg)
    %\usepackage[pdftex]{graphicx}
is somewhat strange...
  • * pdftex option is rarely necessary these days
    * the tikz package, that's loaded by the pgfgantt package, loads the graphicx package, anyway.
freddybearxx wrote:

Code: Select all

    % Comment the following line to NOT allow the usage of umlauts
    
that's stranger still, because the `following line' is empty.
freddybearxx wrote:

Code: Select all

    \begin{ganttchart}[
      [
that looks suspicious, too...two opening brackets? Whatever for?
freddybearxx wrote: 1) I would like to have the entire Gantt chart bordered, including the heading quarter and the labels of the Gantt bars.
Unless someone who actually knows the pgfgantt package chips in and has a better idea, I suggest to enclose the {ganttchart} environment in a {tikzpicture} environment, then you can use `current bounding box' as reference (see below).
freddybearxx wrote: 2) I want to put some of the Gantt bar labels over two lines. \\ does not work.
Yes. That is mentioned in the pgfgantt documentation: when `newline shortcut' is true (which it is by default), `\\' won't work to split a long line into two.

Code: Select all

\documentclass{standalone}
\usepackage{pgfgantt}
\begin{document}
\begin{tikzpicture}
\begin{ganttchart}[
hgrid,
vgrid,
y unit chart=2cm,
newline shortcut=false,
bar label node/.append style=%
{align=left}
]{1}{6}
\gantttitle{Title}{6} \ganttnewline
\ganttbar{%
This is a\\
multi-line text.%
}{1}{3}
\end{ganttchart}
\draw[blue] (current bounding box.south west) rectangle (current bounding box.north east);
\end{tikzpicture}
\end{document}
KR
Rainer
Post Reply