请问 Program Program 单元格后面的行应如何填写?
\documentclass[12pt,a4paper]{report}
\setlength\textwidth{145mm}
\setlength\textheight{247mm}
\setlength\oddsidemargin{15mm}
\setlength\evensidemargin{15mm}
\setlength\topmargin{0mm}
\setlength\headsep{0mm}
\setlength\headheight{0mm}
\let\openright=\clearpage
\usepackage{dcolumn}
\usepackage{booktabs}
\usepackage{makecell}
\usepackage{multirow, tabularx}
\newcolumntype{C}{>{\centering\arraybackslash}X}
\begin{document}
\begin{table}[ht!] \catcode`\-=12
\caption{A}
\scriptsize
\renewcommand{\cellset}{\renewcommand{\arraystretch}{0.75}\scriptsize}
\setlength\extrarowheight{2pt}
\setlength\tabcolsep{2pt}
%
\begin{tabularx}{\textwidth}{C|*{2}{C} >{\hsize=0.7\hsize}C >{\hsize=1.3\hsize}Cc*{3}{C}{C}}
\Xhline{1.2pt}\noalign{\vskip 0.4ex}\Xhline{1.2pt}%
\multirowcell{4}{Q} & \multicolumn{2}{c|}{[1]} & \multicolumn{2}{c|}{[2]} & \multicolumn{1}{c|}{[3]} & \multicolumn{3}{c|}{[4]} & \multicolumn{1}{c|}{[5]} \\[0.4ex]
\cline{2-10}
\multicolumn{1}{c|}{} &\multicolumn{2}{c|}{\multirowcell{1.5}{PPPP}}
&\multicolumn{1}{c|}{\multirowcell{3}{P\\ a}} & %
\multicolumn{1}{c|}{\multirowcell{3}{S \\ F \\ D}} &
%
\multicolumn{1}{c|}{ \multirowcell{3}{D }}&\multicolumn{1}{c|}{ \multirowcell{3}{D\\ D\\D}} & \multicolumn{1}{c|}{\multirowcell{3}{D\\ D\\D}} & \multicolumn{1}{c|}{\multirowcell{3}{F\\ F\\F}} & \multicolumn{1}{c|}{\multirowcell{3}{Program \\ Program}} \\[1ex]
\cline{2-3}
& \multicolumn{1}{c|}{\multirowcell{1.5}{II}} & \multicolumn{1}{c|}{\multirowcell{1.5}{III}} & \multicolumn{1}{c|}{}& \multicolumn{1}{c|}{} & \multicolumn{1}{c|}{} & \multicolumn{1}{c|}{} & \multicolumn{1}{c|}{} & \multicolumn{1}{c|}{} \\ [1.5ex]
\Xhline{1.2pt}%
&&&&&&\\[-10pt]
\makecell{$P$ \\ $[$days$]$}& \multicolumn{8}{c}{AAAA}\\
&&&&&&\\[-10pt]
\hline
&&&&&&\\[-10pt]
\makecell{$V$\\ SS}& 71.7755& 21.74(50)& & 15.5(7)&21.1(16) & 15.51& 15.71& 15.34\\
[-10pt]
\\
\Xhline{1.2pt}%
\end{tabularx}
\end{table}
\end{document}
答案1
在 OP 的代码中,\multicolumn{1}{c|}
缺少 a。
\documentclass[12pt,a4paper]{report}
\setlength\textwidth{145mm}
\setlength\textheight{247mm}
\setlength\oddsidemargin{15mm}
\setlength\evensidemargin{15mm}
\setlength\topmargin{0mm}
\setlength\headsep{0mm}
\setlength\headheight{0mm}
\let\openright=\clearpage
\usepackage{dcolumn}
\usepackage{booktabs}
\usepackage{makecell}
\usepackage{multirow, tabularx}
\newcolumntype{C}{>{\centering\arraybackslash}X}
\begin{document}
\begin{table}[ht!] \catcode`\-=12
\caption{A}
\scriptsize
\renewcommand{\cellset}{\renewcommand{\arraystretch}{0.75}\scriptsize}
\setlength\extrarowheight{2pt}
\setlength\tabcolsep{2pt}
%
\begin{tabularx}{\textwidth}{C|*{2}{C} >{\hsize=0.7\hsize}C >{\hsize=1.3\hsize}Cc*{3}{C}{C}}
\Xhline{1.2pt}\noalign{\vskip 0.4ex}\Xhline{1.2pt}%
\multirowcell{4}{Q} & \multicolumn{2}{c|}{[1]} & \multicolumn{2}{c|}{[2]} & \multicolumn{1}{c|}{[3]} & \multicolumn{3}{c|}{[4]} & \multicolumn{1}{c|}{[5]} \\[0.4ex]
\cline{2-10}
\multicolumn{1}{c|}{} &\multicolumn{2}{c|}{\multirowcell{1.5}{PPPP}}
&\multicolumn{1}{c|}{\multirowcell{3}{P\\ a}} & %
\multicolumn{1}{c|}{\multirowcell{3}{S \\ F \\ D}} &
%
\multicolumn{1}{c|}{ \multirowcell{3}{D }}&\multicolumn{1}{c|}{ \multirowcell{3}{D\\ D\\D}} &
\multicolumn{1}{c|}{\multirowcell{3}{D\\ D\\D}} & \multicolumn{1}{c|}{\multirowcell{3}{F\\ F\\F}} &
\multicolumn{1}{c|}{\multirowcell{3}{Program \\ Program \\Program}} \\[1ex]
\cline{2-3}
& \multicolumn{1}{c|}{\multirowcell{1.5}{II}} & \multicolumn{1}{c|}{\multirowcell{1.5}{III}} &
\multicolumn{1}{c|}{}& \multicolumn{1}{c|}{} & \multicolumn{1}{c|}{} & \multicolumn{1}{c|}{} &
\multicolumn{1}{c|}{} & \multicolumn{1}{c|}{} & \multicolumn{1}{c|}{} \\ [1.5ex]
\Xhline{1.2pt}%
&&&&&&\\[-10pt]
\makecell{$P$ \\ $[$days$]$}& \multicolumn{8}{c}{AAAA}\\
&&&&&&\\[-10pt]
\hline
&&&&&&\\[-10pt]
\makecell{$V$\\ SS}& 71.7755& 21.74(50)& & 15.5(7)&21.1(16) & 15.51& 15.71& 15.34\\
[-10pt]
\\
\Xhline{1.2pt}%
\end{tabularx}
\end{table}
\end{document}
评论:用 就简单多了nicematrix
。
答案2
以下是您可以使用 做的{NiceTabular*}
事情nicematrix
。
该环境{NiceTabular}
与经典环境类似,{tabular}
但具有新功能。
在 中{NiceTabular}
,您可以使用 命令 垂直和水平合并单元格\Block
。垂直规则不会绘制在块中。水平规则(所有由 键绘制的规则hlines
都不会绘制在块中。
您似乎想要在表格右侧设置一条特殊规则。我在表格构建后使用 Tikz 指令(使用 创建的 PGF/Tikz 节点nicematrix
)进行了绘制。
\documentclass[12pt,a4paper]{report}
\setlength\textwidth{145mm}
\setlength\textheight{247mm}
\setlength\oddsidemargin{15mm}
\setlength\evensidemargin{15mm}
\setlength\topmargin{0mm}
\setlength\headsep{0mm}
\setlength\headheight{0mm}
\let\openright=\clearpage
\usepackage{dcolumn}
\usepackage{booktabs}
\usepackage{nicematrix,tikz}
\usepackage{caption}
\begin{document}
\begin{table}[ht!]
\caption{A}
\scriptsize
\renewcommand{\arraystretch}{1.4}
\NiceMatrixOptions{cell-space-limits=3pt}
\hrule
\vspace{\doublerulesep}
\begin{NiceTabular*}{\linewidth}{@{\extracolsep{\fill}}c*{9}{|c}}[hlines]
\Block{3-1}{Q} & \Block{1-2}{[1]} && \Block{1-2}{[2]} && [3] & \Block{1-3}{[4]} &&& [5] \\
& \Block{1-2}{PPPP} & & \Block{2-1}{P\\ a} & \Block{2-1}{S\\ F\\ D} & \Block{2-1}{D} & \Block{2-1}{D \\ D \\ D} &
\Block{2-1}{D \\ D \\ D} & \Block{2-1}{F\\ F\\ F} & \Block{2-1}{Program\\ Program} \\
& II & III \\
\Block{}{$P$\\ [days]} & \Block{1-*}{AAAA} \\
\Block{}{$V$\\ SS} & \Block{1-*}{}71.7755 & 21.74(50) && 15.5(7) & 21.1(16) & 15.51 & 15.71 & 15.34 \\
\CodeAfter
\tikz \draw (1-|11) -- (4-|11) ;
\end{NiceTabular*}
\end{table}
\end{document}
您需要多次编译(因为nicematrix
使用 PGF/Tikz 节点)。