我在 LaTeX 中创建了一个表格。但两行文本重叠了。我尝试调整行高,但问题仍然存在。请帮忙。代码粘贴在这里。
\begin{table}[]
\centering
\caption{My caption}
\label{my-label}
%\renewcommand{\arraystretch}{1.8}
%\setlength{\extrarowheight}{10pt}
\begin{tabular}{|l|l|c|l|l|l|l|}
\hline
\multicolumn{1}{|c|}{\begin{tabular}[c]{@{}c@{}}Sl.\\ No.\end{tabular}} & \begin{tabular}[c]{@{}l@{}}Filter \&\\ Parameters\end{tabular} & \begin{tabular}[c]{@{}c@{}}Window\\ Size\end{tabular} & SSI & ENL & SMPI & SSIM \\ \hline
\multicolumn{1}{|c|}{1} & \multirow{3}{*}{\begin{tabular}[c]{@{}l@{}}Lee \\ (Noise\\ Variance=0.25)\end{tabular}} & $3\times3$ & 0.711 & 13.402 & 46.151 & 1.00 \\ \cline{1-1} \cline{3-7}
\multicolumn{1}{|c|}{2} & & $5\times5$ & 0.650 & 16.031 & 42.696 & 1.00 \\ \cline{1-1} \cline{3-7}
\multicolumn{1}{|c|}{3} & & $7\times7$ & 0.624 & 17.364 & 41.050 & 1.00 \\ \hline
\multicolumn{1}{|c|}{4} & \multirow{3}{*}{\begin{tabular}[c]{@{}l@{}}Frost\\ ($k=1$)\end{tabular}} & $3\times 3$ & \multicolumn{1}{c|}{0.616} & \multicolumn{1}{c|}{17.814} & \multicolumn{1}{c|}{38.340} & \multicolumn{1}{c|}{1.00} \\ \cline{1-1} \cline{3-7}
\multicolumn{1}{|c|}{5} & & $5\times 5$ & \multicolumn{1}{c|}{0.540} & \multicolumn{1}{c|}{23.240} & \multicolumn{1}{c|}{31.953} & \multicolumn{1}{c|}{1.00} \\ \cline{1-1} \cline{3-7}
\multicolumn{1}{|c|}{6} & & $7\times 7$ & \multicolumn{1}{c|}{0.506} & \multicolumn{1}{c|}{26.493} & \multicolumn{1}{c|}{28.350} & \multicolumn{1}{c|}{1.00} \\ \hline
\multicolumn{1}{|c|}{7} & \multirow{3}{*}{\begin{tabular}[c]{@{}l@{}}Frost\\ ($k=2$)\end{tabular}} & $3\times 3$ & \multicolumn{1}{c|}{0.618} & \multicolumn{1}{c|}{17.703} & \multicolumn{1}{c|}{38.203} & \multicolumn{1}{c|}{1.00} \\ \cline{1-1} \cline{3-7}
\multicolumn{1}{|c|}{8} & & $5\times 5$ & \multicolumn{1}{c|}{0.543} & \multicolumn{1}{c|}{22.935} & \multicolumn{1}{c|}{31.993} & \multicolumn{1}{c|}{1.00} \\ \cline{1-1} \cline{3-7}
\multicolumn{1}{|c|}{9} & & $7\times 7$ & \multicolumn{1}{c|}{0.511} & \multicolumn{1}{c|}{25.911} & \multicolumn{1}{c|}{28.468} & \multicolumn{1}{c|}{1.00} \\ \hline
10 & \multirow{3}{*}{\begin{tabular}[c]{@{}l@{}}Frost\\ ($k=0.5$)\end{tabular}} & $3\times 3$ & 0.616 & 17.863 & 38.403 & 1.00 \\ \cline{1-1} \cline{3-7}
11 & & $5\times 5$ & 0.538 & 23.370 & 31.944 & 1.00 \\ \cline{1-1} \cline{3-7}
12 & & $7\times 7$ & 0.503 & 26.758 & 28.305 & 1.00 \\ \hline
13 & \multirow{3}{*}{\begin{tabular}[t]{@{}l@{}}Enhanced Lee\\ ($k=1$, \\ $C_v=0.2615$,\\ $C_max=1.2247$)\end{tabular}} & $3\times 3$ & 0.613 & 18.004 & 39.158 & 1.00 \\ \cline{1-1} \cline{3-7}
14 & & $5\times5$ & 0.528 & 24.301 & 34.316 & 1.00 \\ \cline{1-1} \cline{3-7}
15 & & $7\times 7$ & 0.484 & 28.959 & 31.464 & 1.00 \\ \hline
16 & \multirow{3}{*}{\begin{tabular}[c]{@{}l@{}}Enhanced Lee\\ ($k=2$, \\ $C_v=0.2615$, \\ $C_max=1.2247$)\end{tabular}} & $3\times 3$ & 0.621 & 17.584 & 38.570 & 1.00 \\ \cline{1-1} \cline{3-7}
17 & & $5\times 5$ & 0.538 & 23.350 & 34.651 & 1.00 \\ \cline{1-1} \cline{3-7}
18 & & $7\times 7$ & 0.497 & 27.395 & 32.071 & 1.00 \\ \hline
19 & \multirow{3}{*}{\begin{tabular}[c]{@{}l@{}}Enhanced Lee\\ ($k=0.5$, \\ $C_v$=0.2615, \\ $C_max$=1.2247)\end{tabular}} & $3\times 3$ & 0.610 & 18.202 & 39.583 & 1.00 \\ \cline{1-1} \cline{3-7}
20 & & $5\times 5$ & 0.523 & 24.731 & 34.269 & 1.00 \\ \cline{1-1} \cline{3-7}
21 & & $7\times7$ & 0.478 & 29.689 & 31.286 & 1.00 \\ \hline
22 & \multirow{3}{*}{\begin{tabular}[c]{@{}l@{}}Enhanced Frost\\ ($k=1$, \\ $C_v=0.2615,$\\ $C_max=1.2247$)\end{tabular}} & $3\times 3$ & 0.616 & 17.846 & 38.206 & 1.00 \\ \cline{1-1} \cline{3-7}
23 & & $5\times 5$ & 0.540 & 23.239 & 31.829 & 1.00 \\ \cline{1-1} \cline{3-7}
24 & & $7\times 7$ & 0.506 & 26.471 & 28.198 & 1.00 \\ \hline
25 & \multirow{3}{*}{\begin{tabular}[c]{@{}l@{}}Enhanced Frost\\ ($k=2$, \\ $C_v=0.2615$, \\ $C_max=1.2247$)\end{tabular}} & $3\times 3$ & 0.617 & 17.762 & 37.913 & 1.00 \\ \cline{1-1} \cline{3-7}
26 & & $5\times 5$ & 0.543 & 22.972 & 31.721 & 1.00 \\ \cline{1-1} \cline{3-7}
27 & & $7\times 7$ & 0.511 & 25.909 & 28.184 & 1.00 \\ \hline
28 & \multirow{3}{*}{\begin{tabular}[c]{@{}l@{}}Enhanced Frost\\ ($k=0.5$, \\ $C_v=0.2615$, \\ $C_max=1.2247$)\end{tabular}} & $3\times 3$ & 0.615 & 17.880 & 38.345 & 1.00 \\ \cline{1-1} \cline{3-7}
29 & & $5\times 5$ & 0.538 & 23.352 & 31.897 & 1.00 \\ \cline{1-1} \cline{3-7}
30 & & $7\times 7$ & 0.503 & 26.717 & 28.244 & 1.00 \\ \hline
31 & \multirow{3}{*}{GammaMap} & $3\times 3$ & 0.608 & 18.319 & 40.178 & 1.00 \\ \cline{1-1} \cline{3-7}
32 & & $5\times 5$ & 0.521 & 24.903 & 34.421 & 1.00 \\ \cline{1-1} \cline{3-7}
33 & & $7\times 7$ & 0.475 & 29.945 & 31.384 & 1.00 \\ \hline
\end{tabular}
\end{table}
答案1
假设您无法加宽文本宽度(这样您就可以避免导致问题的 4 行子表),您可以通过在每行中添加一些额外空间来增加每行后的垂直间距。只需在表格行的末尾附加[..]
到每个行,其中是任意长度(例如)。在下面的代码中,我将其定义为以便于调整。太小,行仍然重叠。太大,页面上的空间就用完了。图像使用等于。\\
..
1ex
\extra
\newlength
\extra
.8ex
我强烈建议将桌子分成两张,并稍微增加间距;但在我看来,它仍然显得拥挤。
以下是在每行附加了 [\extra] 的代码。
\documentclass{article}
\usepackage{multirow}
\newlength{\extra}
\setlength{\extra}{.8ex}
\begin{document}
\begin{table}[]
\centering
\caption{My caption}
\label{my-label}
%\renewcommand{\arraystretch}{1.8}
%\setlength{\extrarowheight}{10pt}
\begin{tabular}{|l|l|c|l|l|l|l|}
\hline
\multicolumn{1}{|c|}{\begin{tabular}[c]{@{}c@{}}Sl.\\ No.\end{tabular}} & \begin{tabular}[c]{@{}l@{}}Filter \&\\ Parameters\end{tabular} & \begin{tabular}[c]{@{}c@{}}Window\\ Size\end{tabular} & SSI & ENL & SMPI & SSIM \\[\extra] \hline
\multicolumn{1}{|c|}{1} & \multirow{3}{*}{\begin{tabular}[c]{@{}l@{}}Lee \\ (Noise\\ Variance=0.25)\end{tabular}} & $3\times3$ & 0.711 & 13.402 & 46.151 & 1.00 \\[\extra] \cline{1-1} \cline{3-7}
\multicolumn{1}{|c|}{2} & & $5\times5$ & 0.650 & 16.031 & 42.696 & 1.00 \\[\extra] \cline{1-1} \cline{3-7}
\multicolumn{1}{|c|}{3} & & $7\times7$ & 0.624 & 17.364 & 41.050 & 1.00 \\[\extra] \hline
\multicolumn{1}{|c|}{4} & \multirow{3}{*}{\begin{tabular}[c]{@{}l@{}}Frost\\ ($k=1$)\end{tabular}} & $3\times 3$ & \multicolumn{1}{c|}{0.616} & \multicolumn{1}{c|}{17.814} & \multicolumn{1}{c|}{38.340} & \multicolumn{1}{c|}{1.00} \\[\extra] \cline{1-1} \cline{3-7}
\multicolumn{1}{|c|}{5} & & $5\times 5$ & \multicolumn{1}{c|}{0.540} & \multicolumn{1}{c|}{23.240} & \multicolumn{1}{c|}{31.953} & \multicolumn{1}{c|}{1.00} \\[\extra] \cline{1-1} \cline{3-7}
\multicolumn{1}{|c|}{6} & & $7\times 7$ & \multicolumn{1}{c|}{0.506} & \multicolumn{1}{c|}{26.493} & \multicolumn{1}{c|}{28.350} & \multicolumn{1}{c|}{1.00} \\[\extra] \hline
\multicolumn{1}{|c|}{7} & \multirow{3}{*}{\begin{tabular}[c]{@{}l@{}}Frost\\ ($k=2$)\end{tabular}} & $3\times 3$ & \multicolumn{1}{c|}{0.618} & \multicolumn{1}{c|}{17.703} & \multicolumn{1}{c|}{38.203} & \multicolumn{1}{c|}{1.00} \\[\extra] \cline{1-1} \cline{3-7}
\multicolumn{1}{|c|}{8} & & $5\times 5$ & \multicolumn{1}{c|}{0.543} & \multicolumn{1}{c|}{22.935} & \multicolumn{1}{c|}{31.993} & \multicolumn{1}{c|}{1.00} \\[\extra] \cline{1-1} \cline{3-7}
\multicolumn{1}{|c|}{9} & & $7\times 7$ & \multicolumn{1}{c|}{0.511} & \multicolumn{1}{c|}{25.911} & \multicolumn{1}{c|}{28.468} & \multicolumn{1}{c|}{1.00} \\[\extra] \hline
10 & \multirow{3}{*}{\begin{tabular}[c]{@{}l@{}}Frost\\ ($k=0.5$)\end{tabular}} & $3\times 3$ & 0.616 & 17.863 & 38.403 & 1.00 \\[\extra] \cline{1-1} \cline{3-7}
11 & & $5\times 5$ & 0.538 & 23.370 & 31.944 & 1.00 \\[\extra] \cline{1-1} \cline{3-7}
12 & & $7\times 7$ & 0.503 & 26.758 & 28.305 & 1.00 \\[\extra] \hline
13 & \multirow{3}{*}{\begin{tabular}[t]{@{}l@{}}Enhanced Lee\\ ($k=1$, \\ $C_v=0.2615$,\\ $C_max=1.2247$)\end{tabular}} & $3\times 3$ & 0.613 & 18.004 & 39.158 & 1.00 \\[\extra] \cline{1-1} \cline{3-7}
14 & & $5\times5$ & 0.528 & 24.301 & 34.316 & 1.00 \\[\extra] \cline{1-1} \cline{3-7}
15 & & $7\times 7$ & 0.484 & 28.959 & 31.464 & 1.00 \\[\extra] \hline
16 & \multirow{3}{*}{\begin{tabular}[c]{@{}l@{}}Enhanced Lee\\ ($k=2$, \\ $C_v=0.2615$, \\ $C_max=1.2247$)\end{tabular}} & $3\times 3$ & 0.621 & 17.584 & 38.570 & 1.00 \\[\extra] \cline{1-1} \cline{3-7}
17 & & $5\times 5$ & 0.538 & 23.350 & 34.651 & 1.00 \\[\extra] \cline{1-1} \cline{3-7}
18 & & $7\times 7$ & 0.497 & 27.395 & 32.071 & 1.00 \\[\extra] \hline
19 & \multirow{3}{*}{\begin{tabular}[c]{@{}l@{}}Enhanced Lee\\ ($k=0.5$, \\ $C_v$=0.2615, \\ $C_max$=1.2247)\end{tabular}} & $3\times 3$ & 0.610 & 18.202 & 39.583 & 1.00 \\[\extra] \cline{1-1} \cline{3-7}
20 & & $5\times 5$ & 0.523 & 24.731 & 34.269 & 1.00 \\[\extra] \cline{1-1} \cline{3-7}
21 & & $7\times7$ & 0.478 & 29.689 & 31.286 & 1.00 \\[\extra] \hline
22 & \multirow{3}{*}{\begin{tabular}[c]{@{}l@{}}Enhanced Frost\\ ($k=1$, \\ $C_v=0.2615,$\\ $C_max=1.2247$)\end{tabular}} & $3\times 3$ & 0.616 & 17.846 & 38.206 & 1.00 \\[\extra] \cline{1-1} \cline{3-7}
23 & & $5\times 5$ & 0.540 & 23.239 & 31.829 & 1.00 \\[\extra] \cline{1-1} \cline{3-7}
24 & & $7\times 7$ & 0.506 & 26.471 & 28.198 & 1.00 \\[\extra] \hline
25 & \multirow{3}{*}{\begin{tabular}[c]{@{}l@{}}Enhanced Frost\\ ($k=2$, \\ $C_v=0.2615$, \\ $C_max=1.2247$)\end{tabular}} & $3\times 3$ & 0.617 & 17.762 & 37.913 & 1.00 \\[\extra] \cline{1-1} \cline{3-7}
26 & & $5\times 5$ & 0.543 & 22.972 & 31.721 & 1.00 \\[\extra] \cline{1-1} \cline{3-7}
27 & & $7\times 7$ & 0.511 & 25.909 & 28.184 & 1.00 \\[\extra] \hline
28 & \multirow{3}{*}{\begin{tabular}[c]{@{}l@{}}Enhanced Frost\\ ($k=0.5$, \\ $C_v=0.2615$, \\ $C_max=1.2247$)\end{tabular}} & $3\times 3$ & 0.615 & 17.880 & 38.345 & 1.00 \\[\extra] \cline{1-1} \cline{3-7}
29 & & $5\times 5$ & 0.538 & 23.352 & 31.897 & 1.00 \\[\extra] \cline{1-1} \cline{3-7}
30 & & $7\times 7$ & 0.503 & 26.717 & 28.244 & 1.00 \\[\extra] \hline
31 & \multirow{3}{*}{GammaMap} & $3\times 3$ & 0.608 & 18.319 & 40.178 & 1.00 \\[\extra] \cline{1-1} \cline{3-7}
32 & & $5\times 5$ & 0.521 & 24.903 & 34.421 & 1.00 \\[\extra] \cline{1-1} \cline{3-7}
33 & & $7\times 7$ & 0.475 & 29.945 & 31.384 & 1.00 \\[\extra] \hline
\end{tabular}
\end{table}
\end{document}
答案2
我会在你的表格设计中选择不同的方式:
- 看来你的表是由一些表生成器生成的,或者你
multicolumn
在任何地方使用......它们都是多余的 - 使用包,通过它可以简化表格代码:
\thead
从包中\makecell
可以替换所有嵌套tabular
在列标题中 - 删除所有垂直线
- 而是
\hline
使用包中定义的规则booktabs
。这样就可以实现表格的“专业”外观 - 删除所有“\cline{...}”
- 对于带有数字的列,请使用
S
包中定义的列类型siunitx
- 具有数学表达式的列定义为数学环境(
>{$}c<{$}
)并删除$
此列中的所有内容
除此之外,由于您没有提供有关文档的任何信息:
- 我使用包
geometry
来确定页面布局 - 对于表环境选择
tabularx
- 利用
multirow
其最新版本中定义的可能性:\multirow[t]{3}{=}{...}
,超越列格式。对于此列,我选择列类型X
,因此如果需要,单元格的内容multirow
会自动分成更多行
这种方法的结果是:
姆韦:
\documentclass[11pt]{article}
\usepackage{geometry}
\usepackage[skip=1ex]{caption}
\usepackage{booktabs, makecell, multirow, tabularx}
\renewcommand\theadfont{\normalsize}
\renewcommand\theadgape{}
\usepackage{siunitx}
\begin{document}
\begin{table}[htb]
\caption{My caption}
\label{my-label}
\centering
\setlength\tabcolsep{4pt}
\begin{tabularx}{\linewidth}{
S[table-format=2.1]
X
>{$}c<{$}
S[table-format=1.3]
*{2}{S[table-format=2.3]}
S[table-format=1.2]
}
\toprule
{\thead{Sl.\\ No.}}
& \thead{Filter \&\\ Parameters}
& \thead{\text{Window}\\ \text{Size}}
& {SSI} & {ENL} & {SMPI} & {SSIM} \\
\midrule
1 & \multirow[t]{3}{=}{Lee ($\text{Noise Variance}=0.25$)}
& 3\times3 & 0.711 & 13.402 & 46.151 & 1.00 \\
2 & & 5\times5 & 0.650 & 16.031 & 42.696 & 1.00 \\
3 & & 7\times7 & 0.624 & 17.364 & 41.050 & 1.00 \\
\midrule
4 & \multirow[t]{3}{=}{Frost ($k=1$)}
& 3\times3 & 0.616 & 17.814 & 38.340 & 1.00 \\
5 & & 5\times5 & 0.540 & 23.240 & 31.953 & 1.00 \\
6 & & 7\times7 & 0.506 & 26.493 & 28.350 & 1.00 \\
\midrule
7 & \multirow[t]{3}{=}{Frost ($k=2$)}
& 3\times3 & 0.618 & 17.703 & 38.203 & 1.00 \\
8 & & 5\times5 & 0.543 & 22.935 & 31.993 & 1.00 \\
9 & & 7\times7 & 0.511 & 25.911 & 28.468 & 1.00 \\
\midrule
10 & \multirow[t]{3}{=}{Frost ($k=0.5$)}
& 3\times3 & 0.616 & 17.863 & 38.403 & 1.00 \\
11 & & 5\times5 & 0.538 & 23.370 & 31.944 & 1.00 \\
12 & & 7\times7 & 0.503 & 26.758 & 28.305 & 1.00 \\
\midrule
13 & \multirow[t]{3}{=}{Enhanced Lee ($k=1$, $C_v=0.2615$, $C_{\max}=1.2247$)}
& 3\times3 & 0.613 & 18.004 & 39.158 & 1.00 \\
14 & & 5\times5 & 0.528 & 24.301 & 34.316 & 1.00 \\
15 & & 7\times7 & 0.484 & 28.959 & 31.464 & 1.00 \\
\midrule
16 & \multirow[t]{3}{=}{Enhanced Lee ($k=2$, $C_v=0.2615$, $C_{\max}=1.2247$)}
& 3\times3 & 0.621 & 17.584 & 38.570 & 1.00 \\
17 & & 5\times5 & 0.538 & 23.350 & 34.651 & 1.00 \\
18 & & 7\times7 & 0.497 & 27.395 & 32.071 & 1.00 \\
\midrule
19 & \multirow[t]{3}{=}{Enhanced Lee ($k=0.5$, $C_v=0.2615$, $C_{\max}=1.2247$)}
& 3\times3 & 0.610 & 18.202 & 39.583 & 1.00 \\
20 & & 5\times5 & 0.523 & 24.731 & 34.269 & 1.00 \\
21 & & 7\times7 & 0.478 & 29.689 & 31.286 & 1.00 \\
\midrule
22 & \multirow[t]{3}{=}{Enhanced Frost ($k=1$, $C_v=0.2615$, $C_{\max}=1.2247$)}
& 3\times3 & 0.616 & 17.846 & 38.206 & 1.00 \\
23 & & 5\times5 & 0.540 & 23.239 & 31.829 & 1.00 \\
24 & & 7\times7 & 0.506 & 26.471 & 28.198 & 1.00 \\
\midrule
25 & \multirow[t]{3}{=}{Enhanced Frost ($k=2$, $C_v=0.2615$, $C_{\max}=1.2247$)}
& 3\times3 & 0.617 & 17.762 & 37.913 & 1.00 \\
26 & & 5\times5 & 0.543 & 22.972 & 31.721 & 1.00 \\
27 & & 7\times7 & 0.511 & 25.909 & 28.184 & 1.00 \\
\midrule
28 & \multirow[t]{3}{=}{Enhanced Frost ($k=0.5$, C_v=0.2615$, $C_{\max}=1.2247$)}
& 3\times3 & 0.615 & 17.880 & 38.345 & 1.00 \\
29 & & 5\times5 & 0.538 & 23.352 & 31.897 & 1.00 \\
30 & & 7\times7 & 0.503 & 26.717 & 28.244 & 1.00 \\
\midrule
31 & \multirow[t]{3}{=}{GammaMap}
& 3\times 3 & 0.608 & 18.319 & 40.178 & 1.00 \\
32 & & 5\times5 & 0.521 & 24.903 & 34.421 & 1.00 \\
33 & & 7\times7 & 0.475 & 29.945 & 31.384 & 1.00 \\
\bottomrule
\end{tabularx}
\end{table}
\end{document}