0

I use the following template for KDD 2017 - for conference here (sample-sigconf file): Here is my table: enter image description here

Here is my code:

\begin{table}[H]
    \centering
\setlength{\tabcolsep}{3pt}
    \small
    \centering
    \begin{tabular}{||c c c c c c||} 
        \hline
        ID & das dfdas Nafdsme & abc fds & adfsdd  & fsd fds& fasd fas   \\ [0.5ex] 
        \hline\hline
        DS1 & fdsr fsda & 0.0006946 & 0.02436 & 0.0019150   & 0.2039 \\ 
        DS2 & fas       & 0.0011914 & 0.05942 & -0.0003213  & 0.001561 \\
        DS3 & fsd       & 4.900e-06 & 0.2318  & 2.487e-05   & 0.7709 \\
        DS4 & sadfaCfds & 2.523e-05 & 0.1555  & 8.027e-04   & 0.5613 \\ [1ex] 
        \hline
    \end{tabular}
    \caption{bfdsaasdfk  fdsljkjl}
    \label{table:3}
\end{table}

However, I would like to change it to the following format: enter image description here

This is my source code:

\begin{table}[H]
        \centering
        \setlength{\tabcolsep}{1pt}
        \small
        \begin{tabularx}{\columnwidth}{@{}c L S[table-format=7.0]*{2}{S[table-format=2.0]}@{}}
            \toprule
            \thead{ID}  &   \thead{Udsffsd fdsdfs fdse} 
            &   {\thead{sdffds \\(fds)}}
            &   {\thead{fds \\(fs)}} 
            &   {\thead{Classes\\(fs)}}           \\
            \midrule
            DS1 & asd fdsdf                          & 1025010  & 11    & 9     \\
            DS2 & abcd                                & 5000000  & 18    & 2     \\
            DS3 & fsdgfsdg fgsd fdsfd fsdsffd g       & 5749132  & 9     & 2     \\
            DS4 & das ds dsds                         & 4898431  & 42    & 23    \\
            \bottomrule
        \end{tabularx}
        \caption{bksdfhkadf sdfljj lasdflkj}
        \label{table:1}
    \end{table} 

Every trial I did to convert the above to this one yields error. How can I convert the upper table to the required format (the second one)?

6
  • What you want is not very clear: is it converting the first source-code using the second code as a model? – Bernard Feb 14 '17 at 12:13
  • Yes exactly! !!!!!!!!!!!!!!!!!! – Avi Feb 14 '17 at 12:33
  • The screenshots you've posted are microscopic in size and nearly unreadable. Please post new, bigger screenshots. – Mico Feb 14 '17 at 12:59
  • Thanks, @Mico, please press the screenshot you will see it 1:1. – Avi Feb 14 '17 at 13:16
  • @Avi you could crop the pdf with minimal effort for you, making it much easier for every reader. – Chris H Feb 14 '17 at 13:23
2

Something like this? Note table captions, traditionally, should be above their table.

I use the S column type for conveniently formatted and aligned cells with numerical values. To center non-numerical values (such as column heads) in S columns, put them between a pair of brackets. I also use booktabs to have variable-thickness rules with some vertical padding. Never use vertical rules in table with booktabs rules (unless you know what you do).

\documentclass{article}

\usepackage{booktabs,tabularx}
\usepackage{siunitx, caption, float}

\begin{document}

\begin{table}[H]
  \centering
  \sisetup{table-format=1.3e-2, table-alignment=center, tight-spacing}
  \setlength{\tabcolsep}{3pt}
  \small
  \centering
  \begin{tabularx}{\linewidth}{X cSS[table-format=1.5] SS[table-format=1.5]}
    \toprule
    ID & das dfdas Nafdsme & {abc fds} & {adfsdd} & {fsd fds} & {fasd fas} \\ [0.5ex]
    \midrule
    DS1 & fdsr fsda & 0.0006946 & 0.02436 & 0.0019150 & 0.2039 \\
    DS2 & fas & 0.0011914 & 0.05942 & -0.0003213 & 0.001561 \\
    DS3 & fsd & 4.900e-06 & 0.2318 & 2.487e-05 & 0.7709 \\
    DS4 & sadfaCfds & 2.523e-05 & 0.1555 & 8.027e-04 & 0.5613 \\ [1ex]
    \bottomrule
  \end{tabularx}
  \caption{bfdsaasdfk fdsljkjl}
  \label{table:3}
\end{table}

\end{document} 

enter image description here

3
  • That's why I didn't add detailed explanations – Bernard Feb 14 '17 at 13:28
  • I thought a slightly bigger clue would be needed, but it's your answer so I've deleted my comment. Lets see what the OP makes of it. – Chris H Feb 14 '17 at 13:32
  • No, you're. I forgot the O.P. didn't use siunitx. I'll complete my answer. – Bernard Feb 14 '17 at 13:35

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.