1

In beamer mode, the "table" is correctly bounded within the page but the text columns still go off the page. The headers consist of 3 heirarchy, 2 columns within each column, that adds up to a total of 9 columns including the singular left column.

Additionally, the column margins are so small that there is barely any space to place values in it. I would really appreciate some help to fix this

  \documentclass[table]{beamer}

  \usepackage{tikz, dcolumn, booktabs}
  \usetikzlibrary{arrows,shapes}
  \newcolumntype{d}[1]{D{.}{.}{#1}} % "decimal" column type
  \renewcommand{\ast}{{}^{\textstyle *}} % for raised "asterisks"
  \newcommand{\ra}[1]{\renewcommand{\arraystretch}{#1}}

 \begin{document}

 \begin{frame}

 \begin{table}[h]
   \caption{Number of turns and distance between top and bottom.}
   \tiny
   \begin{tabular*}{\textwidth}{@{\extracolsep{\fill}} r *{8}{d{2.4}} }
   \toprule
    & \multicolumn{4}{c}{Clustered} & \multicolumn{4}{c}{Non-clustered}\\
    \cmidrule(lr){2-5}\cmidrule(lr){6-9}\addlinespace
    & \multicolumn{2}{c}{Cured} & \multicolumn{2}{c}{Non-cured} 
    &\multicolumn{2}{c}{Cured} & \multicolumn{2}{c}{Non-cured}\\
    & \multicolumn{1}{c}{$\hat{\beta}$ (SD)} & \multicolumn{1}{c}{P-val} 
    &\multicolumn{1}{c}{$\hat{\beta}$ (SD)} & \multicolumn{1}{c}{P-val}&\multicolumn{1}{c}{$\hat{\beta}$ (SD)} & \multicolumn{1}{c}{P-val}&\multicolumn{1}{c}{$\hat{\beta}$ (SD)} & \multicolumn{1}{c}{P-val}\\
   \midrule
   $Constant$    &  8.79 (0.03) & & 8.79 (0.003) &  & 1.155  & & 123 &\ast \\

   $HCV Groupings$ \textsuperscript{a}\\
     $D-/R+$       &  0.29 (0.01) & $<0.001$ & -0.002 & & 1.155  & & 123&\ast \\

     $D+/R-$  
          &  0.54 (0.01) & $<0.001$ & -0.002 & & 1.155  & & 122&\ast \\

     $D+/R+$  
          &  0.46 (0.01) & $<0.001$ & -0.002 & & 1.155  & & 122&\ast \\

     Theta         & 0.19 (0.02)      & $<0.001$ &        & &        & &   &  \\
     Cure         & 1.45E-7 (3.46E-6)         & 0.97 &        & &        & &   & \\
    \bottomrule
    \end{tabular*}
    \end{table}
    \end{frame}

  \end{document}

enter image description here

3
  • I added \tiny before tabular. Is that the same as \tinty?
    – rich
    Aug 29, 2017 at 3:53
  • @rich I think \tinty is only a typo :)
    – CarLaTeX
    Aug 29, 2017 at 3:54
  • @CarLaTeX is right. Sorry for the typo!
    – Fran
    Aug 29, 2017 at 9:21

1 Answer 1

2

i would reorganize this table:

enter image description here

\documentclass[table]{beamer}
%\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}

\usepackage{booktabs, dcolumn}
\usepackage{tikz}
\usetikzlibrary{arrows,shapes}
\newcolumntype{d}[1]{D{.}{.}{#1}} % "decimal" column type
\renewcommand{\ast}{{}^{\textstyle *}} % for raised "asterisks"
\newcommand{\ra}[1]{\renewcommand{\arraystretch}{#1}}

\newcommand\mcn[2]{\multicolumn{#1}{c}{#2}}
\newcommand\mc[1]{\multicolumn{1}{c}{#1}}

\begin{document}

\begin{frame}

\begin{table}
\small
\setlength\tabcolsep{0pt}
    \caption{Number of turns and distance between top and bottom.}
\begin{tabular*}{\textwidth}{@{\extracolsep{\fill}}
                          >{$}r<{$}
                          d{2.8} d{2.3}
                          d{2.3} d{1.0}
                          d{1.3} d{1.0}
                          d{3.0} d{1.0}
                          }
    \toprule
    & \mcn{4}{Clustered}                & \mcn{4}{Non-clustered}        \\
    \cmidrule(lr){2-5}\cmidrule(lr){6-9}
    & \mcn{2}{Cured}    & \mcn{2}{Non-cured}
            & \mcn{2}{Cured}        & \mcn{2}{Non-cured}                \\
    & \mc{$\hat{\beta}$ (SD)}   & \mc{P-val}
        & \mc{$\hat{\beta}$ (SD)}   & \mc{P-val}    & \mc{$\hat{\beta}$ (SD)}
            & \mc{P-val}  & \mc{$\hat{\beta}$ (SD)}   & \mc{P-val}      \\
   \midrule
\multicolumn{8}{l}{HCV Groupings \textsuperscript{a}}                              \\
D-/R+       & 0.29      & <0.001 & -0.002 & & 1.155  & & 123& \ast  \\
            & (0.01)    &        &        & &        & &    &       \\
D+/R-       & 0.54      & <0.001 & -0.002 & & 1.155  & & 122& \ast  \\
            & (0.01)    &        &        & &        & &    &       \\
D+/R+       & 0.46      & <0.001 & -0.002 & & 1.155  & & 122& \ast  \\
            & (0.01)    &        &        & &        & &    &       \\
\text{Theta}& 0.19      & <0.001 &        & &        & &    &       \\
            & (0.02)    &        &        & &        & &    &       \\
\text{CureN}& 1.45 \cdot10^{-6}
                        & 0.97   &        & &        & &    &       \\
            & (3.46\cdot10^{-6})
                        &        &        & &        & &    &       \\
\bottomrule
\end{tabular*}
\end{table}

\end{frame}

\end{document}
1
  • Ah this is great @Zarko! Thanks so much for your suggestions!
    – rich
    Aug 29, 2017 at 5:29

You must log in to answer this question.

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