[英]Latex Tables: How can I remove horizontal lines in multirow cells?
我對 Latex 非常陌生,並且正在嘗試創建一個包含跨多行的單元格的表格。 我要解決的問題是刪除放置在多行單元格上的水平線。 到目前為止我所擁有的圖片鏈接在這里
Latex_table_screenshot
我的代碼如下。 圖片中的方框區域表示有線條越過它們的多行單元格。 我曾嘗試使用 cline{} 命令刪除水平線,但最終會刪除多條線或根本不刪除。 我認為我不完全了解如何使用該命令。 我注釋掉了兩個 cline 命令,它們在未注釋時顯示了我在說什么。
\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}
您可以通過用\cline{1-3}
替換一些\hline
來修復。 更准確地說,在multirow
跨越n
行的情況下,您必須在它之后進行n-1
次替換。
\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}
output:
另外, \begin{tabular}{c|c|c|c{3.5cm}}
和\multirow{3}{150}{}
給出錯誤,至少在這個 header 中是這樣。
看看新的表格陣列tabularray
。 這將為您提供更好的結果,整齊地分布行並自動處理水平線:
\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}
(您可能想看看siunitx
package 以獲得適當的數字和單位間距......)
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.