2

I want to draw a following table in latex enter image description here

EDIT:

MWE:

\documentclass{article}
\usepackage[british,UKenglish,USenglish,english,american]{babel}
\pagenumbering{gobble}

\usepackage{multirow}
\usepackage{makecell}
\usepackage{xfrac}
\usepackage{siunitx,booktabs}
\usepackage{amsmath}
\begin{document}
\begin{tabular}{@{}l
        c
        *{5}{S[table-format=1.6, group-digits=false]}
        S[table-format=-1.6, group-digits=false]
        S[table-format=1.6, group-digits=false]@{}}

    \toprule
    \multirow{2}[3]{*}{\bfseries Parameters} & \multicolumn{2}{c}{\makecell{\bfseries Asymtotic \\ $\boldsymbol{\widehat{\theta}_n - \theta^{\textbf{True}}}$}} & 
      \multicolumn{2}{c}{\makecell{\bfseries Finite sample \\ $\boldsymbol{\widehat{\theta}_n - \theta^{\textbf{True}}}$}} &
      \multicolumn{2}{c}{\makecell{\bfseries Finite sample \\ \bfseries $\boldsymbol{\widehat{\theta}_n^{(3)} - \widehat{\theta}_n}$}} &
      \multicolumn{2}{c}{\makecell{\bfseries Finite sample \\ \bfseries $\boldsymbol{\widehat{\theta}_n^{(6)} - \widehat{\theta}_n}$}} \\
    \cmidrule(lr){2-3} \cmidrule(lr){4-5} \cmidrule(lr){6-7} \cmidrule(lr){8-9}
    $\boldsymbol{\theta^{\textbf{True}}}$ & \multicolumn{1}{c}{\bfseries Mean} & \multicolumn{1}{c}{\bfseries Stddev} & \multicolumn{1}{c}{\bfseries Mean} & \multicolumn{1}{c}{\bfseries Stddev} & \multicolumn{1}{c}{\bfseries Mean} & \multicolumn{1}{c}{\bfseries Stddev} & \multicolumn{1}{c}{\bfseries Mean} & \multicolumn{1}{c}{\bfseries Stddev} \\
    \midrule
    $\Delta = 1/52$ &     &       &        &       &      &       &       &        \\
    \hspace{7pt} $\kappa = 0.5 $ & 0  & 0.229136 & 0.245175 & 0.329396 & 0.013477 & 0.014645 & 0.000002 & 0.000102 \\
    \hspace{7pt} $\alpha = 0.06 $ & 0  & 0.013682 & 0.000329 & 0.015202 & 0.000002 & 0.000318 & 0.000000 & 0.000003 \\
    \hspace{7pt} $\sigma = 0.03 $ & 0  & 0.000674 & 0.000021 & 0.000675 & 0.000003 & 0.000015 & 0.000000 & 0.000000 \\
    \addlinespace
    $\Delta = 1/12$ &     &       &        &       &      &       &       &        \\
    \hspace{7pt} $\kappa = 0.5 $ & 0  & 0.111867 & 0.054162 & 0.124773 & 0.028923 & 0.014382 & -0.000003 & 0.000297 \\
    \hspace{7pt} $\alpha = 0.06 $ & 0  & 0.006573 & 0.000097 & 0.006440 & 0.000002 & 0.000174 & 0.000000 & 0.000014 \\
    \hspace{7pt} $\sigma = 0.03 $ & 0  & 0.000685 & 0.000022 & 0.000687 & 0.000025 & 0.000022 & 0.000000 & 0.000001 \\
    \bottomrule
\end{tabular}
\end{document}

Output: enter image description here

Questions:

  • how to center the last column header ("Stddev") keeping the space removing (@{}) at the end of the table?

  • how to put a minus before the 0.000000 in the 3rd cell of the 8th column? (I don't know if it makes sense, but there was in the OP's table).

2

Something like this:

enter image description here

Code:

\documentclass{article}
\usepackage[british,UKenglish,USenglish,english,american]{babel}
\pagenumbering{gobble}

