2

I'm trying to make this table and as you see it, the first row is rotated

enter image description here

So far I've done this

enter image description here

\begin{tabular}{|*{41}{c|}}  % repeats {c|} 18 times
\hline
\multicolumn{5}{|c}{Placeholders} & \multicolumn{2}{|c|}{Grouping} &
\multicolumn{3}{|c|}{Stacking} &
\multicolumn{2}{|c|}{Affixed} &
\multicolumn{3}{|c|}{Formation} & \multicolumn{3}{|c|}{Foundation} &
\multicolumn{3}{|c|}{Progression} &
\multicolumn{3}{|c|}{Transition} &
\multicolumn{3}{|c|}{Aggregation} &
\multicolumn{3}{|c|}{Execution} &
\multicolumn{5}{|c|}{Fixation} &
\multicolumn{3}{|c|}{Modality} &
\multicolumn{3}{|c|}{Meta Symbol} \\ \hline 
P & O & A & S & F & P & O & P & O & A & P & O & 1 & 2 & 3 & (1, 1) & (1, 2) & (2, 1) & P & O & A & P & O & A & P & O & A & P & O & A & P & O & A & Group P & Group A & P & O & A & P & O & A \\ \hline
\end{tabular}

I appreciate the help

Edit:

I managed to do this so far

enter image description here

\newcolumntype{R}[2]{%
    >{\adjustbox{angle=#1,lap=\width-(#2)}\bgroup}%
    c%
    <{\egroup}%
}

\newcommand*\rottttt{\multicolumn{5}{R{90}{1em}}}%

\newcommand*\rottt{\multicolumn{3}{R{90}{1em}}}%

\newcommand*\rott{\multicolumn{2}{R{90}{1em}}}%

\begin{tabular}{|*{41}{c|}} \hline \rottttt{Placeholders} & \rott{Grouping} & \rottt{Stacking} & \rott{Affixed} & \rottt{Formation} & \rottt{Foundation} & \rottt{Progression} & \rottt{Transition} & \rottt{Aggregation} & \rottt{Execution} & \rottttt{Fixation} & \rottt{Modality} & \rottt{Meta Symbol} \ \hline P & O & A & S & F & P & O & P & O & A & P & O & 1 & 2 & 3 & (1, 1) & (1, 2) & (2, 1) & P & O & A & P & O & A & P & O & A & P & O & A & P & O & A & Group P & Group A & P & O & A & P & O & A \ \hline \end{tabular}

But the lines are gone and It's not fitting in the page

zEn feeLo
  • 175

3 Answers3

3

Like this:

enter image description here

With tabularray, makecell and rotating package is simple:

\documentclass{article}
\usepackage[margin=25mm]{geometry}

\usepackage{rotating} % needed \usepackage{makecell} % needed \usepackage{tabularray}

\begin{document} \begin{table}[ht] \begin{tblr}{hlines, vlines, colspec = {*{35}{Q[c,font=\small]}}, colsep = 3pt, rowsep = 0pt, row{1} = {cmd=\settowidth\rotheadsize{Placeholder}\rothead, font=\sffamily\bfseries}, % <---- cell{2-Z}{1-Z} = {m}, } \SetCell[c=5]{} Placeholders
& & & & &
\SetCell[c=2]{} Grouping & &
\SetCell[c=3]{} Stacking & & & \SetCell[c=2]{} Affixed & & \SetCell[c=3]{} Formation & & & \SetCell[c=3]{} Foundation & & & \SetCell[c=3]{} Progression & & & \SetCell[c=3]{} Transition & & & \SetCell[c=3]{} Aggregation & & & \SetCell[c=3]{} Execution & & & \SetCell[c=5]{} Fixation & & & & \ P & O & A & S & F & P & O & P & O & A & P & O & 1 & 2 & 3 & \SetCell{cmd=\settowidth\rotheadsize{(1,2)}\rothead} (1,1) & \SetCell{cmd=\settowidth\rotheadsize{(1,2)}\rothead} (1,2) & \SetCell{cmd=\settowidth\rotheadsize{(1,2)}\rothead} (2,1) & P & O & A & P & O & A & P & O & A & P & O & A & P & O & A & \SetCell{cmd=\settowidth\rotheadsize{Group P}\rothead} Group P & \SetCell{cmd=\settowidth\rotheadsize{Group A}\rothead} Group A \ \end{tblr} \end{table} \end{document}

Zarko
  • 296,517
  • Thanks, how can I center the text in the first row ? :) – zEn feeLo Jul 07 '23 at 20:43
  • @KamranAsgari, but it is centered (horizontally) ! Do you like to have vertical centered too? Well, frankly said to my opinion this ugly design of table, I will not do this. But if you insist to do this, let me know. I will look tommorow, what I can do. – Zarko Jul 07 '23 at 21:02
  • because there are 3 rows, one extra on top of that , what do you think ? maybe only the first row vertically bottom and the second and third row centred ? – zEn feeLo Jul 07 '23 at 21:11
  • I'm also thinking, the whole table should be rotated :( that's gonna better design – zEn feeLo Jul 07 '23 at 21:11
3

EDIT:

With the version 6.21 of nicematrix which provides \rotate[c]:

\documentclass{article}
\usepackage[margin=25mm]{geometry}
\usepackage{nicematrix}

\begin{document} \begin{table}[ht] \setlength{\tabcolsep}{1pt} \begin{NiceTabular}{*{35}{c}}[hvlines,cell-space-limits=2pt] \RowStyle{\rotate[c]} \Block{1-5}{Placeholders} & & & & &
\Block{1-2}{Grouping} & &
\Block{1-3}{Stacking} & & & \Block{1-2}{Affixed} & & \Block{1-3}{Formation} & & & \Block{1-3}{Foundation} & & & \Block{1-3}{Progression} & & & \Block{1-3}{Transition} & & & \Block{1-3}{Aggregation} & & & \Block{1-3}{Execution} & & & \Block{1-5}{Fixation} & & & & \ P & O & A & S & F & P & O & P & O & A & P & O & 1 & 2 & 3 & \rotatec & \rotatec & \rotatec & P & O & A & P & O & A & P & O & A & P & O & A & P & O & A & \rotate[c]Group P & \rotate[c]Group A \ \end{NiceTabular} \end{table} \end{document}

Output of the first code


Here is a solution with {NiceTabular} of nicematrix.

\documentclass{article}
\usepackage[margin=25mm]{geometry}
\usepackage{nicematrix}

\begin{document} \begin{table}[ht] \setlength{\tabcolsep}{1pt} \begin{NiceTabular}{*{35}{c}}[hvlines,cell-space-limits=2pt] \RowStyle{\rotate} \Block{1-5}{Placeholders} & & & & &
\Block{1-2}{Grouping} & &
\Block{1-3}{Stacking} & & & \Block{1-2}{Affixed} & & \Block{1-3}{Formation} & & & \Block{1-3}{Foundation} & & & \Block{1-3}{Progression} & & & \Block{1-3}{Transition} & & & \Block{1-3}{Aggregation} & & & \Block{1-3}{Execution} & & & \Block{1-5}{Fixation} & & & & \ P & O & A & S & F & P & O & P & O & A & P & O & 1 & 2 & 3 & \rotatebox[origin=c]{90}{(1,1)} & \rotatebox[origin=c]{90}{(1,2)} & \rotatebox[origin=c]{90}{(2,1)} & P & O & A & P & O & A & P & O & A & P & O & A & P & O & A & \rotatebox[origin=c]{90}{Group P} & \rotatebox[origin=c]{90}{Group A} \ \end{NiceTabular} \end{table} \end{document}

You need several compilations (because nicematrix uses PGF/Tikz nodes under the hood).

Output of the second code

If you want the elements of the first row vertically centered, you should use the key v-center of the command Block.

\documentclass{article}
\usepackage[margin=25mm]{geometry}
\usepackage{nicematrix}

\begin{document} \begin{table}[ht] \setlength{\tabcolsep}{1pt} \begin{NiceTabular}{*{35}{c}}[hvlines,cell-space-limits=2pt] \RowStyle{\rotate} \Block[v-center]{1-5}{Placeholders} & & & & &
\Block[v-center]{1-2}{Grouping} & &
\Block[v-center]{1-3}{Stacking} & & & \Block[v-center]{1-2}{Affixed} & & \Block[v-center]{1-3}{Formation} & & & \Block[v-center]{1-3}{Foundation} & & & \Block[v-center]{1-3}{Progression} & & & \Block[v-center]{1-3}{Transition} & & & \Block[v-center]{1-3}{Aggregation} & & & \Block[v-center]{1-3}{Execution} & & & \Block[v-center]{1-5}{Fixation} & & & & \ P & O & A & S & F & P & O & P & O & A & P & O & 1 & 2 & 3 & \rotatebox[origin=c]{90}{(1,1)} & \rotatebox[origin=c]{90}{(1,2)} & \rotatebox[origin=c]{90}{(2,1)} & P & O & A & P & O & A & P & O & A & P & O & A & P & O & A & \rotatebox[origin=c]{90}{Group P} & \rotatebox[origin=c]{90}{Group A} \ \end{NiceTabular} \end{table} \end{document}

Output of the thirs code

F. Pantigny
  • 40,250
1

With tabularray and adjustbox by separating content and form as much as possible

remark: cell{2}{16-18} = {cmd=\rotatebox[origin=c]{90}} don't work.

The code

\documentclass{article}
\usepackage[margin=25mm]{geometry}
\usepackage{adjustbox}
\usepackage{tabularray}

\begin{document}

\begin{table}[ht] \begin{tblr}{ hlines, vlines, colspec = {*{35}{Q[c,m,font=\small]}}, stretch = 0, colsep = 3pt, rowsep = 2pt, row{1} = {cmd=\rotatebox{90}, font=\sffamily\bfseries}, cell{1}{1,31} = {r=1,c=5}{c}, cell{1}{6,11} = {r=1,c=2}{c}, cell{1}{8,13,16,19,22,25,28} = {r=1,c=3}{c},
%cell{2}{16-18} = {cmd=\rotatebox[origin=c]{90}}, cell{2}{34-35} = {h,cmd=\rotatebox{90}}, } Placeholders&&&&& Grouping&& Stacking&&& Affixed&& Formation&&& Foundation&&& Progression&&& Transition&&& Aggregation&&& Execution&&& Fixation&&&& \ % P & O & A & S & F & P & O & P & O & A & P & O & 1 & 2 & 3 & \rotatebox[origin=c]{90}{(1,1)} & \rotatebox[origin=c]{90}{(1,2)} & \rotatebox[origin=c]{90}{(2,1)} & P & O & A & P & O & A & P & O & A & P & O & A & P & O & A & Group P & Group A \end{tblr} \end{table} \end{document}

enter image description here

pascal974
  • 4,652