
With the help of \newcolumntype{L}{>{\raggedright\arraybackslash}X}
in defined a new column type L
. This column type is based on the X
type, but its contents are left aligned instead of justified. (See also: How to create fixed width table columns with text raggedright/centered/raggedleft?)
In order to get the correct width for the \multicolumn
cells, I used >{\hsize=\dimexpr3\hsize+4\tabcolsep+2\arrayrulewidth}L
. Since the \multicolumn
cell spans 3 L
(or X
) columns, we can start with >{\hsize=3\hsize}L
(See also: Table layout with tabularx (column widths: 50%|25%|25%)). To this, we then add 4\tabcolsep
(\tabcolsep
is the small amount of horizontal white space that is added to either side of the text inside of a table cell) as well as 2\arrayrulewidth
(\arrayrulewidth
is the width of the vertical lines in the table.)
\documentclass{article}
\usepackage{tabularx}
\newcolumntype{L}{>{\raggedright\arraybackslash}X}
\begin{document}
\begin{table}
\begin{tabularx}{\linewidth}{|l|L|L|L|L|}
\hline
Activity & \multicolumn{2}{c|}{1st year} & \multicolumn{2}{c|}{2nd year} \\ \cline{2-5}
& 1st semester & 2nd semester & 1st semester & 2nd semester \\
\hline
I. & Perform some experiment, do some calculations, write a report and present the results in a conference.
& & &\\ \hline
II. & \multicolumn{3}{>{\hsize=\dimexpr3\hsize+4\tabcolsep+2\arrayrulewidth}L|}{Perform some experiment, do some calculations, write a report and present the results in a conference.}
& \\ \hline
III. & & \multicolumn{3}{>{\hsize=\dimexpr3\hsize+4\tabcolsep+2\arrayrulewidth}L|}{Perform some experiment, do some calculations, write a report and present the results in a conference.} \\
\hline
\end{tabularx}
\end{table}
\end{document}
Here is an entirely different approach based on the pgfgantt
package:

\documentclass{article}
\usepackage{pgfgantt}
\begin{document}
\noindent
\begin{ganttchart}[
y unit title=0.5cm,
y unit chart=1.25cm,
x unit =1.75cm,
vgrid,hgrid,
title height=1,
title label font=\footnotesize,
bar height=0.5,
group right shift=0,
group top shift=0.7,
bar label node/.style={text width=4.75cm,
align=right,
anchor=east,
font=\footnotesize\raggedleft}
]{1}{4}
\gantttitle{1st year}{2}
\gantttitle{2nd year}{2} \\
\gantttitle{1st semester}{1}
\gantttitle{2st semester}{1}
\gantttitle{1st semester}{1}
\gantttitle{2st semester}{1}\\
\ganttbar{Perform some experiment, do some calculations, write a report and present the results in a conference.}{1}{1}\\
\ganttbar{Perform some experiment, do some calculations, write a report and present the results in a conference.}{1}{3}\\
\ganttbar{Perform some experiment, do some calculations, write a report and present the results in a conference.}{2}{4}
\end{ganttchart}
\end{document}
booktabs
package are intended to be used without vertical lines. This is thereason for the small gaps in the vertical lines around the intersections.