Here are some specific suggestions:
- group the table headers a bit more to emphasize the logical structure;
- break up the headers for columns 2 and 3 across two lines to make them less wide;
- don't use vertical whitespace to the left of the first column and to the right of the last column;
- use
\midrule[\heavyruleweight]
instead of \bottomrule
to provide a bit more "breathing room for the next line.
Of course, these suggestions are personal and lay no claim to representing some greater truth...
\documentclass[a4paper,12pt]{scrreprt}
\usepackage{booktabs}
\begin{document}
\begin{table}
\centering
\begin{tabular}{@{} lcccc @{}} % suppress vertical whitespace at start and end
\toprule
Company& \multicolumn{3}{c}{Exceedances} & No.\ of Obs.\\
\cmidrule(lr){2-4}
& \multicolumn{2}{c}{Empirical} & Expected\\
\cmidrule(lr){2-3} \cmidrule(lr){4-4}
&standard & standardized\\ % make columns 2 and 3 narrower
&normal & Student's-$t$\\
\midrule
Company 1&1&5&9&13\\
Company 2&2&6&10&14\\
Company 3&3&11&15\\
Company 4&4&8&12&16\\
\midrule[\heavyrulewidth] % use "thick" \midrule instead of \bottomrule
\multicolumn{4}{@{}l}{\footnotesize An additional hint about a detail}
\end{tabular}
\caption{Here is the caption.}
\label{labelhere}
\end{table}
\end{document}
1. Put a name for the first column
There is already one, namely "File". Do you want to lower it to the second line? I wouldn't, because it is hierarchically on the same level as "Logistic..." and "Support...".
2. Center the words for "logistic reg" and "support vector machine"
Well, those are already centered, just not on the right columns. In your code, they are each centered on the first 2 columns below the \cline
. Change the \multicolumn{2}
to \multicolumn{3}
and you'll probably get what I believe you mean.
3. Output with very small margin like a picture.
Check the geometry
options if you are talking about page geometry, e.g.
\usepackage[landscape,scale=0.95]{geometry}
FYI, geometry
enables you to change the geometry of a single page and resetting the usual geometry afterwards.
4. Other suggestions making the table looks professional.
Use the caption
package to correct spacing for table captions: while table captions should be placed before the (tabular) content (as you did) and picture captions should be placed after the image, by default LaTeX puts vertical space before the caption label and not after it.
Use \toprule
, \midrule
, \cmidrule
and \bottomrule
from the booktabs
package (that you are loading without using) instead of \hline
and \cline
.
Given that you are displaying figures meant to be compared, make the comparison easy to the eye: align your columns containing said figures right, in order to align the decimals. For even better results, use the dcolumn
package as in jon's answer to automatically align the figures on their decimal and format them correctly (including using a minus sign instead of a hyphen). FYI, you can use the siunitx
package in the rest of your document to format numbers (with \num
) and units (with \si
), but their use in tabular
s is rather tedious. Also, for easy readability, units should go in your tabular
's head, not inside the data itself.
Remove the unnecessary @{}
and extra middle column; unless you know exactly what and why, (La)TeX does its typesetting pretty well on its own :)
Remove the \arraystretch
/ \ra
"trick".
Given the "File" heading is structurally at the same level as the two "Regression" ones, use the same font for it. Also, put all your headings with a capital (or none, but be coherent).
Finally, to ease your own coding, I would suggest you format the content of your tabular with white spaces to visually separate the columns and resemble your output. I've found that editing tabulars made this way is much more easy, especially when you have to modify documents a few weeks / months after their creation.
Putting it all together
\documentclass{article}
\usepackage[landscape]{geometry}
\usepackage{booktabs,caption,dcolumn}
\newcolumntype{d}[1]{D{.}{.}{4}}% column type for figures with 4 decimals
\newcommand{\subhead}[1]{\multicolumn{1}{c}{#1}}% to format sub-headings of d-type columns
\begin{document}
\begin{table}
\centering
\caption{Caption}
\begin{tabular}{cd{4}d{4}d{4}d{4}d{4}d{4}}
\toprule
\textbf{File}& \multicolumn{3}{c}{\textbf{Logistic Regression}}& \multicolumn{3}{c}{\textbf{Support Vector Machine}}\\
\cmidrule(rl){2-4} \cmidrule(rl){5-7}
& \subhead{Sensitivity}& \subhead{Specificity}& \subhead{Total accuracy}& \subhead{Sensitivity}& \subhead{Specificity}& \subhead{Total accuracy}\\
\midrule
100 & 0.0790& 0.1692& 0.2945& 0.3670& 0.7187& 3.1815\\
101 & - 0.8651& 50.0476& 5.9384& - 9.0714& 297.0923& 46.2143\\
102 & 124.2756& - 50.9612& -14.2721& 128.2265& -630.5455& -381.0930\\
103 & 0.0357& 1.2473& 0.2119& 0.3593& - 0.2755& 2.1764\\
104 & - 17.9048& - 37.1111& 8.8591& - 30.7381& - 9.5952& - 3.0000\\
105 & 105.5518& 232.1160& -94.7351& 100.2497& 141.2778& -259.7326\\
\bottomrule
\end{tabular}
\end{table}
\end{document}
which yields:
Best Answer
btw: the vertical lines do not make a table more readable ...