![由于多行,表格边框缺失](https://linux22.com/image/370885/%E7%94%B1%E4%BA%8E%E5%A4%9A%E8%A1%8C%EF%BC%8C%E8%A1%A8%E6%A0%BC%E8%BE%B9%E6%A1%86%E7%BC%BA%E5%A4%B1.png)
请问如何才能获得下面显示的表格的正确表格边框。请参阅我的代码
\documentclass[journal]{IEEEtran}
\usepackage{multirow}
\usepackage{array}
\usepackage{tabu}
\usepackage{multicol,graphicx}
\usepackage{makecell}
\usepackage{array}
\newcolumntype{L}[1]{>{\raggedright\let\newline\\\arraybackslash\hspace{0pt}}m{#1}}
\newcolumntype{C}[1]{>
{\centering\let\newline\\\arraybackslash\hspace{0pt}}m{#1}}
\begin{document}
\begin{table*}
\renewcommand{\arraystretch}{1.3}
\caption{Extreme Learning Machine(ELM) with kernel classifier having reduced dimension of feature vectors individual accuracy}
\begin{tabular}{|l|l|C{0.5cm}|L{2cm}|l|l|l|l|} \hline
Algorithm & Dimension & \multirow{ 6}{*}{\rotatebox{90}{\thead{ADD THESE\\ DIMENSIONS}}} & Total after Adding Dimensions &Classifier &\multirow{1}{*}{\thead{ Dimension\\Reduction Technique}} &\multirow{1}{*}{\thead{ Reduced\\Dimension}}&Accuracy \\ \cline{1-2} \cline{4-8}
CDF & 4D & & &ELM & \multirow{5}{*}{\thead{Correlation as Dimension\\ Estimator, PCA as \\ Dimension Reduction}} &\multirow{5}{*}{\thead{26 dimensions \\ reduced to\\ 4 dimensions}} &\multirow{5}{*}{\thead{Combine accuracy\\ of 4\\ dimensional reduced\\ Feature Vector\\ is 68\%}} \\ \cline{1-2} \cline{5-5}\cline{5-5}
GO & 4D & &\multirow{3}{*}{\thead{4D + 4D + 4D \\ + 7D + 7D= 26D}} &ELM\\ \cline{1-2} \cline{5-5}
Bilateral & 4D & & &ELM \\ \cline{1-2} \cline{5-5}
SLDFFO & 7D & & &ELM\\ \cline{1-2} \cline{5-5}
SSGSM & 7D & & &ELM\\ \hline
\end{tabular}
\end{table*}
\end{document}
答案1
缺少垂直线与使用无关
multirow
。缺少与号。后果是缺少垂直线。注意,每行必须少一个“&”符号,列数也必须少一个
在序言中,每个包只需要一个
- 您的表格不必要地复杂,并导致表格外观不一致。例如:
- 随着列类型的变化
{|l|l|C{0.5cm}|L{2cm}|l|l|l|l|}
和{|l|l|c|C{2.5cm}|c |C{2.5cm}|C{2cm}|C{2.5cm}|}
利用最近multirow
包的功能,除了一个之外,\thead
可以在表体以及列标题中删除所有 - 删除
multirow
所有包含一行文本的单元格,高度相等
- 随着列类型的变化
- 考虑到上述建议,表代码变得更短、更干净、更简洁
修改后的表格为:
\documentclass[journal]{IEEEtran}
%\usepackage{array} % loaded twice
\usepackage{multicol}
\usepackage{graphicx}
\usepackage{rotating}% added, for rothead
\usepackage{array, makecell, multirow, tabu}%merged in one line
%\newcolumntype{L}[1]{>{\raggedright\let\newline\\\arraybackslash\hspace{0pt}}m{#1}} % not used
%\newcolumntype{C}[1]{>{\centering\let\newline\\\arraybackslash\hspace{0pt}}m{#1}}
\newcolumntype{C}[1]{>{\centering\arraybackslash}m{#1}}% in this table is better use this definition
\begin{document}
\begin{table*}
\settowidth\rotheadsize{DIMENSIONS}
\renewcommand\multirowsetup{\centering}
\renewcommand{\arraystretch}{1.5}
\centering
\caption{Extreme Learning Machine(ELM) with kernel classifier having reduced dimension of feature vectors individual accuracy}
\begin{tabular}{|l|l|c|C{2.5cm}|c|C{2.5cm}|C{2cm}|C{2.5cm}|}
\hline
Algorithm
& Dimension
& \multirow{6}{*}{\rothead{ADD THESE\\ DIMENSIONS}}
& Total after Adding Dimensions
& Classifier
& Dimension Reduction Technique
& Reduced Dimension
& Accuracy \\
\cline{1-2} \cline{4-8}
CDF & 4D &
& \multirow{5}{=}{4D + 4D + 4D\\ + 7D + 7D = 26D}
& ELM
& \multirow{5}{=}{Correlation as Dimension Estimator,
PCA as Dimension Reduction}
& \multirow{5}{=}{26 dimensions reduced to 4 dimensions}
& \multirow{5}{=}{Combine accuracy of 4 dimensional
reduced Feature Vector is 68\%} \\
\cline{1-2} \cline{5-5}
GO & 4D & & & ELM & & & \\
\cline{1-2} \cline{5-5}
Bilateral & 4D & & & ELM & & & \\
\cline{1-2} \cline{5-5}
SLDFFO & 7D & & & ELM & & & \\
\cline{1-2} \cline{5-5}
SSGSM & 7D & & & ELM & & & \\
\hline
\end{tabular}
\end{table*}
\end{document}
答案2
&
您只需将s 添加到行末尾即可。我借此机会简化并改进了您的代码:
\documentclass[journal]{IEEEtran}
\usepackage{multirow}
\usepackage{array}
\usepackage{tabu}
\usepackage{multicol, graphicx, rotating}
\usepackage{makecell, threeparttable, caption}
\usepackage{array}
\newcolumntype{L}[1]{>{\raggedright\let\newline\\\arraybackslash\hspace{0pt}}m{#1}}
\newcolumntype{C}[1]{>{\centering\let\newline\\\arraybackslash\hspace{0pt}}m{#1}}
\begin{document}
\begin{table*}
\renewcommand{\arraystretch}{1.3}
\settowidth{\rotheadsize}{DIMENSIONS}
\begin{threeparttable}
\caption{Extreme Learning Machine(ELM) with kernel classifier having reduced dimension of feature vectors individual accuracy}
\begin{tabular}{|l|l|C{0.5cm}|L{2cm}|l|l|l|l|} \hline
Algorithm & Dimension &
\multirow{7.5}{*}{\rothead{ADD THESE\\ DIMENSIONS}}
& Total after Adding Dimensions &Classifier &\thead{Dimension\\Reduction Technique} & \thead{ Reduced\\Dimension} & Accuracy \\ \cline{1-2} \cline{4-8}
CDF & 4D & & &ELM & \multirowthead{3.8}{\thead{Correlation as Dimension\\ Estimator, PCA as \\ Dimension Reduction}} & \multirowthead{6}{26 dimensions \\ reduced to\\ 4 dimensions} & \multirowthead{6}{\{Combine accuracy\\ of 4 dimensional reduced \\Feature Vector is 68\,\%} \\ %
\cline{1-2} \cline{5-5}\cline{5-5}
GO & 4D & & \multirowthead{3}{4D + 4D + 4D \\ + 7D + 7D= 26D} & ELM & & & \\ %
\cline{1-2} \cline{5-5}
Bilateral & 4D & & &ELM & & & \\ %
\cline{1-2} \cline{5-5}
SLDFFO & 7D & & &ELM & & & \\ %
\cline{1-2} \cline{5-5}
SSGSM & 7D & & &ELM & & & \\ \hline
\end{tabular}
\end{threeparttable}
\end{table*}
\end{document}