
다음 표를 깔끔하고 전문적으로 보이도록 어떻게 조판할 수 있나요?
\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}
답변1
(a) 헤더에 더 많은 구조를 제공하고 (b) 반복적인 요소를 제거하는 것부터 시작하는 것이 좋습니다. 별도로, 가로 모드에서 테이블을 조판하는 것에 대해 생각해 볼 수도 있습니다. 특히 테이블에는 9개의 열이 있고 각 열에는 적지 않은 양의 정보가 포함되어 있으므로 더욱 그렇습니다.
패키지의 규칙 그리기 매크로를 활용하는 제안은 다음과 같습니다 booktabs
.
\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}
부록: 이전 제안은 테이블에 궁극적으로 더 많은 행이 포함된다는 가정을 기반으로 합니다. 그렇지 않은 경우 테이블을 각각 두 개의 열만 포함하는 두 부분으로 나누는 것을 고려해 볼 수 있습니다. 이러한 설정을 사용하면 재질을 가로 모드로 렌더링할 필요가 없습니다.
\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}
답변2
어쩌면 이런 게 있지 않을까요? 나는 추가했다
- , 및 를
booktabs
제공하는 패키지\toprule
\midrule
\bottomrule
\cmidrule{}
- 여러 줄의 콘텐츠를 지원하는 열이 있는 환경을
tabularx
제공하는 패키지 ( 엄격히 말하면 셀에서 모든 설명 텍스트를 제거한 후에는 필요하지 않습니다.tabularx
X
multirow
차량 변수를 수평으로 약간 정렬하는 패키지 ,siunitx
적절한 단위 형식 지정을 위한 패키지(귀하의 경우 백분율 )caption
캡션에 약간의 스타일을 지정하고 (지금은 상당히 큰) 캡션과 표 사이에 더 나은 간격을 제공하는 패키지geometry
어떤 종류의 페이지 레이아웃을 사용하는지 전혀 모르겠고 테이블에 더 많은 페이지 너비가 필요했습니다 .
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}
생산