我正在尝试将其转换为 latex 表格,并将“JastAdd”列合并为两行,顶行是单列“JastAdd”,底行是两列,一列用于“时间”,一列用于“内存”。设计为“APS(无单调性检查)”和“APS(有单调性检查)”。
CSV:
file size in MB,nodes,non-terminals,terminals,JastAdd time,JastAdd memory,APS (without monotonicity) check time,APS (without monotonicty check) memory,APS (with monotonicity) check time,APS (with monotonicty check) memory
279,9075268,8192,9067076,JVM crashed after 1670 seconds,JVM crashed after 1670 seconds,861,18362,-,-
29,3596625,4096,3592529,893,4713,246,5052,-,-
21,1024167,2048,1022119,127,993,72,1288,31716,2946
11,265762,1024,264738,15,368,9.3,479,3324,774
5,67244,512,66732,2.8,126,2.3,137,348,344
2,17045,256,16789,0.8,63,0.6,78,33,98
乳胶:
\documentclass{article}
\usepackage{tabularray}
\UseTblrLibrary{siunitx}
\begin{document}
\begin{center}
\begin{tblr}
{
colspec = {X[c,m]X[c,m]X[c,m]X[c,m]X[c,m]},
cell{1}{2,4} = {c=2}{},
cell{1}{1} = {r=2}{},
hlines,
vlines,
}
file size in MB & nodes & non-terminals & terminals & JastAdd time & JastAdd memory & APS (without monotonicity) check time & APS (without monotonicty check) memory & APS (with monotonicity) check time & APS (with monotonicty check) memory \\
279 & 9075268 & 8192 & 9067076 & JVM crashed after 1670 seconds & JVM crashed after 1670 seconds & 861 & 18362 & - & - \\
29 & 3596625 & 4096 & 3592529 & 893 & 4713 & 246 & 5052 & - & - \\
21 & 1024167 & 2048 & 1022119 & 127 & 993 & 72 & 1288 & 31716 & 2946 \\
11 & 265762 & 1024 & 264738 & 15 & 368 & 9.3 & 479 & 3324 & 774 \\
5 & 67244 & 512 & 66732 & 2.8 & 126 & 2.3 & 137 & 348 & 344 \\
2 & 17045 & 256 & 16789 & 0.8 & 63 & 0.6 & 78 & 33 & 98 \\
\end{tblr}
\end{center}
\end{document}
答案1
\documentclass{article}
\usepackage[margin=1cm]{geometry}
\usepackage{tabularray}
\begin{document}
\begin{center}
\begin{tblr}
{
rows = {valign=m},
columns = {co=-1,halign=c},
hspan = minimal,
cell{1}{1-4} = {r=2}{},
cell{1}{5,7,9} = {c=2}{},
cell{8}{5} = {c=2}{},
cell{7}{9} = {r=2,c=2}{},
hlines,
vlines,
}
file size in MB & nodes & non-terminals & terminals & JastAdd & & APS (without monotonicity) check & & APS (with monotonicity) check & \\
& & & & time (seconds) & memory (MB) & time (seconds) & memory (MB) & time (seconds) & memory (MB) \\
2 & 17045 & 256 & 16789 & 0.8 & 63 & 0.6 & 78 & 33 & 98 \\
5 & 67244 & 512 & 66732 & 2.8 & 126 & 2.3 & 137 & 348 & 344 \\
11 & 265762 & 1024 & 264738 & 15 & 368 & 9.3 & 479 & 3324 & 774 \\
21 & 1024167 & 2048 & 1022119 & 127 & 993 & 72 & 1288 & 31716 & 2946 \\
29 & 3596625 & 4096 & 3592529 & 893 & 4713 & 246 & 5052 & - & \\
279 & 9075268 & 8192 & 9067076 & JVM crashed after 1670 seconds & & 861 & 18362 & & \\
\end{tblr}
\end{center}
\end{document}
答案2
与克拉拉 (Clara) 的漂亮回答 (+1) 有细微的不同,使用了siunitx
数字格式化包:
\documentclass{article}
\usepackage[margin=1cm]{geometry}
\usepackage{tabularray}
\UseTblrLibrary{siunitx}
\begin{document}
\begin{center}
\sisetup{group-minimum-digits=4}
\begin{tblr}
{
colspec = {X[si={table-format=2.0}] X[si={table-format=7.0}] X[si={table-format=4.0}] X[si={table-format=7.0}]
X[si={table-format=3.1,minimum-decimal-digits=1}] X[si={table-format=4.0}] X[si={table-format=3.1,minimum-decimal-digits=1}]
X[si={table-format=4.0}] X[si={table-format=5.0}] X[si={table-format=4.0}]},
hspan = minimal,
cell{1}{1-4} = {r=2}{},
cell{1}{5,7,9} = {c=2}{c},
cell{8}{5} = {c=2}{guard, c},
cell{7}{9} = {r=2,c=2}{guard, c},
rows = {m},
row{1,2} = {guard, c, m},
hlines,
vlines,
}
file size in MB
& nodes & non-terminals & terminals & JastAdd & & APS (without monotonicity) check & & APS (with monotonicity) check & \\
& & & & time (seconds) & memory (MB) & time (seconds) & memory (MB) & time (seconds) & memory (MB) \\
2 & 17045 & 256 & 16789 & 0.8 & 63 & 0.6 & 78 & 33 & 98 \\
5 & 67244 & 512 & 66732 & 2.8 & 126 & 2.3 & 137 & 348 & 344 \\
11 & 265762 & 1024 & 264738 & 15 & 368 & 9.3 & 479 & 3324 & 774 \\
21 & 1024167 & 2048 & 1022119 & 127 & 993 & 72 & 1288 & 31716 & 2946 \\
29 & 3596625 & 4096 & 3592529 & 893 & 4713 & 246 & 5052 & --- & \\
279 & 9075268 & 8192 & 9067076 & JVM crashed after 1670 seconds
& & 861 & 18362 & & \\
\end{tblr}
\end{center}
\end{document}