GeneralOne more Year in Research Proposal Timeline

LaTeX specific issues not fitting into one of the other forums of this category.
Post Reply
mayankmi
Posts: 45
Joined: Sat Apr 20, 2013 7:52 pm

One more Year in Research Proposal Timeline

Post by mayankmi »

Dear LaTeX Users,

I want to do two things. One is to add one more year i.e. 2016 in research time line and another 2013 should start from September instead of January.

Code: Select all

\documentclass[a4paper]{article}
\usepackage[square, numbers, comma, sort & compress]{natbib}
\usepackage[table]{xcolor}
\usepackage{multirow}
\usepackage{rotating}

\newcommand*\MonthLetters{JFMAMJJASOND}
\newcommand*\NumMonths{27}
\newcommand*\YearMonths{12,12,3,}
\newcommand*\FirstYear{2013}

\makeatletter
\newcommand*\YearHeadRow{%
  \expandafter\TL@year@head\number\numexpr\FirstYear\expandafter\relax\expandafter\@nil\YearMonths\@nil
}
\def\TL@year@head#1\@nil#2,#3\@nil{%
  &\multicolumn{#2}{c|}{#1}%
  \ifx\\#3\\\else
    \TL@after@fi\TL@year@head\number\numexpr#1+1\relax\@nil#3\@nil
  \fi
}
\newcommand*\YearMonthSep[1]{%
  \cline{\numexpr#1+1\relax-\numexpr#1+\NumMonths\relax}%
}
\newcommand*\MonthHeadRow{%
  \expandafter\TL@month@head\expandafter\@ne\expandafter\@nil\MonthLetters\@nil
}
\def\TL@month@head#1\@nil#2#3\@nil{%
  &#2%
  \ifnum\NumMonths>#1 %
    \TL@after@fi\TL@month@head\number\numexpr#1+1\relax\@nil#3#2\@nil
  \fi
}
\newcount\TL@block@first
\newcount\TL@block@last
\newcommand*\NewBlock[3]{%
  \xglobal\colorlet{TL@block}{#1}%
  \global\TL@block@first\numexpr#2-1\relax
  \global\TL@block@last\numexpr#3+1\relax
  \ignorespaces
}
\newcounter{TL@group}
\newcounter{TL@task}[TL@group]
\renewcommand*\theTL@task{\theTL@group.\arabic{TL@task}}
  \newcommand*\Task[1]{%
  \stepcounter{TL@task}%
  \theTL@task&#1%
  \TL@cell\@ne
  \\\hline
}
\newcommand*\NewGroup{%
  \stepcounter{TL@group}%
}
\def\TL@cell#1{%
  &%
  \ifnum#1>\TL@block@first
    \ifnum#1<\TL@block@last
      \cellcolor{TL@block}%
    \fi
  \fi
  \ifnum\NumMonths>#1 %
    \expandafter\TL@cell\expandafter{\number\numexpr#1+1\expandafter}%
  \fi
}
\def\TL@after@fi#1\fi{\fi#1}
\makeatother

\begin{document}
  \setlength\tabcolsep{1pt}
  \begin{table}
    \caption{Proposed Reseacrh Timeline}
    \label{minetimeline}
    \begin{tabular}{|c|p{120pt}|*{\NumMonths}{c|}} \hline
      \multirow{2}{*}{\#} & \multirow{2}{*}{Tasks} \YearHeadRow \\
      \YearMonthSep{2}
      & \MonthHeadRow \\ \hline     
      %%%%%%%%%%%% 
      \NewGroup
      \NewBlock{blue}{1}{\NumMonths}
      \Task{Literature Review}
      %%%%%%   1  %%%%%%%
      \NewGroup
      \NewBlock{yellow}{1}{2}
      \Task{Confirmation Exam}
      %%%%%%   6   %%%%%%% 4
      \NewGroup
      \NewBlock{gray}{3}{5}
      \Task{PIV setup}
      \Task{PIV on $c/t = 7$ with \& without splitter plate}
      \NewBlock{gray}{5}{6}
      \Task{PIV data analysis \& comparison}
      \Task{Explanation of Feedback Loop}
      %%%%%%   10    %%%%%%% 5
      \NewGroup
      \NewBlock{green}{7}{9}
      \Task{LDV construction of c/t vs St; $c/t = 3-12$}
      \Task{LDV results analysis}
      \NewBlock{green}{5}{12}
      \Task{PIV experiment on $c/t = 8-9$ and construction}
      \Task{LDV \& PIV data analyze \& comparison}
      \Task{Stepwise variation explanation}
%      \Row{Publication 01}
      %%%%%%     8    %%%%%%% 3
      \NewGroup
      \NewBlock{orange}{7}{12}
      \Task{Construction of plates with different geometries}
      \NewBlock{orange}{12}{15}
      \Task{PIV on square edges with \& without splitter, aerofoil leading-square trailing edge with \& without splitter}
      \NewBlock{orange}{15}{16}
      \Task{PIV data analyze and comparison}
%      \Row{Publication 02}
      %%%%%%%   7    %%%%%%  3
      \NewGroup
      \NewBlock{blue}{17}{18}
      \Task{PIV with global oscillation with \& without perturbation}
      \NewBlock{blue}{18}{20}
      \Task{PIV with separate perturbation on aerofoil leading edge \& aerofoil trailing edge}
      \Task{Perturbation data analyze and comparison}
%      \Row{Publication 03}
      %%%%%%%%%%     4     %%%%%%%%%%%    2
      \NewGroup
      \NewBlock{green}{15}{21}
      \Task{Pressure probe construction}
      \NewBlock{green}{20}{22}
      \Task{Pressure measurement on $c/t$ = 7 with \& without splitter plate}
      \Task{Pressure data analyze}
%      \Row{Publication 04} 
      %%%%%%%%%    1     %%%%%%%%%%%%
      \NewGroup
      \NewBlock{red}{18}{27}
      \Task{Thesis writing}
    \end{tabular}
  \end{table}
\end{document}
I tried couple of things but it showed error again and again.

Recommended reading 2024:

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

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

cgnieder
Site Moderator
Posts: 2000
Joined: Sat Apr 16, 2011 7:27 pm

One more Year in Research Proposal Timeline

Post by cgnieder »

You simply need to modify the following commands to suit your needs:

Code: Select all

\newcommand*\MonthLetters{JFMAMJJASOND}
\newcommand*\NumMonths{27}
\newcommand*\YearMonths{12,12,3,}
\newcommand*\FirstYear{2013}
It's important that the list in \YearMonths ends with a comma (one could fix this in the code but it is working so I didn't bother...):

Code: Select all

% make sure the table still fits on the page:
\usepackage[margin=1.5cm]{geometry}

% the `MonthLetters' start with S (september):
\newcommand*\MonthLetters{SONDJFMAMJJ}
% that makes forty months until the end of 2016 ...
\newcommand*\NumMonths{40}
% ... namely 4 for 2013 and 12 for the subsequent ones ...
\newcommand*\YearMonths{4,12,12,12,}
% ... and the first year still being 2013:
\newcommand*\FirstYear{2013}
Regards
site moderator & package author
mayankmi
Posts: 45
Joined: Sat Apr 20, 2013 7:52 pm

One more Year in Research Proposal Timeline

Post by mayankmi »

That's awesome! Thank you very much. It's working fine. I modified my PhD proposal ... :D

... plus just a small change.

Code: Select all

% the `MonthLetters' start with S (september):
\newcommand*\MonthLetters{SONDJFMAMJJ}
% that makes forty months until the end of 2016 ...
needs to be modified to

Code: Select all

% the `MonthLetters' start with S (september):
\newcommand*\MonthLetters{SONDJFMAMJJA}
% that makes forty months until the end of 2016 ...
You forgot August.
Kanchana
Posts: 1
Joined: Fri Nov 08, 2013 3:17 am

Re: One more Year in Research Proposal Timeline

Post by Kanchana »

In your timeline programme, I need to delete the number row. How do I do this?

Thanks.
kanchana
richrr
Posts: 1
Joined: Sat Aug 30, 2014 5:59 pm

Re: One more Year in Research Proposal Timeline

Post by richrr »

Hi,

Can you please help me with the following:
* the column width for the months is size of the first letter, hence not same width. How can I make it same width for all months, i.e. the size of the column with month needing max width?

Your help is really appreciated.

Thanks.
Post Reply