2

I had asked a similar question earlier today; thank you all who gave me answers. Since my question was limited to the first 3 rows of the table, I got stuck while writing the code for the other rows, as the row and column style changes. As it is taking me a lot of time, I request you to help me produce the table as shown in the photo (either the left or the right, whichever possible).

The texts in the last 2 columns are sample texts; the actual text is long. So the table will be about 3 pages.

Below is a sample working code:

enter image description here

\begin{table}[htbp]
  \centering
  \caption{Add caption}
    \begin{tabular}{|l|p{6.72em}|p{15.335em}|l|}
    \toprule
    \multicolumn{2}{|c|}{\textbf{RIBA Work Stage}} & \multicolumn{1}{c|}{\textbf{Description of Key Tasks}} & \multicolumn{1}{c|}{\textbf{Core BIM Activities}} \\
    \midrule
    \multicolumn{1}{|c|}{\multirow{2}[4]{*}{\begin{sideways}\textbf{Preparation}\end{sideways}}} & \multicolumn{1}{c|}{\textbf{Appraisal}} & Task desciption for Appraisal & \multicolumn{1}{l|}{\multirow{2}[4]{*}{• BIM Activity 1\newline{}• BIM Activity 2\newline{}• Data drop 1}} \\
\cmidrule{2-3}          & \multicolumn{1}{c|}{\textbf{Design Brief}} & Task desciption for Design Brief &  \\
    \midrule
    \multicolumn{1}{|c|}{\multirow{3}[6]{*}{\begin{sideways}\textbf{Design}\end{sideways}}} & \multicolumn{1}{c|}{\textbf{Concept}} & Task desciption for Concept & \multicolumn{1}{p{11.665em}|}{• BIM Activity 1\newline{}• BIM Activity 2\newline{}• Data drop 2} \\
\cmidrule{2-4}          & \textbf{Design Development} & Task desciption for Design Development & \multicolumn{1}{l|}{\multirow{2}[4]{*}{• BIM Activity 1\newline{}• BIM Activity 2\newline{}• Data drop 3}} \\
\cmidrule{2-3}          & \textbf{Technical Design} & Task desciption for Technical Design &  \\
    \midrule
    \multicolumn{1}{|c|}{\multirow{3}[6]{*}{\begin{sideways}\textbf{Pre-Construction}\end{sideways}}} & \textbf{Production Information} & Task desciption for Production Information & \multicolumn{1}{l|}{\multirow{3}[6]{*}{• BIM Activity 1\newline{}• BIM Activity 2\newline{}• Data drop 4}} \\
\cmidrule{2-3}          & \textbf{Tender Documentation} & Task desciption for Tender Documentation &  \\
\cmidrule{2-3}          & \textbf{Tender Action} & Task desciption for Tender Action &  \\
    \midrule
    \multicolumn{1}{|c|}{\multirow{2}[4]{*}{\begin{sideways}\textbf{Construction}\end{sideways}}} & \multicolumn{1}{c|}{\textbf{Mobilisation}} & \multicolumn{1}{l|}{Task desciption for Mobilisation} & \multicolumn{1}{l|}{\multirow{2}[4]{*}{• BIM Activity 1\newline{}• BIM Activity 2\newline{}• Data drop 5}} \\
\cmidrule{2-3}          & \textbf{Construction to Practical Completion} & Task desciption for Construction to Practical Completion &  \\
    \midrule
    \begin{sideways}\textbf{Use}\end{sideways} & \textbf{Post Practical Completion} & Task desciption for Post Practical Completion & \multicolumn{1}{l|}{\multirow{2}[4]{*}{• BIM Activity 1\newline{}• BIM Activity 2\newline{}• Data drop 6}} \\
\cmidrule{1-3}    \begin{sideways}\textbf{R \& D}\end{sideways} & \textbf{Model Maintenance \& Development} & Task desciption for Model Maintenance \& Development &  \\
    \bottomrule
    \end{tabular}%
  \label{tab:addlabel}%
\end{table}%
1
  • Did you try to implement any of the suggestions on you previous question into the code shown in this question? I suppose "task description for..." is just some placeholder text. With this kind of table layout, the code you need quite much depends on the length of the actual text, so while it might work and look good with the placeholders, you will get a totally different output if you insert your real texts.
    – leandriis
    Commented Jan 6, 2020 at 20:38

2 Answers 2

3

