我读过了这个问题,但我无法解释为什么我的情况会发生过满,所以我寻求帮助。
首先,跨单元格中的两个框(带有旋转文本的框)会产生 4 个坏框。我该如何修复它,或者是否有解决方法来抑制由这些框引起的警告。
最小示例
\documentclass[14pt,twoside]{extreport}
\usepackage[a4paper,
lmargin=2.5cm,rmargin=2cm,
tmargin=2.5cm,
bmargin=2cm,
marginpar=1cm,
marginparsep=0.5cm,
headheight=17pt]{geometry}
\usepackage{type1ec}
\usepackage[warn]{mathtext}
\usepackage[T2A]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage[english]{babel}
\usepackage{amsmath}
\usepackage{multirow}
\usepackage{array}
\usepackage{tabu}
\usepackage{xparse}
\usepackage{pdflscape}
\NewDocumentCommand{\rot}{O{90} O{1em} m}{\makebox[#2][l]{\rotatebox{#1}{#3}}}%
\newcolumntype{Y}[1]{>{\strut\hspace{0pt}}X[#1]<{\hspace{0pt}\strut}}
\tabucolumn Y
\begin{document}
\begin{landscape}
\begin{table}[ht]
\caption{Demo table with multirow\strut}
\small
\tabcolsep=4pt
\setlength{\arrayrulewidth}{1pt}
\extrarowsep=^2pt_0pt
\begin{tabu} to \linewidth {|Y{10,C}|Y{10,C}|Y{10,C}|Y{16,C}|Y{10,C}|Y{10,C}|Y{10,C}|Y{12,C}|Y{12,C}|}\hline
\multirow{6}*[9.5ex]{%
\rot[90][7ex]{\parbox{24ex}%
{\centering First column's heading; three lines of text, six rows spanned}}}
& \multirow{6}*[9.5ex]{%
\rot[90][4.7ex]{\parbox{24ex}%
{\centering Second column's heading; two lines}}}
& \multicolumn{5}{c|}{%
\rule[-3.4ex]{0ex}{8ex}%
\parbox{0.4\linewidth}{\centering Heading of columns third to seven; single line}}
& \multicolumn{2}{c|}{%
\multirow{4}*[4.7ex]{%
\parbox{0.22\linewidth}%
{\centering Eighth and ninth column headings; %
five lines of text, two colums spanned, %
four rows spanned; and some math %
$(20\pm 5)\,^{\circ}{\rm C}$ to fill}}}\\\cline{3-7}
& & \multicolumn{5}{c|}{%
\parbox{0.4\linewidth}%
{\centering\strut At the top of the first line you can not see %
enough padding between border line and text\strut}}
& \multicolumn{2}{c|}{}\\\cline{3-7}
& & C & D & E & F & G
& \multicolumn{2}{c|}{}\\\cline{3-7}
& & \multicolumn{5}{c|}{%
\parbox{0.4\linewidth}%
{\centering\strut At the top of the first line you can not see %
enough padding between border line and text\strut}}
& \multicolumn{2}{c|}{}\\\cline{3-9}
& & C0 & D0 & E0 & F0 & G0
& \multirow{2}*{%
\parbox{\linewidth}%
{\centering multirow and multiline}}
& \multirow{2}*{%
\parbox{\linewidth}%
{\centering multirow only}}\\\cline{3-7}
& & \multicolumn{3}{c|}{Alpha}
& \multicolumn{2}{c|}{Beta}
& &\\\hline
A1 & B1 & C1 & D1 & E1 & F1 & G1 & H1 & I1\\\hline
A2 & B2 & C2 & D2 & E2 & F2 & G2 & H2 & I2\\\hline
A3 & B3 & C3 & D3 & E3 & F3 & G3 & H3 & I3\\\hline
\end{tabu}
\end{table}
\end{landscape}
\end{document}
答案1
因此,TeX/LaTeX 似乎通过计算表格行的高度来检测过满,假设每行包含单行文本。
我又添加了两行(每行都在“第一行顶部...”之后),请参见
& & \multicolumn{5}{c|}{} & \multicolumn{2}{c|}{}\\\cline{3-7}
另外,我将包含“在第一行的顶部...”的单元格跨越了两行,请参见
& & \multicolumn{5}{c|}{%
\multirow{2}*{%
\parbox{0.4\linewidth}%
{\centering At the top of the first line you can not see %
enough padding between border line and text}}}
& \multicolumn{2}{c|}{}\\
最后,我在每行的开头放置了支柱,但我发现它的填充有误,请参见
\rule[\singlelnfixrule]{0pt}{\baselineskip}
整个示例(编译时没有警告):
\documentclass[14pt,twoside]{extreport}
\usepackage[a4paper,
lmargin=2.5cm,rmargin=2cm,
tmargin=2.5cm,
bmargin=2cm,
marginpar=1cm,
marginparsep=0.5cm,
headheight=17pt]{geometry}
\usepackage{type1ec}
\usepackage[warn]{mathtext}
\usepackage[T2A]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage[english]{babel}
\usepackage{amsmath}
\usepackage{multirow}
\usepackage{array}
\usepackage{tabu}
\usepackage{xparse}
\usepackage{pdflscape}
\NewDocumentCommand{\rot}{O{90} O{1em} m}{\makebox[#2][l]{\rotatebox{#1}{#3}}}%
\newcolumntype{Y}[1]{>{\strut\hspace{0pt}}X[#1]<{\hspace{0pt}\strut}}
\tabucolumn Y
\begin{document}
\begin{landscape}
\newlength{\singlelnfixrule}\setlength{\singlelnfixrule}{4pt}\addtolength{\singlelnfixrule}{-.3\baselineskip}
\begin{table}[ht]
\caption{Demo table with multirow\strut}
\small
\tabcolsep=4pt
\setlength{\arrayrulewidth}{1pt}
\extrarowsep=^2pt_0pt
\begin{tabu} to \linewidth {|Y{10,C}|Y{10,C}|Y{10,C}|Y{16,C}|Y{10,C}|Y{10,C}|Y{10,C}|Y{12,C}|Y{12,C}|}\hline
\multirow{8}*[16.2ex]{%
\rot[90][7ex]{\parbox{24ex}%
{\centering First column's heading; three lines of text, six rows spanned}}}
& \multirow{8}*[16.2ex]{%
\rot[90][4.7ex]{\parbox{24ex}%
{\centering Second column's heading; two lines}}}
& \multicolumn{5}{c|}{%
\rule[-3.3ex]{0ex}{8ex}%
\parbox{0.4\linewidth}{\centering Heading of columns third to seven; single line}}
& \multicolumn{2}{c|}{%
\multirow{6}*[11.7ex]{%
\parbox{0.22\linewidth}%
{\centering Eighth and ninth column headings; %
five lines of text, two colums spanned, %
four rows spanned; and some math %
$(20\pm 5)\,^{\circ}{\rm C}$ to fill}}}\\\cline{3-7}
\rule[\singlelnfixrule]{0pt}{\baselineskip}
& & \multicolumn{5}{c|}{%
\multirow{2}*{%
\parbox{0.4\linewidth}%
{\centering At the top of the first line you can not see %
enough padding between border line and text}}}
& \multicolumn{2}{c|}{}\\
& & \multicolumn{5}{c|}{} & \multicolumn{2}{c|}{}\\\cline{3-7}
\rule[\singlelnfixrule]{0pt}{\baselineskip}
& & C & D & E & F & G
& \multicolumn{2}{c|}{}\\\cline{3-7}
\rule[\singlelnfixrule]{0pt}{\baselineskip}
& & \multicolumn{5}{c|}{%
\multirow{2}*{%
\parbox{0.4\linewidth}%
{\centering At the top of the first line you can not see %
enough padding between border line and text}}}
& \multicolumn{2}{c|}{}\\
& & \multicolumn{5}{c|}{} & \multicolumn{2}{c|}{}\\\cline{3-9}
\rule[\singlelnfixrule]{0pt}{\baselineskip}
& & C0 & D0 & E0 & F0 & G0
& \multirow{2}*{%
\parbox{\linewidth}%
{\centering multirow and multiline}}
& \multirow{2}*{%
\parbox{\linewidth}%
{\centering multirow only}}\\\cline{3-7}
\rule[\singlelnfixrule]{0pt}{\baselineskip}
& & \multicolumn{3}{c|}{Alpha}
& \multicolumn{2}{c|}{Beta}
& &\\\hline
A1 & B1 & C1 & D1 & E1 & F1 & G1 & H1 & I1\\\hline
A2 & B2 & C2 & D2 & E2 & F2 & G2 & H2 & I2\\\hline
A3 & B3 & C3 & D3 & E3 & F3 & G3 & H3 & I3\\\hline
\end{tabu}
\end{table}
\end{landscape}
\end{document}