如何使表格中某一行的旋转单元格内容顶部对齐?

如何使表格中某一行的旋转单元格内容顶部对齐?

考虑以下 MWE:

\documentclass[]{scrartcl}

% PACKAGES

\usepackage[]{mathtools,amsthm,amssymb,mathrsfs,mathalfa} % Math Packages
\usepackage[]{bm} % To get bold math.
\usepackage[]{makecell} % To get vertical text on cell contents.
\usepackage[]{rotating} % To get vertical text on cell contents.

% SHORT IFF

\renewcommand\iff{\Leftrightarrow}%

% RULE BELOW SECTION TITLES

\begin{document}

\centering
\settowidth\rotheadsize{XXXX}
\renewcommand\theadfont{\normalsize}
\renewcommand{\arraystretch}{2}
\begin{tabular}{cc|cccccccccccc}
    \rothead{$\bm{p}$} & \rothead{$\bm{q}$} & \rothead{$F$} & \rothead{$T$} & \rothead{$p\wedge q$} & \rothead{$p\vee q$} & \rothead{$p\Rightarrow q$} & \rothead{$p\iff q$} & \rothead{$p$} & \rothead{$q$} & \rothead{$\neg p$} & \rothead{$\neg q$}\\[1pt]\hline
    $\bm{T}$ & $\bm{T}$ & $F$ & $T$ & $T$ & $T$ & $T$ & $T$ & $T$ & $T$ & $F$ & $F$\\[1pt]
    $\bm{T}$ & $\bm{F}$ & $F$ & $T$ & $F$ & $T$ & $F$ & $F$ & $T$ & $F$ & $F$ & $T$\\[1pt]
    $\bm{F}$ & $\bm{T}$ & $F$ & $T$ & $F$ & $T$ & $T$ & $F$ & $F$ & $T$ & $T$ & $F$\\[1pt]
    $\bm{F}$ & $\bm{F}$ & $F$ & $T$ & $F$ & $F$ & $T$ & $T$ & $F$ & $F$ & $T$ & $T$\\[1pt]\hline
    \multicolumn{2}{c|}{\rothead{\textbf{Adj.}}} & \rothead{\textit{false}} & \rothead{\textit{true}} & \rothead{\textit{and}} & \rothead{\textit{or}} & \rothead{\textit{impl.}} & \rothead{\textit{equiv.}} & \rothead{\textit{$p$ id.}} & \rothead{\textit{$q$ id.}} & \rothead{\textit{$p$ neg.}} & \rothead{\textit{$q$ neg.}}\\[1pt]
\end{tabular}

\end{document}

输出如下:

在此处输入图片描述

我希望最后一行的单元格内容水平居中(它们已经是了),但是垂直对齐到顶部而不是底部。我尝试过许多关于单元格内容垂直对齐的答案中的方法,但没有成功。

你能帮助我吗?

答案1

像这样吗?

在此处输入图片描述

\documentclass{scrartcl}

\usepackage{mathtools,amsthm,amssymb,mathrsfs,mathalfa} % Math Packages
\usepackage{bm}       % bold-italic math.
\usepackage{comment}  % easily comment large chunks.
\usepackage{makecell} % get vertical tex.
\usepackage{rotating} % get vertical tex. % twice?

% SHORT IFF
\renewcommand\iff{\Leftrightarrow}%

\begin{document}

\begingroup % limit scope of next 4 instructions to current TeX group

\settowidth\rotheadsize{XXXX}
\renewcommand\theadfont{\normalsize}
\renewcommand{\arraystretch}{2}
\centering

$\begin{array}{@{} cc | *{10}{c} @{}}
\rothead{$\bm{p}$} & 
\rothead{$\bm{q}$} & 
\rothead{$F$} & 
\rothead{$T$} & 
\rothead{$p\wedge q$} & 
\rothead{$p\vee q$} & 
\rothead{$p\Rightarrow q$} & 
\rothead{$p\iff q$} & 
\rothead{$p$} & 
\rothead{$q$} & 
\rothead{$\neg p$} & 
\rothead{$\neg q$}\\[1pt]
\hline
    \bm{T} & \bm{T} & F & T & T & T & T & T & T & T & F & F\\[1pt]
    \bm{T} & \bm{F} & F & T & F & T & F & F & T & F & F & T\\[1pt]
    \bm{F} & \bm{T} & F & T & F & T & T & F & F & T & T & F\\[1pt]
    \bm{F} & \bm{F} & F & T & F & F & T & T & F & F & T & T\\[1pt]\hline
\multicolumn{2}{@{}c|}{\textrm{Adject.}} & 
\rothead{\hfill\textrm{false}} & 
\rothead{\hfill\textrm{true}}  & 
\rothead{\hfill\textrm{and}}   & 
\rothead{\hfill\textrm{or}}    & 
\rothead{\hfill\textrm{impl.}} & 
\rothead{\hfill\textrm{equiv.}}   & 
\rothead{\hfill\textrm{$p$ id.}}  & 
\rothead{\hfill\textrm{$q$ id.}}  & 
\rothead{\hfill\textrm{$p$ neg.}} & 
\rothead{\hfill\textrm{$q$ neg.}} \\
\end{array}$

\endgroup

\end{document}

答案2

与。{NiceTabular}nicematrix

\documentclass{scrartcl}
\usepackage{nicematrix}

\begin{document}

\begin{table}
\centering
\renewcommand{\arraystretch}{2}
\begin{NiceTabular}
  [
    first-row , code-for-first-row = \rotate ,
    last-row = 5 , code-for-last-row = \rotate , % \rotate in last-row will do the top-alignment
  ]
  {*{2}{>{\mathversion{bold}}c}!{\vrule}cccccccccc}
    $p$ & $q$ & $F$ & $T$ & $p\wedge q$ & $p\vee q$ & $p\Rightarrow q$ & $p \iff q$ & $p$ & $q$ & $\neg    p$ & $\neg q$ \\ \hline
    $T$ & $T$ & $F$ & $T$ & $T$ & $T$ & $T$ & $T$ & $T$ & $T$ & $F$ & $F$ \\
    $T$ & $F$ & $F$ & $T$ & $F$ & $T$ & $F$ & $F$ & $T$ & $F$ & $F$ & $T$ \\
    $F$ & $T$ & $F$ & $T$ & $F$ & $T$ & $T$ & $F$ & $F$ & $T$ & $T$ & $F$ \\
    $F$ & $F$ & $F$ & $T$ & $F$ & $F$ & $T$ & $T$ & $F$ & $F$ & $T$ & $T$ \\ \hline
    \Block{1-2}{\bfseries Adj.} & & \RowStyle{\itshape} false & true & and & or & impl. & equiv. & $p$ id. & $q$ id. & $p$ neg. & $q$ neg.
\end{NiceTabular}
\end{table}

\end{document}

上述代码的输出

相关内容