我有这张桌子
我正在尝试将其转换为这个
我的代码是这样的
\documentclass{article}
\usepackage{graphicx} % Required for inserting images
\usepackage{tabularray}
\begin{document}
\begin{table}
\centering
\begin{tblr}{hlines, vlines, colspec={ll}}
\SetCell[r=6]{} Expression
& \SetCell[r=3]{} Modality
& P \\
& O \\
& A \\
& \SetCell[r=3]{} Expressive Symbols
& P \\
& O \\
& A \\
\end{tblr}
\caption{The Audit CheckList}
\label{table:DesignPrinciples}
\end{table}
\end{document}
更新:
迄今为止
我不知道如何强制将只有 3 个元素的行除以 3 并避免出现任何空单元格。此外,无论我做什么,第一列都无法扩展它来为文本腾出空间
\documentclass{article}
\usepackage{nicematrix}
\begin{document}
\begin{NiceTabular}{ccccccc}[hvlines]
\Block{4-2}{Expressiveness} & & \Block{1-5}{Modality} \\
& & P & O & A & & \\
& & \Block{1-5}{Expressive Symbols} \\
& & P & O & A & & \\
\Block{6-2}{Replication} & & \Block{1-5}{Placeholders} \\
& & P & O & A & S & F\\
& & \Block{1-5}{Stacking} \\
& & P & O & A & & \\
& & \Block{1-5}{Afixing} \\
& & P & O & & & \\
\Block{8-2}{Narration} & & \Block{1-5}{Storyline Formation} \\
& & 1 & 2 & 3 & & \\
& & \Block{1-5}{Block Formation} \\
& & (1 , 1) & (1 , 2) & (2 , 1) & & \\
& & \Block{1-5}{Group Composition} \\
& & P & O & & & \\
& & \Block{1-5}{Frame Fixation} \\
& & P & O & A & Grouped P & Grouped A\\
\Block{8-2}{Connection} & & \Block{1-5}{Progression} \\
& & P & O & A & & \\
& & \Block{1-5}{Transition} \\
& & P & O & A & & \\
& & \Block{1-5}{Aggregation} \\
& & P & O & A & & \\
& & \Block{1-5}{Execution} \\
& & P & O & A & & \\
\end{NiceTabular}
\end{document}
更新2 感谢 F. Pantigny:
问题在于空单元格
我怎样才能强制小单元格一直扩展并填充空间而没有空单元格
例如除以 2、3、4、5
\documentclass{article}
\usepackage{nicematrix}
\begin{document}
\begin{NiceTabular}{lccccc}[hvlines,cell-space-limits=3pt]
\Block{4-1}{Expressiveness} & \Block{1-5}{Modality} \\
& P & O & A \\
& \Block{1-5}{Expressive\\ Symbols} \\
& P & O & A \\
\Block{6-1}{Replication} & \Block{1-5}{Placeholders} \\
& P & O & A & S & F\\
& \Block{1-5}{Stacking} \\
& P & O & A \\
& \Block{1-5}{Affixing} \\
& P & O \\
\Block{8-1}{Narration} & \Block{1-5}{Storyline Foundation} \\
& 1 & 2 & 3\\
& \Block{1-5}{Block Formation} \\
& (1 , 1) & (1 , 2) & (2 , 1) \\
& \Block{1-5}{Group Composition} \\
& P & O \\
& \Block{1-5}{Frame Fixation} \\
& P & O & A & Grouped P & Grouped O\\
\Block{8-1}{Connection} & \Block{1-5}{Progression} \\
& P & O & A \\
& \Block{1-5}{Transition} \\
& P & O & A \\
& \Block{1-5}{Aggregation} \\
& P & O & A \\
& \Block{1-5}{Execution} \\
& P & O & A \\
\end{NiceTabular}\newline\newline\newline
\end{document}
答案1
据我所知,这可以通过嵌套单元格来获得tabular
例如tblr
作为起点:
编辑:从OP评论可以看出,嵌套的s中的表tabular
没有垂直线,因此代码现在稍微简单一些:
\documentclass{article}
\usepackage{array}
\usepackage{tabularray}
\begin{document}
\begin{table}
\centering
\begin{tblr}{hlines, vlines, colspec={lc},
row{even} = {rowsep=0pt}
}
\SetCell[r=4]{} Expression
& Modality \\
& \begin{tabular}{@{} *{3}{w{c}{3.33 em}} @{}} % 3.33 = 10/3
P & O & A
\end{tabular} \\
& Expressive Symbols \\
& \begin{tabular}{@{} *{5}{w{c}{2em}} @{}} % 2 = 10/5
P & O & A & S & F
\end{tabular} \\
\end{tblr}
\caption{The Audit CheckList}
\label{table:DesignPrinciples}
\end{table}
\end{document}
答案2
与。{NiceTabular}
nicematrix
\documentclass{article}
\usepackage{nicematrix}
\begin{document}
\begin{NiceTabular}{lw{c}{5cm}}[hvlines,cell-space-limits=3pt]
\Block{4-1}{Expressiveness} & Modality \\
& \omit\hfil P\hfil\vrule\hfil O\hfil\vrule\hfil A\hfil \\
& Expressive Symbols \\
& \omit\hfil P\hfil\vrule\hfil O\hfil\vrule\hfil A\hfil \\
\Block{6-1}{Replication} & Placeholders \\
& \omit\hfil P\hfil\vrule\hfil O\hfil\vrule\hfil A\hfil\vrule\hfil S\hfil\vrule\hfil F\hfil \\
& Stacking \\
& \omit\hfil P\hfil\vrule\hfil O\hfil\vrule\hfil A\hfil \\
& Affixing \\
& \omit\hfil P\hfil\vrule\hfil O\hfil \\
\Block{8-1}{Narration} & Storyline Foundation \\
& \omit\hfil 1\hfil\vrule\hfil 2\hfil\vrule\hfil 3\hfil \\
& Block Formation \\
& \omit\hfil (1 , 1)\hfil\vrule\hfil (1 , 2)\hfil\vrule\hfil (2 , 1)\hfil \\
& Group Composition \\
& \omit\hfil P\hfil\vrule\hfil O\hfil \\
& Frame Fixation \\
& \omit\hfil P\hfil\vrule\hfil O\hfil\vrule\hfil A\hfil\vrule\hfil Grouped P\hfil\vrule\hfil Grouped O\hfil \\
\Block{8-1}{Connection} & Progression \\
& \omit\hfil P\hfil\vrule\hfil O\hfil\vrule\hfil A\hfil \\
& Transition \\
& \omit\hfil P\hfil\vrule\hfil O\hfil\vrule\hfil A\hfil \\
& Aggregation \\
& \omit\hfil P\hfil\vrule\hfil O\hfil\vrule\hfil A\hfil \\
& Execution \\
& \omit\hfil P\hfil\vrule\hfil O\hfil\vrule\hfil A\hfil \\
\end{NiceTabular}
\end{document}