Composición tipográfica de mesas limpias en látex.

Composición tipográfica de mesas limpias en látex.

¿Cómo puedo componer la siguiente tabla para que luzca ordenada y profesional?

\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} 

Respuesta1

Le sugiero que comience por (a) proporcionar más estructura al encabezado y (b) eliminar elementos repetitivos. Por otra parte, es posible que desee pensar en componer la tabla en modo horizontal, especialmente porque la tabla tiene nueve columnas, cada una de las cuales contiene cantidades no triviales de información.

Aquí está mi sugerencia, que hace uso de las macros de dibujo de reglas del booktabspaquete.

ingrese la descripción de la imagen aquí

\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}

Apéndice: La sugerencia anterior se basa en la suposición de que, en última instancia, la tabla contendrá más filas. Si ese no es el caso, quizás quieras dividir la tabla en dos partes, cada una de las cuales contenga solo dos columnas. Con tal configuración, no habría necesidad de renderizar el material en modo horizontal.

ingrese la descripción de la imagen aquí

\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}

Respuesta2

¿Quizás algo como esto? he añadido

  • el booktabspaquete que proporciona \toprule, \midrule, \bottomruley\cmidrule{}
  • el tabularxpaquete que proporciona el tabularx entorno con la Xcolumna que admite contenido multilínea (estrictamente hablando, no es necesario después de que eliminé todo el texto explicativo en las celdas,
  • el multirowpaquete para alinear un poco horizontalmente las variables del vehículo,
  • el siunitxpaquete para el formato adecuado de las unidades (porcentajes en su caso)
  • el captionpaquete para darle estilo al título un poco y proporcionar un mejor espacio entre el título (ahora bastante masivo) y la tabla, y
  • el geometrypaquete ya que no tengo idea de con qué tipo de diseño de página trabajas, y la tabla necesitaba un poco más de ancho 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}

productor

ingrese la descripción de la imagen aquí

información relacionada