11

I have a large table (59 rows and 11 columns) of accuracy results. enter image description here

Observe that numbers in bold look a lot larger than regular ones. I want something like this: enter image description here

Here is the code:

\documentclass{article}

\usepackage{tabularx}
\usepackage{booktabs}

\begin{document}
\begin{table}[!htbp]
  \scriptsize %\footnotesize
  \centering
    \caption{Summary of mean accuracy results of the second experiment.}
    \hspace*{-1cm} 
    \begin{tabularx}{1.15\linewidth}{Xlllllllll|l}
    \toprule
    Datasets  & {\sc Scg-$\kappa$} & {\sc Scg-mi} & {\sc Gasen} & {\sc Mdsq} & {\sc Re} & {\sc OO} & {\sc Kappa} & {\sc CC} & {\sc BB} & {\sc Bagging} \\
    \midrule
    Anneal & \textbf{83.54} & \textbf{83.54} & 82.78 & 82.78 & 82.78 & 79.11 & 78.33 & 82.34 & 78.35 & 82.78 \\
    Audiology & \textbf{47.17} & 47.08 & 46.46 & 46.46 & 46.46 & 46.46 & 46.46 & 46.46 & 46.46 & 46.46 \\
    Australian  & \textbf{85.51} & \textbf{85.51} & \textbf{85.51} & \textbf{85.51} & \textbf{85.51} & \textbf{85.51} & \textbf{85.51} & \textbf{85.51} & \textbf{85.51} & \textbf{85.51} \\
    \midrule
    \textbf{Average ranks} & \textbf{3.14} & \textbf{3.86} & \textbf{4.69} & \textbf{4.94} & \textbf{4.58} & \textbf{6.66} & \textbf{7.03} & \textbf{8.15} & \textbf{6.62} & \textbf{5.34} \\
    \bottomrule
    \end{tabularx}%
  \label{tab5_3}%
\end{table}%

\end{document}

Any suggestions?

9
  • Welcome to TeX.SX! Does this answer help?
    – Dai Bowen
    Oct 31, 2016 at 21:25
  • Thank you @DaiBowen for the fast reply. That answer works fine with "\normal" size, but the results look awful with \footnotesize, \scriptsize. How should I proceed?
    – Hadjer
    Oct 31, 2016 at 21:37
  • they should not look worse at small sizes? Oct 31, 2016 at 21:40
  • 1
    See also this answer for an application of \fontseries{b}\selectfont for "regular", i.e., non-extended, bold numbers in tables.
    – Mico
    Oct 31, 2016 at 21:41
  • @DavidCarlisle, I meant that the bold numbers look smaller that the regular ones ;)
    – Hadjer
    Oct 31, 2016 at 22:20

1 Answer 1

11

You can use the method outlined in https://tex.stackexchange.com/a/334323/4427

\documentclass{article}

\usepackage{lmodern}
\usepackage{siunitx}
\usepackage{booktabs}
\usepackage{etoolbox}

\begin{document}

\begin{table}[!htbp]
\small
%\scriptsize
%\footnotesize
\centering

\caption{Summary of mean accuracy results of the second experiment.}
\label{tab5_3}

%% local settings
\sisetup{detect-weight,mode=text}
% for avoiding siunitx using bold extended
\renewrobustcmd{\bfseries}{\fontseries{b}\selectfont}
\renewrobustcmd{\boldmath}{}
% abbreviation
\newrobustcmd{\B}{\bfseries}
% shorten the intercolumn spaces
\addtolength{\tabcolsep}{-4.1pt}

\begin{tabular}{ @{} l *{10}{S[table-format=2.2]} @{} }
\toprule
Datasets  &
  {\scshape Scg-$\kappa$} & {\scshape Scg-mi} &
  {\scshape Gasen} & {\scshape Mdsq} &
  {\scshape Re} & {\scshape OO} &
  {\scshape Kappa} & {\scshape CC} &
  {\scshape BB} & {\scshape Bagging} \\
\midrule
Anneal &
  \B 83.54 & \B 83.54 & 82.78 & 82.78 & 82.78 & 79.11 & 78.33 & 82.34 & 78.35 & 82.78 \\
Audiology &
  \B 47.17 & 47.08 & 46.46 & 46.46 & 46.46 & 46.46 & 46.46 & 46.46 & 46.46 & 46.46 \\
Australian &
  \B 85.51 & \B 85.51 & \B 85.51 & \B 85.51 & \B 85.51 & \B 85.51 & \B 85.51 & \B 85.51 & \B 85.51 & \B 85.51 \\
\midrule
\B Average ranks &
  \B 3.14 & \B 3.86 & \B 4.69 & \B 4.94 & \B 4.58 & \B 6.66 & \B 7.03 & \B 8.15 & \B 6.62 & \B 5.34 \\
\bottomrule
\end{tabular}

\end{table}

\end{document}

enter image description here

7
  • I got the following error: "xkeyval error detect-weight undefined in families 'key'"; any suggestions
    – Hadjer
    Oct 31, 2016 at 22:23
  • MikTeX 2.8. I compile using pdfTex version 3.14.
    – Hadjer
    Oct 31, 2016 at 22:29
  • @Hadjer What TeX distribution are you using? Version 2 of siunitx was issued in May 2010 and since then it doesn't use xkeyval. You have a very old TeX system.
    – egreg
    Oct 31, 2016 at 22:30
  • @Hadjer - MikTeX2.8 is ancient. Any chance you could update to version 2.9?
    – Mico
    Oct 31, 2016 at 22:31
  • @egreg Thank you for the clarification. I'll do it tonight; you gave me a good reason ;). I guess that the update will solve my problem.
    – Hadjer
    Oct 31, 2016 at 22:33

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .