4

I have been trying to create a table as a part of my thesis and since I am new to latex, I am having problem in the formatting of the table. First I want some space above the text and the horizontal line and want only the titles (top cells) to be middle aligned (vertically). The code I am using is:

\documentclass[a4paper, 12pt, twoside, openright]{report}
\usepackage{mathtools, array, multirow, booktabs}
\begin{document}
Some contents...

\begin{table}
\centering
\footnotesize
\caption{Guidelines for excavation and support of rock tunnels in accordance to RMR.}
  \begin{tabular}{@{} p{0.15\textwidth} p{0.15\textwidth} p{0.2\textwidth} p{0.2\textwidth} p{0.2\textwidth} @{}}
    \toprule
    \multirow{2}{0.13\textwidth}{\textbf{Rock Mass Class\newline
    (RMR value range)}}&    \multirow{2}{0.15\textwidth}{\textbf{Excavation}}&  \multicolumn{3}{c}{\textbf{Supports}}\\
    \cline{3-5}
    &   &   \textbf{Rock bolts (20 mm diameter, fully grouted)}&    \textbf{Conventional shotcrete}&    \textbf{Steel Sets}\\
    \addlinespace
    \hline
    Very Good Rock\newline
    \textit{81-100}&    Full face; 3 m advance& \multicolumn{3}{c}{Generally, no support required except for occasional spot bolting}\\
    \addlinespace
    Good Rock \newline
    \textit{61-80}& Full face; 1.0-1.5 m advance; complete support 20 m from face&  Locally, bolts in crown 3m long, spaced 2.5 m with occasional wire mesh&    50 mm in crown where required&  None\\
    \addlinespace   
    Fair Rock\newline
    \textit{41-60}& Heading and bench; 1.5-3 m advance in heading; commence support after each blast; complete support 10 m from face&  Systematic bolts 4 m long, spaced1.5-2.0 m in crown and walls with wire mesh in crown&  50-100 mm in crown and 30 mm in sides&  None\\
    \end{tabular}
\end{table}

Some contents
\end{document}

P.S. Like I said I am new to latex and am using a lot of packages in the original text, I might have missed some packages in this MWE.

The table I would like to obtain should look like

enter image description here

1
  • BTW, if any of the answers helped you, it'd be nice if you could accept one of them by clicking on the checkmark symbol.
    – chsk
    May 3 '21 at 9:56
4

I'd probably put this on a landscape page. Here's an attempt using tabularx, just to get you started:

\documentclass[a4paper, 12pt, twoside, openright]{report}
\usepackage{mathtools, array, multirow, booktabs}
\usepackage{tabularx}
\usepackage{pdflscape}
\usepackage{afterpage}
\usepackage{lipsum}
\newcolumntype{Y}{>{\hsize=\dimexpr3\hsize+3\tabcolsep+2\arrayrulewidth\relax}X}
\begin{document}
\lipsum

\afterpage{%
    \clearpage%
    \begin{landscape}
        \begin{table}[p]
        \centering
        \caption{Guidelines for excavation and support of rock tunnels in accordance to RMR.}
          \begin{tabularx}{\linewidth}{XXXXX}
            \toprule
            \multirow{2}{\hsize}{\textbf{Rock Mass Class (RMR value range)}}&    \multirow{2}{\hsize}{\textbf{Excavation}}&\multicolumn{3}{Y}{\textbf{Supports}}\\
            \cmidrule(lr){3-5}
            &   &   \textbf{Rock bolts (20 mm diameter, fully grouted)}&    \textbf{Conventional shotcrete}&    \textbf{Steel Sets}\\
            \midrule
            Very Good Rock\newline
            \textit{81-100}&    Full face; 3 m advance& \multicolumn{3}{Y}{Generally, no support required except for occasional spot bolting}\\
            \addlinespace
            Good Rock \newline
            \textit{61-80}& Full face; 1.0--1.5 m advance; complete support 20 m from face&  Locally, bolts in crown 3m long, spaced 2.5 m with occasional wire mesh&    50 mm in crown where required&  None\\
            \addlinespace   
            Fair Rock\newline
            \textit{41-60}& Heading and bench; 1.5--3 m advance in heading; commence support after each blast; complete support 10 m from face&  Systematic bolts 4 m long, spaced 1.5--2.0 m in crown and walls with wire mesh in crown&  50--100 mm in crown and 30 mm in sides&  None\\
            \bottomrule
            \end{tabularx}
        \end{table}
    \end{landscape}
}
\lipsum
\end{document}

enter image description here

This defines a new column type, Y, that's basically three X columns --- this is for use in \multicolumns. I neglected to also define a new column type for two X columns since that was only needed once, but if you find yourself needing that again it would make sense to define another one (Z, say).

The whole thing's obviously far from perfect, but I think it'll give you a start --- and I'd probably leave fiddling with the specific formatting until after you've got all the information included.

0
4

This table is a good approximation of your goal. It fits quite well in a landscape orientation with a readable font size.

It is made using the package nicematrix. It provides the command \Block that creates multicolumns and multirow cells so the code is more compact, easy to read and to maintain.

\Block[l]{6-1}{<..>} creates a 6 row by 1 column cell. (only one new command to learn!)

Most important, it allows you to use \\ inside, thus cutting lines where it makes the most sense when reading. See the last figure.

The \newcolumntype{P}{>{\raggedright\arraybackslash}p{0.15\textwidth}} allow for adjusting the width of the five columns to fit in the text area and also have the cell as raggedright to avoid awkward spaces between words.

d

\documentclass[a4paper, 12pt]{report}

\usepackage{pdflscape} % landscape  added <<<<<<<<<
\usepackage{geometry}% added <<<<<<<<<

\usepackage{caption}
\usepackage{booktabs} % rules
\usepackage{nicematrix} % added <<<<<<<<<
\newcolumntype{P}{>{\raggedright\arraybackslash}p{0.15\textwidth}}

\begin{document}
    
    \begin{landscape}
        \setlength{\oddsidemargin}{-15pt} % shift up the table
        \pagestyle{empty}   
        \begin{table}[ht!]
            \centering
            \footnotesize
            \caption{Guidelines for excavation and support of rock tunnels in accordance to RMR.}   
            \begin{NiceTabular}{@{}P P P P P @{}}
                \toprule
                &&  \Block{1-3}{\bfseries Supports} &&\\  % headings of the table
                \cline{3-5}
                \Block{2-1}<\bfseries>{Rock Mass \\Class}  &    
                \Block{2-1}<\bfseries>{Excavation}&  
                \Block{3-1}<\bfseries>{Rock bolts \\ (20mm diameter, \\fully grouted)} & 
                \Block{3-1}<\bfseries>{Conventional \\ shotcrete} & 
                \Block[l]{3-1}<\bfseries>{Steel Sets}  \\ 
                &&&&\\       &&&& \\    % two  empty rows
                \midrule
                &&&& \\
                \Block[l]{2-1}{Very Good Rock \\ \textit{RMR = 81--100}}&    %Row #1
                \Block[l]{2-1}{Full face; \\ 3m advance}&  
                \Block{2-3}{Generally, no support required except for\\ occasional spot bolting} && \\          
                &&&&\\       &&&&\\     % two more empty rows   
                
                \Block[l]{2-1}{Good Rock \\ \textit{RMR = 61--80}}&  %Row #2
                \Block[l]{4-1}{Full face; 1.0-1.5m \\ advance; complete \\support 20m from \\face}&
                \Block[l]{5-1}{Locally, bolts in  \\crown 3m long, \\spaced 2.5m with\\ occasional wire\\ mesh}&  
                \Block[l]{2-1}{50mm in crown \\ where required}&  
                \Block[l]{1-1}{None}\\              
                &&&&\\   &&&&\\  &&&&\\  &&&&\\ &&&&\\  % five more empty rows  
                
                \Block[l]{2-1}{Fair Rock \\ \textit{RMR = 41--60}}&  %Row #3
                \Block[l]{7-1}{Heading and bench; \\ 1.5--3m advance in\\ heading; commence\\ support after each\\ blast; complete\\ support 10m from\\ face}& 
                \Block[l]{5-1}{Systematic bolts\\ 4m long, spaced\\ 1.5--2.0m  in crown \\and walls with wire\\ mesh in crown}&  \Block[l]{3-1}{50-100mm in \\crown and 30mm \\in sides}&
                \Block[l]{1-1}{None}\\
                &&&&\\      &&&&\\      &&&&\\      &&&&\\          &&&&\\      &&&&\\      &&&&\\  % seven more empty rows 
                
                \Block[l]{2-1}{Poor Rock \\ \textit{RMR = 21--40}}&  %Row #4
                \Block[l]{7-1}{Top heading and bench; \\ 1.0--1.5m advance in\\top  heading; commence\\ install support \\ concurrently\\ with excavation\\  10m from face}& 
                \Block[l]{5-1}{Systematic bolts\\ 4--5m long, spaced\\ 1--1.5m  in crown \\and walls with wire\\ mesh}&  \Block[l]{3-1}{50-150mm in \\crown and 100mm \\in sides}&
                \Block[l]{3-1}{ Light to medium \\ ribs spaced 1.5m \\where required}\\     
                &&&&\\      &&&&\\      &&&&\\      &&&&\\      &&&&\\      &&&&\\      &&&&\\% seven more empty rows
                
                \Block[l]{2-1}{Very Poor Rock \\ \textit{RMR < 20}}&  %Row #5 last
                \Block[l]{8-1}{Multiple drift;\\ 0.5--1.5m advance in \\top heading; install\\ support concurrently\\ with excavation; \\shotconcrete as soon\\ as possible after \\ blasting}&
                \Block[l]{5-1}{Systematic bolts\\ 5--6m long, spaced\\ 1--1.5m  in crown \\and walls with wire\\ mesh; bolts inverts}&  \Block[l]{4-1}{150-200mm in \\crown, 150mm \\in sides and 50mm  \\on face}&
                \Block[l]{6-1}{Medium  to heavy\\ ribs spaced 0.75m \\with steel lagging \\and forepoling if \\required; close\\ invert}\\
                &&&&\\      &&&&\\      &&&&\\      &&&&\\      &&&&\\      &&&&\\      &&&&\\  % seven more empty rows     
                \bottomrule     
            \end{NiceTabular}
            
        \end{table}
    \end{landscape} 
    
\end{document}

It will compile twice the first time.

With longer lines, easier to read and understand.

ff

3

With sidewaystable, tabularx, multicell and siunitx packages:

\documentclass[a4paper, 12pt, twoside, openright]{report}
\usepackage{ragged2e}
\usepackage{rotating}
\usepackage{booktabs, makecell, multirow, tabularx}
\renewcommand\theadfont{\footnotesize\bfseries}
\renewcommand\theadgape{}
\newcolumntype{L}[1]{>{\RaggedRight\hspace{0pt}%
                       \hsize=#1\hsize}X}
\usepackage{siunitx}

\begin{document}
\begin{sidewaystable}[ht]
\centering
\footnotesize
\caption{Guidelines for excavation and support of rock tunnels in accordance to RMR.}
\sisetup{range-units = single}
  \begin{tabularx}{\linewidth}{@{} L{0.7}
                              *{2}{L{1.4}} 
                                   L{1}
                                   L{0.5} @{}}
    \toprule
\multirow{4}{=}{\textbf{Rock Mass Class (RMR value range)}}
    &   \multirow{4}{=}{\textbf{Excavation}}
        &   \multicolumn{3}{c}{\textbf{Supports}}\\
    \cmidrule{3-5}
    &   &   \thead{Rock bolts\\ 
                  (diameter: \SI{20}{\milli\metre},\\ 
                   fully grouted)}
            &   \thead{Conventional\\ shotcrete}
                &    \thead{Steel\\Sets}\\
    \midrule
Very Good Rock \textit{81-100}
    &    Full face; \SI{3}{m} advance
        & \multicolumn{3}{c}{Generally, no support required except for occasional spot bolting}\\
    \addlinespace
Good Rock\newline 
\textit{61-80}
    & Full face; \SIrange{1.0}{1.5}{\metre} advance; complete support \SI{20}{\metre} from face
        &  Locally, bolts in crown \SI{3}{\metre} long, 
           spaced \SI{2.5}{\metre} with occasional wire mesh
           & \SI{50}{\milli\metre} in crown where required
            &  None\\
    \addlinespace
Fair Rock\newline 
\textit{41-60}
    & Heading and bench; \SIrange{1.5}{3}{\metre} advance in heading; commence support after each blast; complete support \SI{10}{\metre} from face
        &  Systematic bolts \SI{4}{\metre} long, spaced \SIrange{1.5}{2.0}{\metre} in crown and walls with wire mesh in crown
            & \SIrange{50}{100}{\milli\metre} in crown and \SI{30}{\milli\metre} in sides
                &  None\\
    \bottomrule
    \end{tabularx}
\end{sidewaystable}
\end{document}

enter image description here

2

In my opinion, I would not use any multirow for that table; it's a 5-column table with a lot of paragraph style text. I surely would use ragged right text in the cells, though, the example has awful spacing. My suggestion:

\documentclass[a4paper, 12pt, twoside, openright]{report}
\usepackage{mathtools, array, booktabs}
\usepackage{ragged2e}
% ragged-right and centered columns with widths proportional to \linewidth
\newcolumntype{R}[1]{>{\RaggedRight\arraybackslash\hspace{0pt}}p{#1\linewidth}<{}}
\newcolumntype{C}[1]{>{\Centering\arraybackslash\hspace{0pt}}p{#1\linewidth}<{}}

\begin{document}
Some contents...

\begin{table}
\centering
\scriptsize
\caption{Guidelines for excavation and support of rock tunnels in accordance to RMR.}
\bigskip

% set an easy tabcolsep proportional to \linewidth so we can do easy calculations
% (maybe look at tabularx, yes)
\setlength\tabcolsep{0.01\linewidth}
\begin{tabular}{@{}*5{R{0.15}}@{}}
    \toprule
    \multicolumn{1}{C{0.15}}{\textbf{Rock Mass Class}} &
    \multicolumn{1}{C{0.15}}{\textbf{Excavation}}&
    % this is 0.45+0.02 (two tabcolseps)
    \multicolumn{3}{C{0.47}}{\textbf{Supports}}\\
    \cline{3-5} \\
    & &
    \multicolumn{1}{C{0.15}}{\textbf{Rock bolts (20 mm diameter, fully grouted)}}&
    \multicolumn{1}{C{0.15}}{\textbf{Conventional shotcrete}}&
    \multicolumn{1}{C{0.15}}{\textbf{Steel Sets}}\\
    \addlinespace
    \midrule
    Very Good Rock\newline
    \textit{81-100}&    Full face; 3 m advance& \multicolumn{3}{R{0.47}}{Generally, no support required except for occasional spot bolting}\\
    \addlinespace
    Good Rock \newline
    \textit{61-80}& Full face; 1.0-1.5 m advance; complete support 20 m from face&  Locally, bolts in crown 3m long, spaced 2.5 m with occasional wire mesh&    50 mm in crown where required&  None\\
    \addlinespace
    Fair Rock\newline
    \textit{41-60}& Heading and bench; 1.5-3 m advance in heading; commence support after each blast; complete support 10 m from face&  Systematic bolts 4 m long, spaced1.5-2.0 m in crown and walls with wire mesh in crown&  50-100 mm in crown and 30 mm in sides&  None\\
    \bottmrule
    \end{tabular}

\end{table}

Some contents
\end{document}

enter image description here

1

Another alternative layout:

enter image description here

\documentclass[a4paper, 12pt, twoside, openright]{report}
\usepackage{ragged2e}
\usepackage{booktabs, makecell, tabularx}
\renewcommand\theadfont{\footnotesize\bfseries}
\newcolumntype{L}[1]{>{\RaggedRight\hspace{0pt}%
                       \hsize=#1\hsize}X}
\usepackage{siunitx}
\usepackage{caption}

\begin{document}
\begin{table}
\centering
\small
\setlength{\tabcolsep}{4pt}
\caption{Guidelines for excavation and support of rock tunnels in accordance to RMR.}
\sisetup{range-units = single}
  \begin{tabularx}{\linewidth}{@{\qquad}L{1.3}L{0.95} L{0.8} L{0.95}@{}}
    \toprule
      \textbf{Excavation}
        &   \multicolumn{3}{c}{\textbf{Supports}}\\
    \cmidrule{2-4}
       &   \thead[l]{Rock bolts\textsuperscript{a}}
            &   \thead{Conventional\\ shotcrete}
                &    \thead[l]{Steel Sets}\\
    \midrule
\multicolumn{4}{@{}l}{Very Good Rock, RMR = 81--100}\\
        Full face; \SI{3}{m} advance
        & \multicolumn{3}{L{2.7}}{Generally, no support required except for occasional spot bolting}
        \\ \addlinespace
        
\multicolumn{4}{@{}l}{Good Rock, RMR = 61--80}\\
     Full face; \SIrange{1.0}{1.5}{\m} advance; complete support \SI{20}{\m} from face
        &  Locally, bolts in crown \SI{3}{\m} long, 
           spaced \SI{2.5}{\m} with occasional wire mesh
           & \SI{50}{\mm} in crown where required
            &  None\\ \addlinespace
            
\multicolumn{4}{@{}l}{Fair Rock, RMR = 41--60}\\
     Heading and bench; \SIrange{1.5}{3}{\m} advance in heading; commence support after each blast; complete support \SI{10}{\m} from face
        &  Systematic bolts \SI{4}{\m} long, spaced \SIrange{1.5}{2.0}{\m} in crown and walls with wire mesh in crown
            & \SIrange{50}{100}{\mm} in crown and \SI{30}{\mm} in sides
                &  None\\  \addlinespace
                
\multicolumn{4}{@{}l}{Poor Rock RMR = 21--40}\\
    Top heading and bench;  \SIrange{1.0}{1.5}{\m} advance in top  heading; commence install support  concurrently with excavation  \SI{10}{\m} from face
         & Systematic bolts \SIrange{4}{5}{\m} long, spaced \SIrange{1}{1.5}{\m}  in crown and walls with wire mesh
           &  \SIrange{50}{150}{\mm} in crown and \SI{100}{\m} in sides
             & Light to medium  ribs spaced \SI{1.5}{\m} where required\\  \addlinespace
                                 
\multicolumn{4}{@{}l}{Very Poor Rock RMR < 20}\\
    Multiple drift; \SIrange{0.5}{1.5}{\m} advance in top heading; install support concurrently with excavation; shotconcrete as soon as possible after  blasting
       & Systematic bolts \SIrange{5}{6}{\m} long, spaced \SIrange{1}{1.5}{\m} in crown and walls with wire mesh; bolts inverts
           &  \SIrange{150}{200}{\mm} in crown, \SI{150}{\mm} in sides and \SI{50}{\mm} on face
               & Medium  to heavy ribs spaced \SI{0.75}{\m} with steel lagging and forepoling if required; close invert\\   
                               
    \bottomrule
    \multicolumn{4}{p{\dimexpr\linewidth-2\tabcolsep}}{\textsuperscript{a} diameter: \SI{20}{\mm}, fully grouted}\\
    \end{tabularx}
\end{table}
\end{document}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.