如何使该表第一行的元素像这张照片一样旋转

如何使该表第一行的元素像这张照片一样旋转

我正在尝试制作这张表,正如你所看到的,第一行被旋转了

在此处输入图片描述

到目前为止我已经做到了

在此处输入图片描述

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

我很感谢你的帮助

编辑:

我到目前为止已经做到了

在此处输入图片描述

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

但线条不见了,而且不适合这个页面

答案1

像这样:

在此处输入图片描述

使用tabularraymakecellrotating很简单:

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

答案2

编辑:

6.21 版本nicematrix提供\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 & 
\rotate[c](1,1) & 
\rotate[c](1,2) & 
\rotate[c](2,1) & 
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}

第一个代码的输出


这是一个{NiceTabular}使用 的解决方案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}

您需要多次编译(因为nicematrix在后台使用 PGF/Tikz 节点)。

第二段代码的输出

如果希望第一行的元素垂直居中,应该使用v-center命令键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}

这段代码的输出

答案3

尽可能tabularray分离adjustbox内容和形式

备注:cell{2}{16-18} = {cmd=\rotatebox[origin=c]{90}}不起作用。

代码

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

在此处输入图片描述

相关内容