[Tex/LaTex] Creating a table in LaTeX

tables

I am fairly new to LaTeX and creating tables. I was wondering if there was a way to create a table that looks like this:

                | Method 1      |           

Threshold       |P  |Z  |W      |

value1          | value |value  |value |

value2          | value |value  |value  |

This looks bad the way I typed it because I am not sure how to do it. Threshold is its own column then method one is the title of the next column and beneath that there are 3 evaluation metrics in the column of method 1 then all of the values.

Best Answer

This looks like an easy job for siunitx (aligning of the numbers) and booktabs (design of table, avoiding vertical rules, see the manual of booktabs).

Also, take a look at the siunitx manual and the tag as this package has a lot of options and possibilities to not only typeset numbers in tables.

Code

\documentclass{article}
\usepackage{siunitx,booktabs}
\begin{document}
\sisetup{table-format=1.3}
\begin{tabular}{l S S S[table-format=1.5] }
    \toprule
    Threshold & \multicolumn{3}{c}{Method 1} \\ \cmidrule{2-4}
              & {$P$} & {$Z$} & {$W$}        \\ \midrule
    Value 1   & 0.125 & 2.635 & 3.14159      \\
    Value 2   & 1.571 & 0.123 & 2.71828      \\ \bottomrule
\end{tabular}
\end{document}

Output

enter image description here