![使其适合 LNCS 页面样式的表格](https://linux22.com/image/324477/%E4%BD%BF%E5%85%B6%E9%80%82%E5%90%88%20LNCS%20%E9%A1%B5%E9%9D%A2%E6%A0%B7%E5%BC%8F%E7%9A%84%E8%A1%A8%E6%A0%BC.png)
这是我的桌子骨架
我在使其适合 LNCS 样式页面时遇到问题,尤其是标题(前两行),因为它们包含文本,而表格内的其他单元格每个单元格仅包含一个符号,例如“+”。
有什么办法可以解决这个问题吗?我不需要这些线,当然。我正在使用这个booktabs
包。
编辑1:
我的一些代码是:
\documentclass{llncs}
\usepackage[utf8]{inputenc}
\usepackage{amsmath}
\usepackage{amsfonts}
\usepackage{amssymb}
\usepackage{makeidx}
\usepackage{graphicx}
\usepackage{lmodern}
\usepackage[left=2cm,right=2cm,top=2cm,bottom=2cm]{geometry}
\usepackage{booktabs}
\newcommand{\ra}[1]{\renewcommand{\arraystretch}{#1}}
\usepackage{xcolor}
\usepackage{tabularx}
\usepackage{float}
\restylefloat{table}
\usepackage{array}
\newcolumntype{P}[1]{>{\centering\arraybackslash}p{#1}}
\usepackage{float}
\floatstyle{plaintop}
\restylefloat{table}
\usepackage{multirow}
% end: for table
%begin: for landscape table
\usepackage{pdflscape}
\usepackage{lscape}
%end: for landscape table
\usepackage{xspace}
\newcommand{\bs}{$\blacksquare$ \xspace}
\newcommand{\sr}{$\square$ \xspace}
\newcommand{\lt}{$\blacktriangleleft$ \xspace}
\begin{document}
\begin{landscape}
\begin{table}[]
%\centering
\small
\caption{Something which is moving my table too down}
\label{my-label}
\hskip-3.0cm \vskip-2.0cm \begin{tabular}{@{}p{4cm}p{0.6cm}p{0.6cm}p{0.6cm}p{0.6cm}p{0.6cm}p{0.6cm}p{0.6cm}p{0.6cm}p{0.6cm}p{0.6cm}p{0.6cm}p{0.6cm}p{0.6cm}p{0.6cm}p{0.6cm}p{0.6cm}p{0.6cm}p{0.6cm}p{0.6cm}p{0.6cm}p{0.6cm}p{0.6cm}p{0.6cm}p{0.6cm}@{}}
\toprule
{\color[HTML]{009901}{} } & \multicolumn{3}{l}{{\color[HTML]{009901}{{}} }} & \multicolumn{2}{l}{{\color[HTML]{009901}{\rotatebox[origin=r]{90}{}} }} & {\color[HTML]{009901}{\rotatebox[origin=r]{90}{}} } & {\color[HTML]{009901}{\rotatebox[origin=r]{90}{}} } & \multicolumn{2}{l}{{\color[HTML]{009901}{\rotatebox[origin=r]{90}{}} }} & \multicolumn{3}{l}{{\color[HTML]{009901}{\rotatebox[origin=r]{90}{}} }} & \multicolumn{2}{l}{{\color[HTML]{009901}{\rotatebox[origin=r]{90}{}} }} & \multicolumn{2}{l}{{\color[HTML]{009901}{\rotatebox[origin=r]{90}{}} }} & {\color[HTML]{009901}{\rotatebox[origin=r]{90}{}} } & {\color[HTML]{009901}{\rotatebox[origin=r]{90}{}} } & {\color[HTML]{009901}{\rotatebox[origin=r]{90}{}} } & {\color[HTML]{009901}{\rotatebox[origin=r]{90}{}} } & {\color[HTML]{009901}{\rotatebox[origin=r]{90}{}} } & {\color[HTML]{009901}{\rotatebox[origin=r]{90}{}} } & {\color[HTML]{009901}{\rotatebox[origin=r]{90}{}} } & {\color[HTML]{009901}{\rotatebox[origin=r]{90}{}} } \\ \midrule
{\color[HTML]{009901} \textit{}} & {\color[HTML]{009901} {\rotatebox[origin=r]{90}{\textit{}}}} & {\color[HTML]{009901} {\rotatebox[origin=r]{90}{\textit{}}}} & {\color[HTML]{009901} {\rotatebox[origin=r]{90}{\textit{}}}} & {\color[HTML]{009901} \textit{}} & {\color[HTML]{009901} \textit{}} & {\color[HTML]{009901} \textit{}} & {\color[HTML]{009901} \textit{}} & {\color[HTML]{009901} \textit{}} & {\color[HTML]{009901} \textit{}} & {\color[HTML]{009901} \textit{}} & {\color[HTML]{009901} \textit{}} & {\color[HTML]{009901} \textit{}} & {\color[HTML]{009901} \textit{}} & {\color[HTML]{009901} \textit{}} & {\color[HTML]{009901} \textit{}} & {\color[HTML]{009901} \textit{}} & {\color[HTML]{009901} \textit{}} & {\color[HTML]{009901} \textit{}} & {\color[HTML]{009901} \textit{}} & {\color[HTML]{009901} \textit{}} & {\color[HTML]{009901} \textit{}} & {\color[HTML]{009901} \textit{}} & {\color[HTML]{009901} \textit{}} & {\color[HTML]{009901} \textit{}} \\
\multicolumn{3}{l}{\color[HTML]{34696D}{} } & {\color[HTML]{34696D} } & {\color[HTML]{34696D} } & {\color[HTML]{34696D} } & {\color[HTML]{34696D} } & {\color[HTML]{34696D} } & {\color[HTML]{34696D} } & {\color[HTML]{34696D} } & {\color[HTML]{34696D} } & {\color[HTML]{34696D} } & {\color[HTML]{34696D} } & {\color[HTML]{34696D} } & {\color[HTML]{34696D} } & {\color[HTML]{34696D} } & {\color[HTML]{34696D} } & {\color[HTML]{34696D} } & {\color[HTML]{34696D} } & {\color[HTML]{34696D} } & {\color[HTML]{34696D} } & {\color[HTML]{34696D} } & {\color[HTML]{34696D} } & {\color[HTML]{34696D} } & {\color[HTML]{34696D} } \\
Something1 & \lt & \bs & \lt & \bs & \lt & \bs & \bs & \lt & \bs & \lt & \bs & \sr & \bs & \sr & \sr & \bs & ao & & A & \sr & \lt & \bs & \bs & \lt \\
Something2 & \lt & \bs & \lt & \bs & \lt & \bs & \bs & \lt & \bs & \lt & \bs & \sr & \bs & \sr & \sr & \bs & ao & & A & \sr & \lt & \bs & \bs & \lt \\
\multicolumn{3}{l}{\color[HTML]{34696D}{} } & {\color[HTML]{34696D} } & {\color[HTML]{34696D} } & {\color[HTML]{34696D} } & {\color[HTML]{34696D} } & {\color[HTML]{34696D} } & {\color[HTML]{34696D} } & {\color[HTML]{34696D} } & {\color[HTML]{34696D} } & {\color[HTML]{34696D} } & {\color[HTML]{34696D} } & {\color[HTML]{34696D} } & {\color[HTML]{34696D} } & {\color[HTML]{34696D} } & {\color[HTML]{34696D} } & {\color[HTML]{34696D} } & {\color[HTML]{34696D} } & {\color[HTML]{34696D} } & {\color[HTML]{34696D} } & {\color[HTML]{34696D} } & {\color[HTML]{34696D} } & {\color[HTML]{34696D} } & {\color[HTML]{34696D} } \\
Something3 & \lt & \bs & \lt & \bs & \lt & \bs & \bs & \lt & \bs & \lt & \bs & \sr & \bs & \sr & \sr & \bs & ao & & A & \sr & \lt & \bs & \bs & \lt \\
Something4 & \bs & \sr & \lt & \bs & \sr & \bs & \sr & \bs & \sr & \bs & \bs & \bs & \sr & \bs & \bs & \sr & ind & & I & \sr & \bs & \lt & \bs & \lt \\
Something5 & \lt & \bs & & & \bs & \bs & \lt & \sr & \bs & \sr & \bs & \sr & \bs & \sr & \bs & \sr & oo & & A & \bs & & \lt & \lt & \lt \\
Something6 & \bs & \lt & \lt & \bs & \bs & \bs & & \bs & \bs & \bs & \bs & \sr & \bs & \sr & \bs & \sr & oo & & E & \lt & \sr & \bs & \lt & \lt \\
something7 & \bs & \bs & \lt & \bs & \bs & \bs & \bs & \sr & \bs & \bs & \bs & \sr & \bs & \sr & \bs & \sr & oo & & E & \lt & & \sr & \sr & \lt \\
Something8 & & & & \lt & \bs & & \lt & \sr & \bs & \bs & \bs & \lt & \bs & \sr & \bs & \sr & oo & & E & & \sr & \bs & \bs & \lt \\
\multicolumn{3}{l}{\color[HTML]{34696D}{\textbf{Anotherthing}} } & {\color[HTML]{34696D} } & {\color[HTML]{34696D} } & {\color[HTML]{34696D} } & {\color[HTML]{34696D} } & {\color[HTML]{34696D} } & {\color[HTML]{34696D} } & {\color[HTML]{34696D} } & {\color[HTML]{34696D} } & {\color[HTML]{34696D} } & {\color[HTML]{34696D} } & {\color[HTML]{34696D} } & {\color[HTML]{34696D} } & {\color[HTML]{34696D} } & {\color[HTML]{34696D} } & {\color[HTML]{34696D} } & {\color[HTML]{34696D} } & {\color[HTML]{34696D} } & {\color[HTML]{34696D} } & {\color[HTML]{34696D} } & {\color[HTML]{34696D} } & {\color[HTML]{34696D} } & {\color[HTML]{34696D} } \\
Something9 & \lt & \lt & \lt & & \bs & \bs & \bs & \sr & \bs & \bs & & & \bs & \sr & \bs & \sr & oo & & A & \bs & \sr & & & \\
Something10 & \sr & \sr & \bs & \bs & \sr & \bs & \bs & \lt & \bs & & \bs & & \bs & \sr & \bs & \sr & pr & & A & \bs & \sr & \lt & \lt & \lt \\
Something11 & \sr & \sr & \bs & & \bs & \bs & \bs & \sr & \bs & \bs & \bs & & \bs & \sr & \bs & \sr & oo & & A & \lt & \sr & \bs & \bs & \bs \\
Something12 & \lt & \bs & \bs & \bs & & \bs & \bs & \bs & \bs & \bs & & & \bs & \sr & \bs & \sr & ge & & E & \bs & \sr & \lt & \bs & \lt \\
\multicolumn{3}{l}{\color[HTML]{34696D}{\textbf{Anotherthing2}} } & {\color[HTML]{34696D} } & {\color[HTML]{34696D} } & {\color[HTML]{34696D} } & {\color[HTML]{34696D} } & {\color[HTML]{34696D} } & {\color[HTML]{34696D} } & {\color[HTML]{34696D} } & {\color[HTML]{34696D} } & {\color[HTML]{34696D} } & {\color[HTML]{34696D} } & {\color[HTML]{34696D} } & {\color[HTML]{34696D} } & {\color[HTML]{34696D} } & {\color[HTML]{34696D} } & {\color[HTML]{34696D} } & {\color[HTML]{34696D} } & {\color[HTML]{34696D} } & {\color[HTML]{34696D} } & {\color[HTML]{34696D} } & {\color[HTML]{34696D} } & {\color[HTML]{34696D} } & {\color[HTML]{34696D} } \\
Something13 &\bs & \bs & & \lt & \bs & \bs & \bs & \lt & \bs & \bs & \bs & \sr & \bs & \sr & \bs & \sr & oo & & I/E & \bs & \sr & \bs & \bs & \lt \\
Something14 & \bs & \sr & \bs & \lt & \bs & \bs & \bs & \sr & \bs & \bs & \bs & \sr & \bs & \sr & \bs & \sr & oo & & E & \lt & \sr & \bs & \bs & \lt \\
Something15 & \bs & \lt & \bs & \lt & \bs & \bs & \bs & \sr & \bs & \bs & \bs & \sr & \bs & \sr & \bs & \sr & oo & & E & \bs & \sr & \bs & \bs & \lt \\
Something16 & \bs & \bs & \sr & \lt & \bs & \bs & \bs & \sr & \bs & \bs & \bs & \sr & \bs & \sr & \bs & \sr & oo & & E & \bs & \sr & \bs & \bs & \lt \\
Something17 & \lt & \sr & \bs & \lt & \bs & \bs & \bs & \sr & \bs & \bs & \bs & \sr & \bs & \sr & \bs & \sr & oo & & E & \bs & \sr & \bs & \bs & \lt \\
\multicolumn{3}{l}{\color[HTML]{34696D}{\textbf{Anotherthing3}} } & {\color[HTML]{34696D} } & {\color[HTML]{34696D} } & {\color[HTML]{34696D} } & {\color[HTML]{34696D} } & {\color[HTML]{34696D} } & {\color[HTML]{34696D} } & {\color[HTML]{34696D} } & {\color[HTML]{34696D} } & {\color[HTML]{34696D} } & {\color[HTML]{34696D} } & {\color[HTML]{34696D} } & {\color[HTML]{34696D} } & {\color[HTML]{34696D} } & {\color[HTML]{34696D} } & {\color[HTML]{34696D} } & {\color[HTML]{34696D} } & {\color[HTML]{34696D} } & {\color[HTML]{34696D} } & {\color[HTML]{34696D} } & {\color[HTML]{34696D} } & {\color[HTML]{34696D} } & {\color[HTML]{34696D} } \\
Something18 & \lt & \bs & \lt & \bs & \lt & \bs & \bs & \lt & \bs & \lt & \bs & \sr & \bs & \sr & \sr & \bs & ao & & A & \sr & \lt & \bs & \bs & \lt \\
Something19 & \lt & \bs & \lt & \bs & \lt & \bs & \bs & \lt & \bs & \lt & \bs & \sr & \bs & \sr & \sr & \bs & ao & & A & \sr & \lt & \bs & \bs & \lt \\
Something20 & \lt & \bs & \lt & \bs & \lt & \bs & \bs & \lt & \bs & \lt & \bs & \sr & \bs & \sr & \sr & \bs & ao & & A & \sr & \lt & \bs & \bs & \lt \\
Something21 & \lt & \bs & \lt & \bs & \lt & \bs & \bs & \lt & \bs & \lt & \bs & \sr & \bs & \sr & \sr & \bs & ao & & A & \sr & \lt & \bs & \bs & \lt \\
Something22 & \lt & \bs & \lt & \bs & \lt & \bs & \bs & \lt & \bs & \lt & \bs & \sr & \bs & \sr & \sr & \bs & ao & & A & \sr & \lt & \bs & \bs & \lt \\\bottomrule
\end{tabular}
\end{table}
\end{landscape}
\end{document}
编辑2:
编辑3:
除了之前的页面变成横向并且是空白之外,表格本身在垂直对齐的“文本大小”中缩小了!实际上,我从您的解决方案中更改了以下三件事:
- 我正在使用必需的 LNCS 类
- 我删除了它,
\usepackage[margin=2cm]{geometry}
因为它“破坏”了页面的标准边距,这是我不允许触碰的 :( - 我删除了
mathtools
它,\usepackage{mathtools,amssymb}
因为由于某些原因我无法得到它!
答案1
编辑:我认为,llncs
文档类不是首要关注的问题。表格很大,因此需要精心设计(缩小)...
对于下表我做了以下工作:
- 通过
newcolor
在文档序言中定义颜色,表格代码显著减少 - 通过定义新命令:
\crb
,\cit
并mcit
减少表代码 - 通过改变列类型
p{0.6cm}
使c
表格的宽度变小 - 通过消除
xspace
列变窄并且内容现在位于列的中心。 - 包含文本的行的颜色由输入的文本
Another thing ...
决定\rowcolor{...}
\multicolumn{25}{l}{ ... text ...}
- 移除了浮动表格,改用标题
captionof{table}{...}
。效果很好,因此不再需要手动定位表格 - 代码部分考虑了您的新列标题设计。由于在单元格
\rotatebox
中效果不佳multirow
,列标题仅在一行中。 - 对于第一行中的多行单元格,使用
\stackon
来自包的宏stackengine
仅包含必要包的完整代码是:
\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage{array,amsmath,amssymb}% amsmath instal amsfonts
\usepackage{graphicx}
\usepackage{lmodern}
\usepackage[margin=2cm]{geometry}% instead of [left=2cm,right=2cm,top=2cm,bottom=2cm]
\usepackage{caption}
\usepackage[table]{xcolor}
% my colors
\definecolor[named]{mygreen}{HTML}{009901}
\definecolor[named]{myteal}{HTML}{34696D}
\usepackage{booktabs}
\usepackage{stackengine}
%begin: for landscape table
\usepackage{pdflscape}
\usepackage{lscape}
%end: for landscape table
\newcommand{\bs}{$\blacksquare$}
\newcommand{\sr}{$\square$}
\newcommand{\lt}{$\blacktriangleleft$}
%new commands
\newcommand{\crb}[1]{\rotatebox[origin=l]{90}{\itshape\textcolor{mygreen}{#1}}}
\newcommand{\cit}[1]{\textit{\textcolor{mygreen}{#1}}}
\newcommand{\mcit}[2]{\multicolumn{#1}{c}{\textit{\textcolor{mygreen}{#2}}}}
\begin{document}
\begin{landscape}
\centering
\small
\captionof{table}{Something which is moving my table too down}% Add 'table' caption
\label{my-label}
\renewcommand{\arraystretch}{1.1}
\begin{tabular}{l *{24}{c}}
\toprule
& \mcit{3}{\stackon{align}{horizontal}}
& \mcit{2}{\stackon{align}{horizontal}}
&
&
& \mcit{2}{\stackon{align}{horizontal}}
& \mcit{3}{\stackon{align}{horizontal}}
& \mcit{2}{\stackon{align}{horizontal}}
& \mcit{2}{\stackon{align}{horizontal}}
& & & & & & &
\\
\cmidrule(lr){2-4}\cmidrule(lr){5-6}\cmidrule(lr){9-10}%
\cmidrule(lr){11-13}\cmidrule(lr){14-15}\cmidrule(lr){16-17}
& \crb{vertical align}
& \crb{align}
& \crb{vertical}
& \crb{vertical align}
& \crb{vertical align}
& \crb{vertical align}
& \crb{vertical align}
& \crb{vertical align}
& \crb{vertical align}
& \crb{vertical align}
& \crb{vertical align}
& \crb{vertical align}
& \crb{vertical align}
& \crb{vertical align}
& \crb{vertical align}
& \crb{vertical align}
& \crb{vertical align}
& \crb{vertical align}
& \crb{vertical align}
& \crb{vertical align}
& \crb{vertical align}
& \crb{vertical align}
& \crb{vertical align}
\\
\rowcolor{myteal}
\multicolumn{25}{l}{\color{white}\textbf{Another thing 3}}
\\
Something1 & \lt & \bs & \lt & \bs & \lt & \bs & \bs & \lt & \bs & \lt & \bs & \sr & \bs & \sr & \sr & \bs & ao & & A & \sr & \lt & \bs & \bs & \lt \\
Something2 & \lt & \bs & \lt & \bs & \lt & \bs & \bs & \lt & \bs & \lt & \bs & \sr & \bs & \sr & \sr & \bs & ao & & A & \sr & \lt & \bs & \bs & \lt \\
\rowcolor{myteal}
\multicolumn{25}{l}{} \\
Something3 & \lt & \bs & \lt & \bs & \lt & \bs & \bs & \lt & \bs & \lt & \bs & \sr & \bs & \sr & \sr & \bs & ao & & A & \sr & \lt & \bs & \bs & \lt \\
Something4 & \bs & \sr & \lt & \bs & \sr & \bs & \sr & \bs & \sr & \bs & \bs & \bs & \sr & \bs & \bs & \sr & ind & & I & \sr & \bs & \lt & \bs & \lt \\
Something5 & \lt & \bs & & & \bs & \bs & \lt & \sr & \bs & \sr & \bs & \sr & \bs & \sr & \bs & \sr & oo & & A & \bs & & \lt & \lt & \lt \\
Something6 & \bs & \lt & \lt & \bs & \bs & \bs & & \bs & \bs & \bs & \bs & \sr & \bs & \sr & \bs & \sr & oo & & E & \lt & \sr & \bs & \lt & \lt \\
something7 & \bs & \bs & \lt & \bs & \bs & \bs & \bs & \sr & \bs & \bs & \bs & \sr & \bs & \sr & \bs & \sr & oo & & E & \lt & & \sr & \sr & \lt \\
Something8 & & & & \lt & \bs & & \lt & \sr & \bs & \bs & \bs & \lt & \bs & \sr & \bs & \sr & oo & & E & & \sr & \bs & \bs & \lt \\
\rowcolor{mygreen}
\multicolumn{25}{l}{\textbf{Another thing 1}} \\
Something9 & \lt & \lt & \lt & & \bs & \bs & \bs & \sr & \bs & \bs & & & \bs & \sr & \bs & \sr & oo & & A & \bs & \sr & & & \\
Something10 & \sr & \sr & \bs & \bs & \sr & \bs & \bs & \lt & \bs & & \bs & & \bs & \sr & \bs & \sr & pr & & A & \bs & \sr & \lt & \lt & \lt \\
Something11 & \sr & \sr & \bs & & \bs & \bs & \bs & \sr & \bs & \bs & \bs & & \bs & \sr & \bs & \sr & oo & & A & \lt & \sr & \bs & \bs & \bs \\
Something12 & \lt & \bs & \bs & \bs & & \bs & \bs & \bs & \bs & \bs & & & \bs & \sr & \bs & \sr & ge & & E & \bs & \sr & \lt & \bs & \lt \\
\rowcolor{mygreen}
\multicolumn{25}{l}{\textbf{Another thing 2}} \\
Something13 &\bs & \bs & & \lt & \bs & \bs & \bs & \lt & \bs & \bs & \bs & \sr & \bs & \sr & \bs & \sr & oo & & I/E & \bs & \sr & \bs & \bs & \lt \\
Something14 & \bs & \sr & \bs & \lt & \bs & \bs & \bs & \sr & \bs & \bs & \bs & \sr & \bs & \sr & \bs & \sr & oo & & E & \lt & \sr & \bs & \bs & \lt \\
Something15 & \bs & \lt & \bs & \lt & \bs & \bs & \bs & \sr & \bs & \bs & \bs & \sr & \bs & \sr & \bs & \sr & oo & & E & \bs & \sr & \bs & \bs & \lt \\
Something16 & \bs & \bs & \sr & \lt & \bs & \bs & \bs & \sr & \bs & \bs & \bs & \sr & \bs & \sr & \bs & \sr & oo & & E & \bs & \sr & \bs & \bs & \lt \\
Something17 & \lt & \sr & \bs & \lt & \bs & \bs & \bs & \sr & \bs & \bs & \bs & \sr & \bs & \sr & \bs & \sr & oo & & E & \bs & \sr & \bs & \bs & \lt \\
\rowcolor{mygreen}
\multicolumn{25}{l}{\textbf{Another thing 3}} \\
Something18 & \lt & \bs & \lt & \bs & \lt & \bs & \bs & \lt & \bs & \lt & \bs & \sr & \bs & \sr & \sr & \bs & ao & & A & \sr & \lt & \bs & \bs & \lt \\
Something19 & \lt & \bs & \lt & \bs & \lt & \bs & \bs & \lt & \bs & \lt & \bs & \sr & \bs & \sr & \sr & \bs & ao & & A & \sr & \lt & \bs & \bs & \lt \\
Something20 & \lt & \bs & \lt & \bs & \lt & \bs & \bs & \lt & \bs & \lt & \bs & \sr & \bs & \sr & \sr & \bs & ao & & A & \sr & \lt & \bs & \bs & \lt \\
Something21 & \lt & \bs & \lt & \bs & \lt & \bs & \bs & \lt & \bs & \lt & \bs & \sr & \bs & \sr & \sr & \bs & ao & & A & \sr & \lt & \bs & \bs & \lt \\
Something22 & \lt & \bs & \lt & \bs & \lt & \bs & \bs & \lt & \bs & \lt & \bs & \sr & \bs & \sr & \sr & \bs & ao & & A & \sr & \lt & \bs & \bs & \lt \\
\bottomrule
\end{tabular}
\end{landscape}
\end{document}