It is possible to use the code from my previous answer in an multi page table. Just change the outer table to longtable instead of tabular, and define heading and first heading as described in the manual. However, be aware that since I use nested tabular to split cells, a page break will be between what I have called sections, i.e. it may move up to three rows. If the text inside the section is long, you may end up with lot of white space at the bottom of the page.

I succeeded in getting at better alignment in total, but had to give up (at least temporarily) vertical centring of the text in row 2. The first rotated text sticks into the row above, but I assume you will add more text, so this will cure itself. If not, just remove the \raisebox, i.e. use:

\rotatebox[origin=c]{90}{Preparation} 

I have further updated and streamlined the code, but it is still pretty complicated, because of the switches between two and three columns and rows several times. Also, I defined some new column type to make the tabular preambles more readable.

NB! When you fill in more text, you have to manually adjust the vertical alignment of the rotated text in the first column:

 \raisebox{0pt}[0pt][0pt]{\rotatebox[origin=c]{90}{Preparation}} & 
 \multicolumn{2}{c}{\begin{tabular}[t]{@{}>{\bfseries}MZ@{}}

You increase the value of the first parameter in the \raisebox{0pt} until it fits. As you will see, it survive a pagebreak pretty well if you are careful.

enter image description hereenter image description here

\documentclass{article}
\usepackage{array, booktabs, longtable}
\usepackage{enumitem}
\usepackage{array}
\usepackage{rotating}
\usepackage{geometry}

\newcolumntype{N}{>{\bfseries}p{0.3cm}}
\newcolumntype{M}{>{\raggedright}p{3cm}}
\newcolumntype{Z}{p{4.75cm}}
\newcolumntype{L}{p{5cm}}

\begin{document}

\begin{longtable}{@{}NMZL@{}}
\caption{Add caption\label{tab:addlabeladd}}\\
\toprule
&
\small\bfseries RIBA Work Stage &
\small\bfseries Description of Key Tasks &
\small\bfseries Core BIM Activities\\ \midrule
\endfirsthead

%\toprule
%&
%\small\bfseries RIBA Work Stage &
%\small\bfseries Description of Key Tasks &
%\small\bfseries Core BIM Activities\\ \midrule
\midrule
\endhead


%%% Section 1
\raisebox{0pt}[0pt][0pt]{\rotatebox[origin=c]{90}{Preparation}} & 
\multicolumn{2}{c}{\begin{tabular}[t]{@{}>{\bfseries}MZ@{}}
    Appraisal &
    Task desciption for Appraisal\\ \midrule
    Design Brief &
    Task desciption for Design Brief.\\
\end{tabular}}&
\begin{minipage}[t]{5cm}
    \begin{itemize}[labelsep=*, leftmargin=*, nosep]
    \item BIM Activity 1
    \item BIM Activity 2
    \item Data drop 1
    \end{itemize}
\end{minipage}\\
\midrule

%%% Section 2A
& 
\textbf{Concept} &
Task desciption for Concept
&
\begin{minipage}[t]{\hsize}
    \begin{itemize}[labelsep=*, leftmargin=*, nosep]
    \item BIM Activity 1. Here we add some text. And event more text, and more.
    \item BIM Activity 2. Here we add some text. And event more text, and more.
    \item BIM Activity 3. Here we add some text. And event more text, and more.
    \item Data drop 2
    \end{itemize}
\end{minipage}\\\cmidrule{2-3}
%%% Section 2B
\raisebox{\normalbaselineskip}[0pt][0pt]{\rotatebox[origin=c]{90}{Design}} & 
\multicolumn{2}{c}{\begin{tabular}[t]{@{}>{\bfseries}MZ@{}}
    Design Development &
    Task desciption for Design Development \\ \midrule
    Technical Design &
    Task desciption for Technical Design \\
\end{tabular}}&
\begin{minipage}[t]{\hsize}
    \begin{itemize}[labelsep=*, leftmargin=*, nosep]
    \item BIM Activity 1
    \item BIM Activity 2
    \item Data drop 3
    \end{itemize}
\end{minipage}\\
\midrule

%%% Section 3
\raisebox{-50pt}[0pt][0pt]{\rotatebox[origin=c]{90}{\mbox{Pre-Construction}}}
& 
\multicolumn{2}{c}{\begin{tabular}[t]{@{}>{\bfseries}MZ@{}}
    Production Information &
    Task desciption for Production Information \\ \midrule
    Tender Documentation&
    Task desciption for Tender Documentation\\ \midrule
    Tender Action &
    Task desciption for Tender Action \\
\end{tabular}}&
\begin{minipage}[t]{\hsize}
    \begin{itemize}[labelsep=*, leftmargin=*, nosep]
    \item BIM Activity 1. Here we add some text. And event more text, and more.
    \item BIM Activity 2. Here we add some text. And event more text, and more.
    \item BIM Activity 3. Here we add some text. And event more text, and more.
    \item Data drop 4
    \end{itemize}
\end{minipage}\\
\midrule

%%% Section 4
\raisebox{-50pt}[0pt][0pt]{\rotatebox[origin=c]{90}{Construction}} & 
\multicolumn{2}{@{}c@{}}{\begin{tabular}[t]{@{}>{\bfseries}MZ@{}}
    Mobilisation &
    Task desciption for Mobilisation \\ \midrule
    Construction to Practical  Completion&
    Task desciption for Construction to Practical  Completion\\
\end{tabular}}&
\begin{minipage}[t]{\hsize}
    \begin{itemize}[labelsep=*, leftmargin=*, nosep]
    \item BIM Activity 1. Here we add some text. And event more text, and more.
    \item BIM Activity 2. Here we add some text. And event more text, and more.
    \item BIM Activity 3. Here we add some text. And event more text, and more.
    \item Data drop 5
    \end{itemize}
\end{minipage}\\
\midrule

%%% Section 5
\multicolumn{3}{@{}c@{}}{\begin{tabular}[t]{@{}N>{\bfseries}MZ@{}}
\raisebox{-5pt}[0pt][0pt]{\rotatebox[origin=c]{90}{Use}} & 
    Practical  Completion &
    Task desciption for Practical  Completion \\ \midrule
\raisebox{-15pt}[0pt][0pt]{\rotatebox[origin=c]{90}{R\&D}} & 
    Model Maintenance \& Developement&
    Task desciption for Model Maintenance \& Developement\\
\end{tabular}}&

\begin{minipage}[t]{\hsize}
    \begin{itemize}[labelsep=*, leftmargin=*, nosep]
    \item BIM Activity 1. Here we add some text. And event more text, and more.
    \item BIM Activity 2. Here we add some text. And event more text, and more.
    \item Data drop 6
    \end{itemize}
\end{minipage}\\
\midrule

\end{longtable}%

\end{document}
9
  • Yes that is exactly what I did. If the style were the same for the others, I would just use the same code and edit the contents, but as you can see in the above photo it is not the the same; I got errors. Thanks for your time. Commented Jan 6, 2020 at 21:28
  • @FaiselMoh'dMuktar See updated code, which should work as you have said you are searching for. Tables in LaTeX is complicated, in particular those you are asking for, so you have to study the examples and read manual. Do not changes to much at once. Make minor changes, compile an study the result and any error messages. Then continue.
    – Sveinung
    Commented Jan 7, 2020 at 0:02
  • I have incorporated my actual table contents into the updated code you provided me. It is working. Thank you very much for your time and valuable support. The table, however, starts in a new page jumping half a page where I wanted the table to start. Is there a way to force it to start from there? Commented Jan 7, 2020 at 1:50
  • Is there also a way to avoid the repeating table heading in your updated code? Commented Jan 7, 2020 at 1:58
  • @FaiselMoh'dMuktar Read the documentation! Just comment of or delete the second heading !
    – Sveinung
    Commented Jan 7, 2020 at 6:12
2

I would redesign your table on basis of my answer to your previous question. in comparison to it I would repalce tabularx with xltabular and contents of the first column move into new rows:

\documentclass{article}
\usepackage{ragged2e}
\usepackage{booktabs, makecell, multirow, xltabular}
\renewcommand\theadfont{\bfseries}
\renewcommand\theadgape{}
\newcolumntype{R}{>{\RaggedRight}X}
\newcommand\mcc[1]{\multicolumn{3}{c}{\emph{#1}}}
\usepackage{enumitem}

\begin{document}
    \begingroup
\setlist[itemize]{nosep, wide,
                  before=\vspace{-\baselineskip},
                  after=\vspace{-\baselineskip}
                  }
\begin{xltabular}{\linewidth}{@{} >{\small\bfseries%
                                    \raggedright\arraybackslash%
                                    \hsize=0.5\hsize}X
                                  >{\hsize=0.8\hsize}R
                                  >{\hsize=0.7\hsize}R
                              @{}}
% table preamble
\caption{Add caption}
\label{tab:addlabel}                        \\
    \toprule
\thead{RIBA\\ Work Stage}
    &   \thead{Description of\\ Key Tasks}
        &   \thead{Core BIM\\Activities}    \\
    \midrule
\endfirsthead
\caption[]{Add caption (cont.)}                       \\
    \toprule
\thead{RIBA\\ Work Stage}
    &   \thead{Description of\\ Key Tasks}
        &   \thead{Core BIM\\Activities}    \\
    \midrule
\endhead
\multicolumn{3}{r}{\footnotesize\textit{continue on the next page}}\\*
\endfoot
    \bottomrule
\endlastfoot
% table body
    \mcc{Preparation}                       \\
    \cmidrule{1-3}
Appraisal
    &   Task desciption for Appraisal 
        &   \multirow{2}{=}{%
            \begin{itemize}
        \item   BIM Activity 1
        \item   BIM Activity 2
        \item   Data drop 1
            \end{itemize}   }       \\
    \addlinespace[6pt]          
Design Brief
    &   Task desciption for Design Brief 
         &                           \\
    \midrule
    \mcc{Design}                    \\
    \cmidrule{1-3}
Concept
    &   Task desciption for Concept
        \vspace{2\baselineskip}
        &   \multirow{2}{=}{%
            \begin{itemize}
        \item   BIM Activity 1
        \item   BIM Activity 2
        \item   Data drop 2
            \end{itemize}   }       \\
    \addlinespace[6pt]
Design Development
    & Task desciption for Design Development
        &   \multirow{2}{=}{%
            \begin{itemize}
        \item   BIM Activity 1
        \item   BIM Activity 2
        \item   Data drop 3
            \end{itemize}   }       \\
    \addlinespace[6pt]
Technical Design
    & Task desciption for Technical Design 
        &                           \\
    \midrule
    \mcc{Pre-Construction}          \\
    \cmidrule{1-3}
 Production Information
    & Task desciption for Production Information 
        &   \multirow{2}{=}{%
            \begin{itemize}
        \item   BIM Activity 1
        \item   BIM Activity 2
        \item   Data drop 4
            \end{itemize}   }       \\
    \addlinespace[6pt]
Tender Documentation
    & Task desciption for Tender Documentation 
        &                           \\
Tender Action
    & Task desciption for Tender Action 
        &                           \\
    \midrule
    \mcc{Construction}              \\
    \cmidrule{1-3}
Mobilisation
    &   Task desciption for Mobilisation
        &   \multirow{2}{=}{%
            \begin{itemize}
        \item   BIM Activity 1
        \item   BIM Activity 2
        \item   Data drop 5
            \end{itemize}   }       \\
    \addlinespace
Construction to Practical Completion
    &   Task desciption for Construction to Practical Completion 
        &                           \\
    \midrule
    \mcc{Use}                       \\
    \cmidrule{1-3}
Post Practical Completion
    &   Task desciption for Post Practical Completion 
        \vspace{1\baselineskip}
        &   \multirow{2}{=}{%
            \begin{itemize}
        \item   BIM Activity 1
        \item   BIM Activity 2
        \item   Data drop 6
            \end{itemize}   }       \\
    \midrule
\pagebreak  \\
    \mcc{R \& D}                    \\
    \cmidrule{1-3}
Model Maintenance \& Development
    & Task desciption for Model Maintenance \& Development 
        &                           \\
\end{xltabular} 
    \endgroup
\end{document}

In above MWE you can see, that to some cells are added \vspace{...\baselineskip}. With this is increase height this cell when it is smaller then height of multi row cells in the next column, which containing itemize list. With this is disable protruding list into the next row.

enter image description here

enter image description here

6
  • Thank you very much for you support. Commented Jan 7, 2020 at 1:50
  • @Zarko Remember that booktabs has a bug so you cannot use boolktabs in tabular if xltabular is loaded.
    – Sveinung
    Commented Jan 7, 2020 at 6:23
  • @Sveinung, hm, I'm not aware that it has a bug. Is it somewhere reported/described? In my MWE works fine (I didn't notice any warnings or errors).
    – Zarko
    Commented Jan 7, 2020 at 7:54
  • @Zarko Here: tex.stackexchange.com/q/522920/9632
    – Sveinung
    Commented Jan 7, 2020 at 8:13
  • @Sveinung, thank you. In my MWE I wasn't faced with this problem. But I will bear in mind this. I notece another problem, for which I need more time to test it. The \\* doesn't work as expected (consequently i manually break a table with `\pagebreak \`. This answer at least help me to learn more about tables settings :-)
    – Zarko
    Commented Jan 7, 2020 at 9:01

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .