I can draw a simple table with non merged rows and columns. However, I want to draw a table in latex with some rows merged as shown below, any ideas on how to do it?
-
2Please provide a minimal working example of what you tried. You can use the online tool tablesgenerator. – NBur Feb 23 '21 at 07:33
-
3Does this answer your question? How to use \multirow – NBur Feb 23 '21 at 07:34
2 Answers
I'd say that the image you posted is a prime example of a table whose "look" can be -- and should be! -- greatly improved by (a) omitting all vertical lines, (b) using fewer but well-spaced horizontal lines, and (c) aligning numbers, where appropriate, on their explicit or implicit decimal markers. As a byproduct of these improvements, the need to align some cell contents simply becomes a non-issue as long as you're used to reading a table's contents from left to right and from top to bottom.
\documentclass{article}
\usepackage{array,booktabs,siunitx}
\begin{document}
\begin{tabular}{@{} l c c S[table-format=2.0] @{}}
\toprule
Load & R & Interval & {Result} \
\midrule
99% & 20 & 20% & 9 \
& & 40% & 10 \
\addlinespace % whitespace is a very effective visual separator
99% & 30 & 20% & 3 \
& & 40% & 5 \
\bottomrule
\end{tabular}
\end{document}
- 506,678
In future please always provide an MWE (Minimal Working Example, a small but compilable document, which reproduce your problem), which show your problem. So, writing table from scratch (what is not fun), you can with proper use of the multirow package obtain the following result:
\documentclass[border=3.141592]{standalone}
\usepackage{multirow}
\usepackage{siunitx}
\begin{document}
\setlength\extrarowheight{2pt}
\begin{tabular}{|c|c|c|c|}
\hline
Load & R & Interval & Result \
\hline
\multirow{2}{}{\SI{99}{\percent}}
& \multirow{2}{}{20}
& \SI{20}{\percent} & 9 \
\cline{3-4}
& & \SI{20}{\percent} & 10 \
\hline
\multirow{2}{}{\SI{99}{\percent}}
& \multirow{2}{}{30}
& \SI{20}{\percent} & 3 \
\cline{3-4}
& & \SI{20}{\percent} & 4 \
\hline
\end{tabular}
\end{document}
- 296,517


