我怎样才能让小细胞一直扩大,无论它们的数量如何

我怎样才能让小细胞一直扩大,无论它们的数量如何

我想要的是这个 在此处输入图片描述

这是我的代码

\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

\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}

上述代码的输出

您还可以定义辅助命令\Divide以提高可读性。

\documentclass{article}
\usepackage{nicematrix}

\ExplSyntaxOn
\NewExpandableDocumentCommand { \Divide } { m }
  { \omit \hfil \clist_use:nn { #1 } { \hfil \vline \hfil } \hfil }
\ExplSyntaxOff

\begin{document}

\begin{NiceTabular}{lw{c}{5cm}}[hvlines,cell-space-limits=3pt]
\Block{4-1}{Expressiveness} & Modality \\
               &  \Divide{P,O,A} \\
               & Expressive Symbols \\
               &  \Divide{P,O,A} \\           
\Block{6-1}{Replication} & Placeholders \\
               &  \Divide{P,O,A,S,F} \\
               &  Stacking \\
               &  \Divide{P,O,A} \\
               &  Affixing \\
               &  \Divide{P,O} \\
\Block{8-1}{Narration} & Storyline Foundation \\
               &  \Divide{1,2,3} \\
               &  Block Formation \\
               &  \Divide{{(1 , 1)},{(1 , 2)},{(2 , 1)}} \\
               &  Group Composition \\
               &  \Divide{P,O} \\  
               &  Frame Fixation \\
               &  \Divide{P,O,A,Grouped P,Grouped O} \\
\Block{8-1}{Connection} & Progression \\
               &  \Divide{P,O,A} \\
               &  Transition \\
               &  \Divide{P,O,A} \\
               &  Aggregation \\
               &  \Divide{P,O,A} \\  
               &  Execution \\
               &  \Divide{P,O,A} \\  
\end{NiceTabular}

\end{document}

相关内容