我正在尝试调整表中行的精确高度,但输出效果不佳:
\documentclass[a4paper]{article}
\usepackage{array}
\usepackage{color, colortbl}
\definecolor{mColor1}{rgb}{0.9,0.9,0.9}
\newcolumntype{O}{>{\columncolor{mColor1}}}
\newcolumntype{D}[1]{>{\raggedright\arraybackslash}m{#1}}
\newcolumntype{E}[1]{>{\centering\arraybackslash}m{#1}}
\begin{document}
\begin{table}[h]
\scriptsize
\caption{Summary}
\centering
\begin{tabular}{| OD{2.2cm} | E{1.1cm} | E{3cm} | E{3cm} | @{}m{0pt}@{} | }
\hline
\rowcolor{mColor1}
Author(s) & App. & Algorithm / Technique & Camera Type & \\ [0.6cm]
\hline
Author(s) & App. & Algorithm / Technique & Camera Type & \\ [0.6cm]
\hline
Author(s) & App. & Algorithm / Technique & Camera Type & \\ [0.6cm]
\hline
\end{tabular}
\end{table}
\end{document}
输出表是这样的,表格右侧存在一些问题,包括颜色重叠以及一条额外的垂直线:
我该如何解决这些问题?谢谢
答案1
你必须使用
@{}>{\columncolor{white}[0pt][0pt]}m{0pt}@{}
代替
@{}m{0pt}@{} |
因此,在为行着色时不考虑隐藏的列。
平均能量损失
\documentclass[a4paper]{article}
\usepackage{array}
\usepackage{color, colortbl}
\definecolor{mColor1}{rgb}{0.9,0.9,0.9}
\newcolumntype{O}{>{\columncolor{mColor1}}}
\newcolumntype{D}[1]{>{\raggedright\arraybackslash}m{#1}}
\newcolumntype{E}[1]{>{\centering\arraybackslash}m{#1}}
\newcolumntype{N}{@{}>{\columncolor{white}[0pt][0pt]}m{0pt}@{}}
\begin{document}
\begin{table}[h]
\scriptsize
\caption{Summary}
\centering
\begin{tabular}{| OD{2.2cm} | E{1.1cm} | E{3cm} | E{3cm} | N }
\hline
\rowcolor{mColor1}
Author(s) & App. & Algorithm / Technique & Camera Type &\\[0.6cm]
\hline
Author(s) & App. & Algorithm / Technique & Camera Type &\\[0.6cm]
\hline
Author(s) & App. & Algorithm / Technique & Camera Type &\\[0.6cm]
\hline
\end{tabular}
\end{table}
\end{document}
输出
答案2
S
如果您使用包,则可以控制以字母 为前缀的类型的列中单元格的高度cellspace
。您也不必使用空列,但应加载caption
包以使标题和表格之间有正确的垂直间距:
\documentclass[a4paper]{article}
\usepackage{array}
\usepackage{color, colortbl}
\usepackage{caption}
\captionsetup{font = footnotesize}
\definecolor{mColor1}{rgb}{0.9,0.9,0.9}
\newcolumntype{O}{>{\columncolor{mColor1}}}
\newcolumntype{D}[1]{>{\raggedright\arraybackslash}m{#1}}
\newcolumntype{E}[1]{>{\centering\arraybackslash}m{#1}}
\usepackage{cellspace}
\setlength\cellspacetoplimit{8pt}
\setlength\cellspacebottomlimit{8pt}
\begin{document}
\begin{table}[h]
\scriptsize
\caption{Summary}
\centering
\begin{tabular}{| OD{2.2cm} | E{1.1cm} | S{E{3cm}} | E{3cm} | }
\hline
\rowcolor{mColor1}
Author(s) & App. & Algorithm / Technique & Camera Type \tabularnewline
\hline
Author(s) & App. & Algorithm / Technique & Camera Type \\
\hline
Author(s) & App. & Algorithm / Technique & Camera Type \\
\hline
\end{tabular}
\end{table}
\end{document}