简体   繁体   中英

Latex threeparttable table notes width

I am having problems with my threeparttable notes as they are somehow not covering the entire width of my table. Can anybody help me? Thank you already in advance! Here is the code I use:

\documentclass[11pt, oneside]{article}       
\usepackage{geometry}                        
\geometry{letterpaper}                          
\usepackage{graphicx}               
\usepackage{lscape}
\usepackage{booktabs}
\usepackage{amssymb}
\usepackage[flushleft]{threeparttable}
\usepackage{longtable}
\usepackage{array}
\usepackage{pdflscape}
\usepackage{tabularx}
\usepackage{adjustbox}
\pagenumbering{gobble}
\usepackage{booktabs}
\begin{document}
{
\def\sym#1{\ifmmode^{#1}\else\(^{#1}\)\fi}
\begin{table}
\scalebox{0.6}{
\begin{threeparttable}
\begin{tabularx}
\textwidth{lccccccccc}
& \textbf{Neonatal}  &   \textbf{Infant}  &  \textbf{Low}  \\
& \textbf{Mortality}  &   \textbf{Mortality}  &  \textbf{Birthweight}  & \textbf{Stunting}  &  \textbf{Underweight}  &\\
\multicolumn{10}{c}{\noindent\rule{18cm}{0.4pt}}\\
\textit{Mother is between 17 and 19 yrs} &     -0.00517*** &  -0.00857*** &   -0.00896** &  -0.0487*** &  -0.0315*** \\
& [0.001]   & [0.002]   & [0.004]   & [0.005] &  [0.004]  \\ 
\multicolumn{10}{c}{\noindent\rule{18cm}{0.2pt}}\\
\textbf{N} &  752543    &        574609   &  399845   &      501520  &   512482 \\
\multicolumn{10}{c}{\noindent\rule{18cm}{0.4pt}}\\
\end{tabularx}
\begin{tablenotes}
\item Results are from the main results regressions (4).  ***, ** and * denote   significance at the 1\%, 5\%, and 10\% levels, respectively. Std. Errors in square brackets and are clustered at PSU level.
\end{tablenotes}
\end{threeparttable}
}
\end{table}
}

\end{document}  

I know it's been years since your question, I am learning creating tables right now that's how I've found this question. I think you confused the threeparttable package by declaring 10 colunms, while you have only 6 in reality. Why don't you try using 6 columns and then some way linebreak the headers and long cells instead?

\documentclass[11pt, oneside]{article}       
\usepackage{geometry}                        
\geometry{letterpaper}                          
\usepackage{graphicx}               
\usepackage{lscape}
\usepackage{booktabs}
\usepackage{amssymb}
\usepackage[flushleft]{threeparttable}
\usepackage{longtable}
\usepackage{array}
\usepackage{pdflscape}
\usepackage{tabularx}
\usepackage{adjustbox}
\pagenumbering{gobble}
\usepackage{booktabs}


\usepackage{makecell}
\renewcommand\theadalign{bc}
\renewcommand\theadfont{\bfseries}
\renewcommand\theadgape{\Gape[4pt]}
\renewcommand\cellgape{\Gape[4pt]}


\begin{document}
{
\def\sym#1{\ifmmode^{#1}\else\(^{#1}\)\fi}
\begin{table}
\scalebox{0.8}{
\begin{threeparttable}
\begin{tabularx}
{16.5cm}{lccccc}
{} & \thead{Neonatal \\ Mortality}  &   \thead{Infant \\ Mortality}  &  \thead{Low \\ Birthweight}  & \thead{Stunting}  &  \thead{Underweight} \\
\midrule
{\shortstack[l]{\textit{Mother is between} \\ \textit{17 and 19 yrs}}} &     {\shortstack[c]{ $-0.00517$*** \\  $[0.001] $ }} &  {\shortstack[c]{$ -0.00857$*** \\ $[0.002] $}} &   {\shortstack[c]{$ -0.00896$** \\ $[0.004]$}} &  {\shortstack[c]{$ -0.0487$*** \\ $[0.005]$}} &  {\shortstack[c]{$-0.0315$*** \\ $[0.004]$}} \\
 \midrule
\textbf{N} &  752543    &        574609   &  399845   &      501520  &   512482 \\
\midrule
\end{tabularx}
\begin{tablenotes}
\item Results are from the main results regressions (4).  ***, ** and * denote   significance at the 1\%, 5\%, and 10\% levels, respectively. Std. Errors in square brackets and are clustered at PSU level.
\end{tablenotes}
\end{threeparttable}
}
\end{table}
}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM