Reputation: 43
I am very new to Latex and am trying to create a table with cells that span multiple rows. The issue I am trying to solve is removing the horizontal lines that are placed over the multirow cells. A picture of what I have so far is linked here
Latex_table_screenshot
and my code is below. In the picture are boxed areas indicating the multirow cells that have lines going over them. I have tried using the cline{} command to remove the horizontal lines, but it ends up removing either more than one line or none at all. I do not think I understand how to use that command completely. I commented out the two cline commands that show what I am talking about when not commented.
\documentclass[12pt,a4paper]{article}
\usepackage{booktabs}
\usepackage{multirow}
\usepackage[margin=1in]{geometry}
\begin{document}
\renewcommand{\arraystretch}{1.5}
\centering
\begin{tabular}{c|c|c|c{3.5cm}}
\hline
\textbf{ Classification} & \textbf{Total Impulse} & \textbf{Total Impulse} & \textbf{Type/}\\
& (Newton-Seconds) & (Pounds-Seconds) & \textbf{US Requirements}\\
\hline
%___________Micro____________
1/8 A & 0—0.3125 \textbf{N·s} & 0 – 0.07 lbf·s & \multirow{1}{*}\textbf{Micro} \\%[.3cm]
%\cline{3-4}
%\cline{4-5}
\hline
%_________Low Power_________
1/4 A & 0.3126 – 0.625 N·s & 0.071 – 0.14 lbf·s & \multirow{6}{*}{Low Power}\\
\hline
1/2 A & 0.626 – 1.25 N·s & 0.141 – 0.28 lbf·s & \\
\hline
A & 0.626 – 1.25 N·s & 0.141 – 0.28 lbf·s & \\
\hline
B & 2.51 – 5.00 N·s & 0.561 – 1.12 lbf·s & \\
\hline
C & 5.01 – 10.0 N·s & 1.121 – 2.25 lbf·s & \\
\hline
D & 10.01 – 20.0 N·s & 2.251 – 4.5 lbf·s & \\
\hline
%_______Mid Power__________
E & 20.01 – 40.0 N·s & 4.51 – 8.99 lbf·s & \multirow{3}{*}{Mid Power}\\
\hline
F & 40.01 – 80.0 N·s & 8.991 – 18.0 lbf·s & \\
\hline
G & 80.01 – 160 N·s & 18.01 – 36.0 lbf·s & \\
\hline
%_____High Power | Level 1_________
H & 160.01 – 320 N·s & 36.01 – 71.9 lbf·s & \multirow{2}{150}{\textbf{ High Power | Level 1} \newline
Level 1 Certification required for purchase. Certification available through Tripoli or NAR.
Under 125g propellant is Federal Aviation Administration exempt.}\\
\hline
I & 320.01 – 640 N·s & 71.9 – 144 lbf·s & \\[2cm]
\hline
%____High Power | Level 2 _____
J & 640.01 – 1,280 N·s & 144.01–288 lbf·s & \multirow{3}{150}{\textbf{ High Power | Level 2} \newline
Level 2 Certification required for purchase. Certification available through Tripoli or NAR.}\\
\hline
K & 1,280.01 – 2,560 N·s & 288.01–576 lbf·s & \\
\hline
L & 2,560.01 – 5,120 N·s & 576.01–1,151 lbf·s & \\[.2cm]
\hline
%_______High Power | Level 3________
M & 5,120.01 – 10,240 N·s & 1,151.01–2,302 lbf·s & \multirow{3}{150}{\textbf{ High Power | Level 3}
\newline
Level 3 Certification required for purchase. Certification available through Tripoli or NAR.}\\
\hline
N & 10,240.01 – 20,480 N·s & 2,302.01–4,604 lbf·s & \\
\hline
O & 20,480.01 – 40,960 N·s & 4,604.01–9,208 lbf·s & \\[.2cm]
\hline
\end {tabular}
\end{document}
Upvotes: 4
Views: 7429
Reputation: 7375
You can fix just by substituting some \hline
with \cline{1-3}
. More precisely, where multirow
spans n
rows, you must make this substitution n-1
times after it.
\documentclass[12pt,a4paper]{article}
\usepackage{booktabs}
\usepackage{multirow}
\usepackage[margin=1in]{geometry}
\begin{document}
\renewcommand{\arraystretch}{1.5}
\centering
\begin{tabular}{c|c|c|c}
\hline
\textbf{ Classification} & \textbf{Total Impulse} & \textbf{Total Impulse} & \textbf{Type/}\\
& (Newton-Seconds) & (Pounds-Seconds) & \textbf{US Requirements}\\
\hline
%___________Micro____________
1/8 A & 0—0.3125 \textbf{N·s} & 0 – 0.07 lbf·s & \multirow{1}{*}\textbf{Micro} \\%[.3cm]
%\cline{3-4}
%\cline{4-5}
\hline
%_________Low Power_________
1/4 A & 0.3126 – 0.625 N·s & 0.071 – 0.14 lbf·s & \multirow{6}{*}{Low Power}\\
\cline{1-3}
1/2 A & 0.626 – 1.25 N·s & 0.141 – 0.28 lbf·s & \\
\cline{1-3}
A & 0.626 – 1.25 N·s & 0.141 – 0.28 lbf·s & \\
\cline{1-3}
B & 2.51 – 5.00 N·s & 0.561 – 1.12 lbf·s & \\
\cline{1-3}
C & 5.01 – 10.0 N·s & 1.121 – 2.25 lbf·s & \\
\cline{1-3}
D & 10.01 – 20.0 N·s & 2.251 – 4.5 lbf·s & \\
\hline
%_______Mid Power__________
E & 20.01 – 40.0 N·s & 4.51 – 8.99 lbf·s & \multirow{3}{*}{Mid Power}\\
\cline{1-3}
F & 40.01 – 80.0 N·s & 8.991 – 18.0 lbf·s & \\
\cline{1-3}
G & 80.01 – 160 N·s & 18.01 – 36.0 lbf·s & \\
\hline
%_____High Power | Level 1_________
H & 160.01 – 320 N·s & 36.01 – 71.9 lbf·s & \multirow{2}{150px}{\textbf{ High Power | Level 1} \newline
Level 1 Certification required for purchase. Certification available through Tripoli or NAR. Under 125g propellant is Federal Aviation Administration exempt.}\\
\cline{1-3}
I & 320.01 – 640 N·s & 71.9 – 144 lbf·s & \\[2cm]
\hline
%____High Power | Level 2 _____
J & 640.01 – 1,280 N·s & 144.01–288 lbf·s & \multirow{3}{150px}{\textbf{ High Power | Level 2} \newline
Level 2 Certification required for purchase. Certification available through Tripoli or NAR.}\\
\cline{1-3}
K & 1,280.01 – 2,560 N·s & 288.01–576 lbf·s & \\
\cline{1-3}
L & 2,560.01 – 5,120 N·s & 576.01–1,151 lbf·s & \\[.2cm]
\hline
%_______High Power | Level 3________
M & 5,120.01 – 10,240 N·s & 1,151.01–2,302 lbf·s & \multirow{3}{150px}{\textbf{ High Power | Level 3}
\newline
Level 3 Certification required for purchase. Certification available through Tripoli or NAR.}\\
\cline{1-3}
N & 10,240.01 – 20,480 N·s & 2,302.01–4,604 lbf·s & \\
\cline{1-3}
O & 20,480.01 – 40,960 N·s & 4,604.01–9,208 lbf·s & \\[.2cm]
\hline
\end {tabular}
\end{document}
The output:
Also, \begin{tabular}{c|c|c|c{3.5cm}}
and \multirow{3}{150}{}
give errors, at least with this header.
Upvotes: 2
Reputation: 38977
Have a look at the new tabularray
package. This will give you much better results, distribute the rows neatly and will automatically deal with the horizontal lines:
\documentclass[12pt,a4paper]{article}
\usepackage[margin=1in]{geometry}
\usepackage{tabularray}
\begin{document}
\noindent
\begin{tblr}{
colspec={ c c c X},
vlines,
hlines,
vspan=even
}
H & 160.01 – 320 N·s & 36.01 – 71.9 lbf·s & \SetCell[r=2]{} \textbf{High Power | Level 1} \newline Level 1 Certification required for purchase. Certification available through Tripoli or NAR.
Under 125g propellant is Federal Aviation Administration exempt.\\
I & 320.01 – 640 N·s & 71.9 – 144 lbf·s & \\
\end{tblr}
\end{document}
(you might want to have a look at the siunitx
package to get proper spacing for your numbers and units...)
Upvotes: 2