我有以下想要重现的表格(减去标题颜色):
但事实上,这是我目前得到的结果:
有人能帮我修复吗:
1) 表格对齐不匹配(彩色数字位于单元格底部,而其余数字不在)2)垂直线不匹配(标题垂直线比表格其余部分要细,这就是为什么其中一些在正常缩放时会在 pdf 预览器上“消失”,而在 +200% 缩放时才会变得明显)
我的 MWE 如下:
\documentclass[smallcondensed]{svjour3}
\smartqed
\usepackage{mathptmx}
\usepackage{tabularx}
\usepackage{caption}
\usepackage[table, svgnames, dvipsnames]{xcolor}
\usepackage{makecell}
\begin{document}
\begin{table*}
\begin{tabularx}{\textwidth}{p{7cm}|X|X|X|X|X}
Landmark&CR&NR&DT&TE&Score \\ \hline
Church of Our Lady of the Assumption and St Gregory&\color{red}{6}&1&2&1&\color{red}{3}\\ \hline
Piccadilly Market&\color{red}{6}&1&2&1&\color{red}{3} \\ \hline
Supreme Court of the United Kingdom&\color{red}{3}&6&8&5&\color{red}{6} \\ \hline
\end{tabularx}
\end{table*}
\end{document}
答案1
我建议您X
将第一列和c
接下来的 5 列用作。并且,使用\textcolor{...}{...}
而不是\color{...}{...}
。
\documentclass[smallcondensed]{svjour3}
\smartqed
\usepackage{newtxtext,newtxmath} % {mathptmx} % 'mathptmx' is ancient
\usepackage{tabularx,caption,makecell}
\usepackage[table, svgnames, dvipsnames]{xcolor}
\begin{document}
\begin{table}
\setlength\extrarowheight{2pt} % for a more open "look"
\begin{tabularx}{\textwidth}{@{} X |c|c|c|c|c @{}}
Landmark&CR&NR&DT&TE&Score \\
\hline
Church of Our Lady of the Assumption and St Gregory
&\textcolor{red}{6}&1&2&1&\textcolor{red}{3}\\
\hline
Piccadilly Market
&\textcolor{red}{6}&1&2&1&\textcolor{red}{3} \\
\hline
Supreme Court of the United Kingdom
&\textcolor{red}{3}&6&8&5&\textcolor{red}{6} \\
\hline
\end{tabularx}
\end{table}
\end{document}
实际上,如果这是我的文档,我会通过删除所有垂直线并使用较少但间距适当的水平线来简化表格的外观。我还会通过不使用环境来减少表格的整体宽度tabularx
。
\documentclass[smallcondensed]{svjour3}
\smartqed
\usepackage{newtxtext,newtxmath} % {mathptmx}
\usepackage{tabularx,caption,booktabs}
\usepackage[table, svgnames, dvipsnames]{xcolor}
\begin{document}
\begin{table}
\centering
\begin{tabular}{@{} l ccccc @{}}
\toprule
Landmark&CR&NR&DT&TE&Score \\
\midrule
Church of Our Lady of the Assumption and St Gregory
&\textcolor{red}{6}&1&2&1&\textcolor{red}{3}\\
\addlinespace
Piccadilly Market
&\textcolor{red}{6}&1&2&1&\textcolor{red}{3} \\
\addlinespace
Supreme Court of the United Kingdom
&\textcolor{red}{3}&6&8&5&\textcolor{red}{6} \\
\bottomrule
\end{tabular}
\end{table}
\end{document}