Bit of a mouthful of a question title
I have the following table:
I'm not completely convinced it's the absolute best way to display this information, but I'm reproducing a table that is laid out like this, with a few minor improvements, such as removing ugly vertical lines. I would be open to suggestions as to how I could improve the look though.
Anyway, my question is how to get "Train formation" to be vertically centred.
You can see the problem is that it spans two rows, the permissible speed row and the row underneath. But the row underneath is a p
type row consisting of three lines, but not three rows.
I have produced the above image using:
\multirow{4}{*}{\textbf{Train formation}}
But I'm not too sure whether that takes into account that there aren't actually four rows, there are only two. It's just that the second row is three lines long. I've also set \renewcommand{\arraystretch}{1.25}
And similarly I wouldn't be sure how to vertically align the two 10 mph (15 kph) entries. As you can see, I have made use of the fact that I happen to have three rows, each of which is two lines long. But If one of those rows were to be only one line long, how would I vertically centre the second and third column?
\documentclass[12pt]{article}
\pagestyle{plain}
\usepackage[margin=1.8cm]{geometry}
\geometry{a4paper}
\usepackage[parfill]{parskip}
\usepackage[detect-weight=true]{siunitx}
\DeclareSIUnit{\mph}{mph}
\usepackage{array}
\usepackage{booktabs}
\usepackage{multirow}
\renewcommand{\arraystretch}{1.25}
\setlength{\tabcolsep}{0.8em}
\begin{document}
\begin{center}
\begin{tabular}{@{}>{\raggedright\arraybackslash}p{0.4\textwidth}
>{\centering\arraybackslash}p{0.15\textwidth}
>{\centering\arraybackslash}p{0.15\textwidth}@{}}
\toprule
\multicolumn{1}{@{}c}{\multirow{4}{*}{\textbf{Train formation}}} &
\multicolumn{2}{c@{}}{\textbf{Permissible speed}} \\ \cmidrule{2-3}
& \textbf{\SI{10}{\mph} (\SI{15}{\kilo\metre\per\hour}) or above} &
\textbf{\SI{10}{\mph} (\SI{15}{\kilo\metre\per\hour}) or less} \\ \midrule
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do \\
eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad &
\SI{10}{\mph} (\SI{15}{\kilo\metre\per\hour}) &
\SI{10}{\mph} (\SI{15}{\kilo\metre\per\hour}) \\
minim veniam, quis nostrud exercitation ullamco laboris nisi ut \\
\bottomrule
\end{tabular}
\end{center}
\end{document}