5

I need to draw a tabular like this one

enter image description here

The all rows could be a line stretch less than 1 (I set to 0.5) so as to fit the whole table on the page. The height of the others rows which are different from the first three, for neat, should be equal the last row's natural height.

I write the code as

\documentclass{article}
\usepackage{booktabs,multirow,array,caption}

\begin{document}
\begin{table}\renewcommand{\arraystretch}{0.5}
\captionof{table}{Budget Plan 2015--2017}
\begin{tabular}{cc*{6}{>{\centering\arraybackslash}m{3em}}}
\toprule
row 1&\multirow{3}*[-1ex]{\textbf{Project}}&\multicolumn{6}{c}{\textbf{Year}}
\\\cmidrule{3-7}
row 2&&\multicolumn{2}{c}{2015}&\multicolumn{2}{c}{2016}&\multicolumn{2}{c}{2017}
\\\cmidrule{3-7}
row 3&&\pounds&\$&\pounds&\$&\pounds&\$\\\midrule
row 4&Investment Costs&60&60&60&60&60&60\\\midrule
row 5&Operating Costs&60&60&60&60&60&60\\\midrule
\vdots&\vdots\\\midrule
\multirow{2}*{row 6}&Industrial/Commercial&\multirow{2}*{60}\\
&Contract\\
\bottomrule
\end{tabular}\end{table}
\end{document}

How to get the parts of rows' height are equal while the line stretch are specified?

5

Something like this?

enter image description here

Code:

\documentclass{article}
\usepackage{booktabs,multirow,array,caption}
\newcolumntype{N}{@{}m{0pt}@{}}

\begin{document}
\begin{table}\renewcommand{\arraystretch}{0.5}
\caption{Budget Plan 2015--2017}
\begin{tabular}{cc*{6}{>{\centering\arraybackslash}m{2em}}N}
\toprule
row 1&\multirow{3}*[-1ex]{\textbf{Project}}&\multicolumn{6}{c}{\textbf{Year}}
\\\cmidrule(lr){3-8}
row 2&&\multicolumn{2}{c}{2015}&\multicolumn{2}{c}{2016}&\multicolumn{2}{c}{2017}
\\\cmidrule(lr){3-8}
row 3&&\pounds&\$&\pounds&\$&\pounds&\$\\\midrule
row 4&Investment Costs&60&60&60&60&60&60&\\[\baselineskip]\midrule
row 5&Operating Costs&60&60&60&60&60&60&\\[\baselineskip]\midrule
\vdots&\vdots\\\midrule
\multirow{2}*{row 6}&Industrial/Commercial&\multirow{2}*{60}\\
&Contract\\
\bottomrule
\end{tabular}\end{table}
\end{document} 

Remarks:

  1. I've reduced m{3em} columns to m{2em} columns to fit in the page.
  2. I've changed \cmidrule{3-7} to \cmidrule(lr){3-8}.
  3. I've introduced an additional skip (\\[\baselineskip]) in the lines where you wanted more height.
  4. I've introduced a new column type N to be used as the last one to avoid the issue described here: Vertical alignment in table: m-column, row size - problem in last column.
  • Yes, you have done me a great favour, thanks very much! – Signup for Ah Woo Mar 17 '15 at 9:00
3

You can save quite a bit of vertical space by getting rid of all \midrules except for the very first one -- possibly even enough to make the entire table fit in the available space. By omitting these horizontal lines, you also immediately reduce (and possibly eliminate entirely) to make all data rows the same height, since the eye has fewer distracting elements to latch on to.

I would also suggest (a) using a tabularx environment instead of a tabular environment and (b) breaking up the second \cmidrule into three shorter segment, to correspond with the three years labels in the preceding row.

enter image description here

\documentclass{article}
\usepackage{booktabs,tabularx,array,caption}
\newcolumntype{L}{>{\raggedright\arraybackslash}X}
\usepackage{siunitx}
\newcolumntype{C}[1]{>{\centering\arraybackslash}p{#1}}
\begin{document}
\begin{table}
\caption{Budget Plan 2015--2017}
\begin{tabularx}{\textwidth}{@{} l L *{6}{C{2em}} @{} }
\toprule
row 1&\textbf{Project}&\multicolumn{6}{c@{}}{\textbf{Year}}\\
\cmidrule(l){3-8}
row 2 & &\multicolumn{2}{c}{2015} &\multicolumn{2}{c}{2016} &\multicolumn{2}{c@{}}{2017} \\
\cmidrule(lr){3-4} \cmidrule(lr){5-6} \cmidrule(l){7-8}
row 3& &\pounds&\$&\pounds&\$&\pounds&\$\\
\midrule
row 4&Investment Costs&60&60&60&60&60&60\\
row 5&Operating Costs&60&60&60&60&60&60\\
\vdots&\vdots\\
row $n$&Industrial\slash Commercial Contract &60\\
\bottomrule
\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.