4

I want to create a table in this format, but I haven't managed to get it to work. I dont need to have any colour, i would just like to have it shown as a plain table.

Table Layout

4

You're right about not wanting colors; however, you don't want vertical rules either. Nor it's necessary that “Data set” is lowered: the first row has the column headers, some of which have subheaders in the second row, with a horizontal rule to show the groups.

With siunitx and its S column you can get exact spacing between columns, alignment under the decimal point and automatic management of numbers (see in the eighth column).

The input is straightforward; only some care is needed for adjusting the column specifiers, which can be done when the data are in their final form.

A local setting of \tabcolsep is necessary, at least for the standard text width; if you have a different text width you may be able to omit the setting or you may need to change the size.

\documentclass[11pt]{article}
\usepackage{siunitx}
\usepackage{booktabs}

\begin{document}

\begin{tabular}{
  l 
  *{6}{S[table-format=1.4]}
  S[table-format=5]
  S[table-format=3.2]
}
\toprule
\multicolumn{1}{c}{Data Set} &
  \multicolumn{3}{c}{Balanced Error}  &
  \multicolumn{3}{c}{Area Under Curve} &
  \multicolumn{2}{c}{Features} \\
\cmidrule(lr){2-4} \cmidrule(lr){5-7}  \cmidrule(lr){8-9}
  & {Train} & {Valid} & {Test} & {Train} & {Valid} & {Test} & {\#} & {\%} \\
\midrule
arcene  & 0.5000 & 0.4886 & 0.5006 & 0.5000 & 0.5114 & 0.4994 & 10000 & 100.10 \\
gisette & 0.5000 & 0.4886 & 0.5006 & 0.5000 & 0.5114 & 0.4994 & 10000 & 100.10 \\
dexter  & 0.5000 & 0.4886 & 0.5006 & 0.5000 & 0.5114 & 0.4994 & 10000 & 100.10 \\ 
madelon & 0.5000 & 0.4886 & 0.5006 & 0.5000 & 0.5114 & 0.4994 & 10000 & 100.10 \\
\bottomrule
\end{tabular}

\end{document}

enter image description here

2

Several good answers already exist. I'd like to suggest to use the booktabs package as it creates tables that are effective and yet simple to create.

\documentclass[11pt]{article}
\usepackage{booktabs}

\let\mc\multicolumn

\begin{document}

\begin{tabular}{r rrr rrr rr}
\toprule
 & \mc3c{Balanced Error} 
 & \mc3c{Area Under Curve}
 & \mc2c{Features} \\
 \cmidrule(r){2-4}
 \cmidrule{5-7} 
 \cmidrule(l){8-9}
  Data Set & Train &Valid &Test & Train &Valid & Test & \# & \% \\
\midrule
arcene&0.5000 &0.4886 &0.5006 & 0.5000 &0.5114 &0.4994 &10000 & 100.10\\
gisette&0.5000 &0.4886 &0.5006 & 0.5000 &0.5114 &0.4994 &10000 & 100.10\\
dexter&0.5000 &0.4886 &0.5006 & 0.5000 &0.5114 &0.4994 &10000 & 100.10\\ 
madelon&0.5000 &0.4886 &0.5006 & 0.5000 &0.5114 &0.4994 &10000 & 100.10\\
\bottomrule
\end{tabular}

\end{document}

enter image description here

0

you need to load packages multirow and multicol in the preamble and then :

\begin{table}[htdp]
\caption{default}
\begin{center}
\begin{tabular}{|c|c|c|c|c|c|c|c|c|}
\multirow{2}{*}{Data set}&\multicolumn{3}{c|}{Balanced Error}&\multicolumn{3}{c|}{Area under Curve}&\multicolumn{2}{c|}{Features}\\ \cline{2-9}
&Train&Valid&Tes&Train&Valid&Test&\#&\%\\ \hline
arcene&0.5000&0.5000&0.5000&0.5000&0.5000&0.5000&0.5000&0.5000\\
gisette&0.5000&0.5000&0.5000&0.5000&0.5000&0.5000&0.5000&0.5000\\
dexter&0.5000&0.5000&0.5000&0.5000&0.5000&0.5000&0.5000&0.5000\\
madelon&0.5000&0.5000&0.5000&0.5000&0.5000&0.5000&0.5000&0.5000
\end{tabular}
\end{center}
\label{default}
\end{table}

enter image description here

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.