\usepackage{booktabs,makecell,multirow}
\renewcommand\theadfont{\bfseries}% <-- define fonts series in column heads
\newcommand\mcbf[1]{\multicolumn{2}{c}{\thead{#1}}}% <-- for column heads
\newcommand\bwt[1][]{$\boldsymbol{\widehat{\theta}_n^{#1} - \theta^{\textbf{True}}}$} % <-- shortcut for math in column heads  
\usepackage{xfrac}
\usepackage[group-digits=false]{siunitx}
\usepackage{amsmath}

\usepackage{geometry}

\begin{document}
\setlength\tabcolsep{3pt}
\begin{tabular}{l
             c
        *{5}{S[table-format= 1.6]}@{}
             S[table-format=-2.6]
             S[table-format= 1.6]}
    \toprule
\multirowcell{3}{\thead{Parameters\\ $\boldsymbol{\theta^{\textbf{True}}}$}} 
    &   \mcbf{Asymtotic \\ \bwt}
        &   \mcbf{Finite sample \\ \bwt}
        &   \mcbf{Finite sample \\ \bwt[\,(3)]}
            &   \mcbf{Finite sample \\ \bwt[\,(6)]}
    \cmidrule(lr){2-3} \cmidrule(lr){4-5} \cmidrule(lr){6-7} \cmidrule(lr){8-9}
    &   {\thead{Mean}} & {\thead{Stddev}} 
        &   {\thead{Mean}} & {\thead{Stddev}} 
            &   {\thead{Mean}} & {\thead{Stddev}} 
                &   {\thead{Mean}} & {\thead{Stddev}}           \\
    \midrule
$\Delta = 1/52$ &   &   &   &   &   &   &   &                   \\
    \hspace{7pt} $\kappa = 0.5 $ & 0  & 0.229136 & 0.245175 & 0.329396 & 0.013477 & 0.014645 & 0.000002 & 0.000102 \\
    \hspace{7pt} $\alpha = 0.06 $ & 0  & 0.013682 & 0.000329 & 0.015202 & 0.000002 & 0.000318 & 0.000000 & 0.000003 \\
    \hspace{7pt} $\sigma = 0.03 $ & 0  & 0.000674 & 0.000021 & 0.000675 & 0.000003 & 0.000015 & {\hspace{1ex}$-$0.000000} % <position is manually adjusted
                           & 0.000000 \\
    \addlinespace
    $\Delta = 1/12$ &     &       &        &       &      &       &       &        \\
    \hspace{7pt} $\kappa = 0.5 $ & 0  & 0.111867 & 0.054162 & 0.124773 & 0.028923 & 0.014382 & -0.000003 & 0.000297 \\
    \hspace{7pt} $\alpha = 0.06 $ & 0  & 0.006573 & 0.000097 & 0.006440 & 0.000002 & 0.000174 & 0.000000 & 0.000014 \\
    \hspace{7pt} $\sigma = 0.03 $ & 0  & 0.000685 & 0.000022 & 0.000687 & 0.000025 & 0.000022 & 0.000000 & 0.000001 \\
    \bottomrule
\end{tabular}
\end{document}

As can be seen, in given MWE I omit all @{}, cell with -0.000000 I wrote as {$-$0.000000}. To make enough space for table -- this was reason for last column wasn't centered -- I reduce \tabcolsep from default value 6pt to 4pt.

For simpler writing and better overview of table I define two new commands (see code), and for column heads use macro \thead from makecell package.

Edit: The content {$-$0.000000} is centered in cell as notice CaRLaTeX in his comment. To be aligned with other numbers in column, had to be manually aligned -- moved to the right for one 0 space -- with \hspace{1ex}. He also correct the code for new command \bwt (abbreviation for "bold wide theta", it if ones have suggestion for more meaningful acronym, it can be easy changed :-) ). Now the empty () as \theta superscript is not presented anymore.

Omitting of option group-digits=false in setting of siunitx gives to my taste more easily reading numbers, but I left it as was selected in MWE in question.

| improve this answer | |
  • I have edited it to avoid empy "( )" in the first two multicolumn headers, now it is almost equal to the OP's original table but the "-0.000000" is not correctly aligned – CarLaTeX Jun 2 '16 at 5:52
  • @CarLaTeX, thank you for editing and comment. the -0.000000 had to be manually positioned in the cell, othervise it is centered. I will correct this. – Zarko Jun 2 '16 at 10:34

Your Answer

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