[Tex/LaTex] Different column widths when using multicolumn in tabular enviroment

multicolumntables

I'm trying to recreate this table in latex
table in word

So far I've managed to get this
enter image description here

Using this:

\begin{table}[h]
\begin{table}[h]
\begin{tabular}{|l|l|p{10cm}|}
\hline
\multicolumn{3}{|c|}{\textbf{Daily Log}}\\ \hline
\multicolumn{2}{|l|}{Student Name: My Name} & Student Number: 9999999 \\ \hline
\multicolumn{3}{|l|}{Company Name: A Company Name - Some more text} \\ \hline
Day                     & Date                     & Activities   \\ \hline
1                       & 11/11/13                 & A few sentences of text need to go here for every row from now on\\ \hline
2                       &                          &     \\ \hline
\end{tabular}
\end{table}

But I can't get the Student Number cell to move across without affecting the size of the activities cell. Similarly I want the date cells to be as small as possible but I can't do that because of the size of the student name cell. So really what I guess I'm really asking is, is there a way to change the width of a column on a per row basis?

Best Answer

You can use an inner tabular:

\documentclass{article}


\begin{document}
\begin{table}[h]
\begin{tabular}{|l|l|p{10cm}|}
\hline
\multicolumn{3}{|c|}{\textbf{Daily Log}}\\ \hline
\multicolumn{2}{|l}{Student Name: My Name} &            %% note |l
 %% from here
  \multicolumn{1}{l|}{\begin{tabular}[t]{p{1in}|l}      %% adjust 1in as you like
     & Student Number: 9999999 
     \end{tabular}}\\\hline
 %% till here
\multicolumn{3}{|l|}{Company Name: A Company Name - Some more text} \\ \hline
Day                     & Date                     & Activities   \\ \hline
1                       & 11/11/13                 & A few sentences of text need to go here for every row from now on\\ \hline
2                       &                          &     \\ \hline
\end{tabular}%
\end{table}
\end{document}

enter image description here

I get bad box as your table is too wide. Hope in your real document, you have adjusted this properly.

Related Question