![表格行分组](https://linux22.com/image/447581/%E8%A1%A8%E6%A0%BC%E8%A1%8C%E5%88%86%E7%BB%84.png)
我正在尝试按行将组合并到下表中:
当前版本是通过以下代码实现的:
\documentclass{article}
\usepackage[margin=25mm]{geometry}
\usepackage{ragged2e}
\usepackage{rotating} % needed
\usepackage{makecell} % needed
\usepackage{xcolor}
\usepackage{tabularray}
%\NewTableCommand\TB{\textbullet}
\newcommand\TB{\textbullet}
\begin{document}
\begin{center}
\settowidth\rotheadsize{\footnotesize{Number and Stability of Systems}} % from makecell
\begin{tblr}{hline{1} = 1pt,
hline{2-19}=solid,
hline{18} = 1pt,
vlines,
colspec = {>{\centering\arraybackslash}p{2cm} *{13}{c}},
cell{2}{2-14} = {cmd=\rotcell},
row{1} = {font=\bfseries}
}
\SetCell[r=2]{f, font=\bfseries} Articles
& \SetCell[c=13]{c} Characteristics
& & & & & & & & & & \\
& \footnotesize{Execution Frequency}
& \footnotesize{Execution Time}
& \footnotesize{Maturity}
& \footnotesize{Determinism}
& \footnotesize{Standardization}
& \footnotesize{Machine-Readable Data}
& \footnotesize{Human Involvement}
& \footnotesize{Proneness to Human Error}
& \footnotesize{Business Impact}
& \footnotesize{Number and Stability of Systems}
& \footnotesize{Compliance and Security} & \footnotesize{End of Life} & \footnotesize{Automation in other Systems} \\
\multicolumn{1}{|m|}{\footnotesize\textsc{\cite[]{Choi2021}}}
& \TB & \TB
&
& & & &
&
&
& & & & \\
\multicolumn{1}{|m|}{\footnotesize\textsc{\cite[]{Agostinelli2021}}}
& \TB
& &
& & & & & & & & & & \\
\multicolumn{1}{|m|}{\footnotesize\textsc{\cite[]{Leno2020a}}}
& \TB
&
&
& & &
& & & & & & & \\
\multicolumn{1}{|m|}{\footnotesize\textsc{\cite[]{Gao2019}}}
& \TB
&
&
& & &
& & & & & & & \\
\multicolumn{1}{|m|}{\footnotesize\textsc{\cite[]{Rhouati2021}}}
& \TB
&
& \TB
& \TB & & \TB
& \TB & & & & & & \\
\multicolumn{1}{|m|}{\footnotesize\textsc{\cite[]{Lacity2016}}}
& \TB
& \TB
& \TB
& \TB & \TB &
& & & & & & & \\
\multicolumn{1}{|m|}{\footnotesize\textsc{\cite[]{Leshob2018}}}
& \TB
& \TB
& \TB
& \TB & \TB &
& \TB & & & & & & \\
\multicolumn{1}{|m|}{\footnotesize\textsc{\cite[]{wanner2019process}}}
& \TB
& \TB
& \TB
& & \TB &
& \TB & \TB & & & & & \\
\multicolumn{1}{|m|}{\footnotesize\textsc{\cite[]{Wellmann2020}}}
& \TB
& \TB
& \TB
& \TB & \TB & \TB
& \TB & \TB & \TB & \TB & & & \\
\multicolumn{1}{|m|}{\footnotesize\textsc{\cite[]{Padmini2021}}}
& \TB
& \TB
& \TB
& \TB & & \TB
& & \TB & \TB & \TB & \TB & \TB & \\
\multicolumn{1}{|m|}{\footnotesize\textsc{\cite[]{Viehhauser2021}}}
& \TB
&
& \TB
& & \TB & \TB
& \TB & \TB & & & & & \\
\multicolumn{1}{|m|}{\footnotesize\textsc{\cite[]{Plattfaut2020}}}
& \TB
& \TB
&
& \TB & \TB & \TB
& & \TB & \TB & \TB & & & \TB \\
\multicolumn{1}{|m|}{\footnotesize\textsc{\cite[]{ChristianLangmann2021}}}
& \TB
& \TB
& \TB
& \TB & \TB & \TB
& \TB & & & \TB & \TB & & \\
\multicolumn{1}{|m|}{\footnotesize\textsc{\cite[]{Smeets2019}}}
& \TB
& \TB
& \TB
& \TB & & \TB
& & & \TB & & & & \\
\textbf{Total}
& 14
& 9
& 9
& 8 & 7 & 7
& 6 & 5 & 4 & 4 & 2 & 1 & 1 \\
\end{tblr}
\end{center}
\end{document}
目标是将表格行分组为几组(类似于将列分组为“特征”)。看起来像下面的 .ppt 草图:
你能帮忙吗?
提前非常感谢您的提示!
答案1
像这样?
编辑:
据我所知,使用small
字体大小时,表格也可以适合页面。此外,如果整个表格都使用此尺寸,表格会更加一致:
您需要添加一列,并在第一列使用的单元格中添加cmd=\rotcell[cc]
。表格规则需要多加注意。请参阅 MWE:
\documentclass{article}
\usepackage[margin=25mm]{geometry}
\usepackage{rotating} % needed
\usepackage{makecell} % needed
\usepackage{xcolor}
\usepackage{tabularray}
\newcommand\TB{\textbullet}
\begin{document}
\begin{center}
\small
\settowidth\rotheadsize{\footnotesize{Number and Stability of Systems}} % from makecell
\begin{tblr}{hline{1,Z} = {2-Z}{1pt},
hline{2} = {3-Z}{solid},
hline{3} = 0.6pt,
hline{4-Y}=solid,
vline{1} = {3-Y}{solid},
vline{2-Z},
colspec = {c Q[l,font=\scshape] *{11}{c}},
cell{3-Z}{1} = {cmd=\rotcell[cc]},
cell{2}{2-Z} = {cmd=\rotcell},
row{1} = {font=\bfseries},
vspan = even
}
& \SetCell[r=2]{f, font=\bfseries} Articles
& \SetCell[c=11]{c} Characteristic
& & & & & & & & & & \\
& & Execution Frequency
& Execution Time
& Maturity
& Determinism
& Standardization
& Machine-Readable Data
& Human Involvement
& Proneness to Human Error
& Business Impact
& Number and Stability of Systems
& Compliance and Security
& End of Life
& Automation in other Systems \\
\SetCell[r=4]{c} Group 1
& \citet{Choi2021}
& \TB & \TB
& & & & & & & & & & & \\
& \citet{Agostinelli2021}
& \TB
& & & & & & & & & & & & \\
& \citet{Leno2020a}
& \TB
& & & & & & & & & & & & \\
& \citet{Gao2019}
& \TB
& & & & & & & & & & & & \\
\SetCell[r=4]{c} Group 2
& \citet{Rhouati2021}
& \TB
& & \TB
& \TB & & \TB
& \TB & & & & & & \\
& \citet{Lacity2016}
& \TB
& \TB
& \TB
& \TB & \TB
& & & & & & & & \\
& \citet{Leshob2018}
& \TB
& \TB
& \TB
& \TB & \TB
& & \TB
& & & & & & \\
& \citet{wanner2019process}
& \TB
& \TB
& \TB
& & \TB &
& \TB & \TB & & & & & \\
\SetCell[r=4]{c} Group 3
& \citet{Wellmann2020}
& \TB
& \TB
& \TB
& \TB & \TB & \TB
& \TB & \TB & \TB & \TB & & & \\
& \citet{Padmini2021}
& \TB
& \TB
& \TB
& \TB & & \TB
& & \TB & \TB & \TB & \TB & \TB & \\
& \citet{Viehhauser2021}
& \TB
&
& \TB
& & \TB & \TB
& \TB & \TB & & & & & \\
& \citet{Plattfaut2020}
& \TB
& \TB
&
& \TB & \TB & \TB
& & \TB & \TB & \TB & & & \TB \\
\SetCell[r=2]{c} Group 4
& \citet{ChristianLangmann2021}
& \TB
& \TB
& \TB
& \TB & \TB & \TB
& \TB & & & \TB & \TB & & \\
& \citet{Smeets2019}
& \TB
& \TB
& \TB
& \TB & & \TB
& & & \TB & & & & \\
& \textbf{Total}
& 14
& 9
& 9
& 8 & 7 & 7
& 6 & 5 & 4 & 4 & 2 & 1 & 1 \\
\end{tblr}
\end{center}
\end{document}
笔记:
- 不要混合
tabularray
和其他表包的语法 - 版本 2022A 以上的软件包
tabularray
不支持命令multirow
和\multicolumn
- 将单元格的内容形成移至表格前言是明智的(如上面的 MWE 中所做的那样)
- 由于不知道参考书目以及用于它的包,命令
\citet
未定义。因此必须强制编译 MWE,才能显示结果。
答案2
与。{NiceTabular}
nicematrix
在 中{NiceTabular}
,您可以使用命令 水平和垂直合并单元格\Block
。对于行,您可以指定逻辑行数(而不是像 那样的物理行数\multicolumn
)。
使用键hvlines
,绘制所有规则,除了块(由 构造\Block
)和角落(由键 指定corners
)之外。
\documentclass{article}
\usepackage[margin=25mm]{geometry}
\usepackage{nicematrix}
\newcommand\TB{\textbullet}
\begin{document}
\begin{center}
\small
\begin{NiceTabular}{cl*{13}{c}}[corners,hvlines,cell-space-limits=6pt]
& \Block{2-1}{}
& \Block{1-*}{\textbf{Characteristic}} \\
& \textbf{Articles}
& \RowStyle{\rotate}
Execution Frequency
& Execution Time
& Maturity
& Determinism
& Standardization
& Machine-Readable Data
& Human Involvement
& Proneness to Human Error
& Business Impact
& Number and Stability of Systems
& Compliance and Security
& End of Life
& Automation in other Systems \\
\Block{4-1}<\rotate>{Group 1}
& \textsc{Choi2021}
& \TB & \TB
& & & & & & & & & & & \\
& \textsc{Agostinelli2021}
& \TB
& & & & & & & & & & & & \\
& \textsc{Leno2020a}
& \TB
& & & & & & & & & & & & \\
& \textsc{Gao2019}
& \TB
& & & & & & & & & & & & \\
\Block{4-1}<\rotate>{Group 2}
& \textsc{Rhouati2021}
& \TB
& & \TB
& \TB & & \TB
& \TB & & & & & & \\
& \textsc{Lacity2016}
& \TB
& \TB
& \TB
& \TB & \TB
& & & & & & & & \\
& \textsc{Leshob2018}
& \TB
& \TB
& \TB
& \TB & \TB
& & \TB
& & & & & & \\
& \textsc{wanner2019process}
& \TB
& \TB
& \TB
& & \TB &
& \TB & \TB & & & & & \\
\Block{4-1}<\rotate>{Group 3}
& \textsc{Wellmann2020}
& \TB
& \TB
& \TB
& \TB & \TB & \TB
& \TB & \TB & \TB & \TB & & & \\
& \textsc{Padmini2021}
& \TB
& \TB
& \TB
& \TB & & \TB
& & \TB & \TB & \TB & \TB & \TB & \\
& \textsc{Viehhauser2021}
& \TB
&
& \TB
& & \TB & \TB
& \TB & \TB & & & & & \\
& \textsc{Plattfaut2020}
& \TB
& \TB
&
& \TB & \TB & \TB
& & \TB & \TB & \TB & & & \TB \\
\Block{2-1}<\rotate>{Group 4}
& \textsc{ChristianLangmann2021}
& \TB
& \TB
& \TB
& \TB & \TB & \TB
& \TB & & & \TB & \TB & & \\
& \textsc{Smeets2019}
& \TB
& \TB
& \TB
& \TB & & \TB
& & & \TB & & & & \\
& \textbf{Total}
& 14
& 9
& 9
& 8 & 7 & 7
& 6 & 5 & 4 & 4 & 2 & 1 & 1 \\
\end{NiceTabular}
\end{center}
\end{document}
您需要多次编译(因为nicematrix
在后台使用 PGF/Tikz 节点)。