
Como posso compor a tabela a seguir para parecer organizada e profissional?
\begin{table}[!h]
\caption{A summary of classification results on the free flowing traffic dataset}
\begin{tabular}{|p{1.7 cm}|p{1.7 cm}|p{1.7 cm}|p{1.7 cm}|p{1.5 cm}|p{1.5 cm}|p{1.5 cm}|p{1.6 cm}|p{1.5 cm}|}
\hline
\textbf{Total no. of vehicles used for classification} & \textbf{No. of small vehicles used for classification} & \textbf{No. of medium vehicles used for classification} & \textbf{No. of large vehicles used for classification} & \multicolumn{5}{|c|}{\textbf{Classification accuracy}}\\
\cline{5-9}
& & & & K-nearest neighbor classifier & Nearest centroid classifier & Naïve Bayes Classifier & Multilayer neural network classifier & Ensemble classifier\\
\hline
952 & 594 & 199 & 159 & 90.9\% & 89.4\% & 91.1\% & 89.3\% & 91.8\% \\
\hline
\end{tabular}
\label{tab 4.2}
Responder1
Sugiro que você comece (a) fornecendo mais estrutura ao cabeçalho e (b) eliminando elementos repetitivos. Separadamente, você pode querer pensar em compor a tabela no modo paisagem, especialmente porque a tabela tem nove colunas, cada uma contendo quantidades não triviais de informações.
Aqui está minha sugestão, que faz uso das macros de desenho de regras do booktabs
pacote.
\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{rotating,caption,tabularx,booktabs}
\newcolumntype{C}{>{\centering\arraybackslash}X}
\begin{document}
\begin{sidewaystable}[!h]
\setlength\tabcolsep{4pt} % default: 6pt
\caption{A summary of classification results on the free flowing traffic dataset} \label{tab 4.2}
\begin{tabularx}{\textwidth}{@{} c *{7}{C} c @{}}
\toprule
\multicolumn{4}{@{}c}{No.\ of vehicles used for classication, by size} &
\multicolumn{5}{c@{}}{Classification accuracy, by classifier}\\
\cmidrule(r){1-4} \cmidrule(l){5-9}
Total & Small & Medium & Large &
$K$-nearest neighbor & Nearest centroid & Naïve Bayes & Multilayer neural network & Ensemble\\
\midrule
952 & 594 & 199 & 159 & 90.9\% & 89.4\% & 91.1\% & 89.3\% & 91.8\% \\
\bottomrule
\end{tabularx}
\end{sidewaystable}
\end{document}
Termo aditivo: a sugestão anterior é baseada na suposição de que a tabela acabará por conter mais linhas. Se não for esse o caso, você pode querer dividir a tabela em duas partes, cada uma contendo apenas duas colunas. Com tal configuração, não haveria necessidade de renderizar o material no modo paisagem.
\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{caption,booktabs}
\begin{document}
\begin{table}[!h]
\setlength\tabcolsep{4pt} % default: 6pt
\caption{Summary of classification results on the free flowing traffic dataset} \label{tab 4.2}
\centering
\begin{tabular}{@{}lr@{}}
\toprule
\multicolumn{2}{@{}l@{}}{No.\ of vehicles used for}\\ \multicolumn{2}{@{}l@{}}{classication, by size} \\[0.25ex]
\midrule
Small & 594 \\
Medium & 199 \\
Large & 159 \\[1ex]
Total & 952 \\
\bottomrule
\end{tabular}
\bigskip
\begin{tabular}{@{}lr@{}}
\toprule
\multicolumn{2}{@{}l@{}}{Classification accuracy, by classifier}\\[0.25ex]
\midrule
$K$-nearest neighbor & 90.9\% \\
Nearest centroid & 89.4\% \\
Naïve Bayes & 91.1\% \\
Multilayer neural network & 89.3\% \\[1ex]
Ensemble & 91.8\% \\
\bottomrule
\end{tabular}
\end{table}
\end{document}
Responder2
Talvez algo assim? eu já adicionei
- o
booktabs
pacote que fornece os\toprule
,\midrule
,\bottomrule
e\cmidrule{}
- o
tabularx
pacote que fornece aotabularx
ambiente aX
coluna que suporta conteúdo multilinha (estritamente falando, não é necessário depois que removi todo o texto explicativo das células, - o
multirow
pacote para alinhar um pouco horizontalmente as variáveis dos veículos, - o
siunitx
pacote para formatação adequada de unidades (porcentagens no seu caso) - o
caption
pacote para estilizar um pouco a legenda e fornecer melhor espaçamento entre a legenda (agora bastante grande) e a tabela, e - o
geometry
pacote, pois não tenho ideia de com que tipo de layout de página você trabalha, e a tabela precisava de mais largura de página: p
MWE:
\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage{booktabs,tabularx,siunitx,multirow}
\usepackage[hang,bf,small]{caption}
\usepackage{geometry}
\newcommand{\totNumV}{N_{V,\mathrm{tot.}}}
\newcommand{\smallV}{N_{V,\mathrm{s}}}
\newcommand{\medV}{N_{V,\mathrm{m}}}
\newcommand{\largeV}{N_{V,\mathrm{l}}}
\begin{document}
\begin{table}[!h]
\centering
\caption{A summary of classification results on the free flowing traffic dataset, where $\totNumV$ is the total number of vehicles used for classification, $\smallV{}$, $\medV{}$ and $\largeV$ are the number of small, medium and large vehicles used for classification, respectively. $K$, $C$, $\mathit{NBC}$, $M$ and $E$ are the K-nearest neighbor classifier, Nearest centroid classifier, Naïve Bayes Classifier, Multilayer neural network classifier and Ensemble classifier, respectively. }
\label{tab 4.2}
\begin{tabularx}{\textwidth}{*{9}{X}}
\toprule
\multirow{2}{*}{$\totNumV{}$} & \multirow{2}{*}{$\smallV{}$} & \multirow{2}{*}{$\medV{}$} & \multirow{2}{*}{$\largeV{}$} & \multicolumn{5}{c}{\textbf{Classification accuracy}}\\
\cmidrule{5-9}
& & & & $K$ & $C$ & $\mathit{NBC}$ & $M$ & $E$ \\
\midrule
952 & 594 & 199 & 159 & \SI{90.9}{\percent} & \SI{89.4}{\percent} & \SI{91.1}{\percent} & \SI{89.3}{\percent} & \SI{91.8}{\percent} \\
\bottomrule
\end{tabularx}
\end{table}
\end{document}
produzindo