1

I have this table

enter image description here

I'm trying to convert it to this

enter image description here

my code is this

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

UPDATE:

So far

I don't know how to force rows with just 3 elements to divide by 3 and avoid any empty cell Also the first column whatever I do, I cannot expand it to make a room for text

enter image description here

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

UPDATE2 Thanks to F. Pantigny:

The problems are the empty cells

How can I force the small cell that expand all the way and fill the space without empty cell

for example divided by 2, 3, 4, 5

enter image description here

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

2 Answers 2

2

As far as I know, this can be obtained by nesting tabular in tblr cells For example, as starting point:

Edit: from OP comment follows, the table in nested tabulars hasn't vertical lines, so code is now a wee bit simpler:

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

enter image description here

3
  • Thanks when I try it mine doesn't have the lines between P, O, A Any package missing ?
    – zEn feeLo
    Commented Jul 28, 2023 at 6:43
  • imgur.com/a/T9PDW5k look plz
    – zEn feeLo
    Commented Jul 28, 2023 at 6:48
  • @KamranAsgari, on images on your question are shown ... Without them the solution is even simpler. See edited answer
    – Zarko
    Commented Jul 28, 2023 at 7:59
2

With {NiceTabular} of 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}

Output of the above code

3
  • 1
    Nice solution +1
    – MS-SPO
    Commented Jul 27, 2023 at 19:26
  • Thank you How can I have 5 cells under modality and 3 cells under Expressive symbols the maximum is 5 and the minum is 2
    – zEn feeLo
    Commented Jul 27, 2023 at 19:59
  • I really appreciate anyone answer this question, Tomorrow I need to upload my Thesis and this is the only table remained, If I cannot solve I have to design it (which I'm very good at) but I really prefer LateX :)
    – zEn feeLo
    Commented Jul 28, 2023 at 0:08

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .