表格内的复杂数组环境

表格内的复杂数组环境

我想知道是否可以使用表格环境创建如图所示的表格。感谢您的帮助。问候 Sujeet在此处输入图片描述

答案1

与。{NiceTabular}nicematrix

\documentclass{article}
\usepackage{nicematrix}
\usepackage{booktabs}

\begin{document}

\begin{NiceTabular}{cccccc}
  \toprule
  $n$ & Mean & Std. Dev. & \Block{1-3}{$p$ value between categories ($<0.05$)} \\
  \midrule
  166 & 3.04 & 0.96 & \Block{4-1}{$p=0.001$} \\
  428 & 2.93 & 0.83 & & \Block{3-1}{$p=0.001$} \\
  332 & 2.90 & 0.79 & & & \Block{2-1}{$p=0.022$} \\
  216 & 2.69 & 0.86 \\
  \midrule
  $n$ & Mean & Std. Dev. & \Block{1-3}{$p$ value between categories ($<0.05$)} \\
  \bottomrule
\CodeAfter
  \SubMatrix{.}{2-1}{5-3}{\}}
  \SubMatrix{.}{3-1}{5-4}{\}}
  \SubMatrix{.}{4-1}{5-5}{\}}
\end{NiceTabular}

\end{document}

上述代码的输出

答案2

一些帮助你入门的东西

在此处输入图片描述

\documentclass{article}

\begin{document}

\begin{tabular}{cccc}
  111&3.01&0.11&\\
  222&2.02&0.21&\\
  333&2.03&0.31&\\
  444&1.04&0.41&
\smash{%
\raisebox{1.5\normalbaselineskip}{%
  $\left\}\rule{0pt}{2\normalbaselineskip}\right. p=0.001$}%
\quad
\raisebox{1\normalbaselineskip}{%
  $\left\}\rule{0pt}{1.5\normalbaselineskip}\right. p=0.002$}%
\quad
\raisebox{.5\normalbaselineskip}{%
  $\left\}\rule{0pt}{1\normalbaselineskip}\right. p=0.003$}%
}\\
\end{tabular}
\end{document}

相关内容