1
\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage{hyperref}
\usepackage[margin=1in]{geometry} % full-width
    \topskip        =   20pt
    \parskip        =   10pt
    \parindent      =   0 pt
    \baselineskip   =   15pt
\usepackage{pdflscape}
\usepackage{amssymb, amsfonts, amsmath}
\usepackage{bm}
\usepackage{booktabs}
\usepackage{setspace}  % line spacing
\onehalfspacing
\usepackage{graphicx}
\usepackage{adjustbox}
\usepackage{rotating}  % for sidewaystable

\usepackage{threeparttable}    
\usepackage{dcolumn}    % aligning decimals
    \newcolumntype{d}[1]{D{.}{.}{#1}}

\let\estinput=\input % define a new input command so that we can still flatten the document

\newcommand{\estauto}[3]{
        \vspace{.75ex}{
            %\textsymbols% Note the added command here
            \begin{tabular}{l*{#2}{#3}}
            \toprule
            \estinput{#1}
            \bottomrule
            \addlinespace[.75ex]
            \end{tabular}
            }
        }

\newcommand{\sym}[1]{\rlap{#1}}
\usepackage{hyperref}
\usepackage{tabulary}

\title{Project Name}
\author{X Y Z}
\date{September 2021}

\begin{document}
\maketitle


\section*{Summary Statistics (Tables)}
\subsection*{Consent}
\begin{table}[!htbp]
    \centering
    \caption{caption}
    \label{tab:meetattend}
    \estauto{xyz.tex}{8}{c}\\
    \small{\textit{Notes:}}
\end{table}
\end{document}

I apologise for my earlier post. I am very new to the forum and latex and posting for the first time. I have a file named xyz.tex in the project which looks like this:

            &\multicolumn{8}{c}{var name}                                                               \\
            &           N&        Mean&          SD&         Min&     10th p.&      Median&     90th p.&         Max\\
\midrule
x     &         a&       b&       c&           0&           1&           1&           1&           1\\
y &         120&       0.825&       0.382&           0&           0&           1&           1&           1\\
z     &         243&       0.778&       0.417&           0&           0&           1&           1&           1\\

I get an error while compiling the pdf on overlead but when I remove \usepackage{booktabs}, the pdf is rendered but the table has no lines etc. I am not sure how to paste the error. I am not sure why that is happening. Any help is appreciated.

1 Answers1

1

Try

\RequirePackage{filecontents}
    \begin{filecontents}{xyz.txt}
    & \multicolumn{8}{c}{var name} \\
    \cmidrule(l){2-9}
    & N     & Mean  & SD    & Min   & 10th p.   & Median & 90th p.  & Max   \\
    \midrule
x   & a     & b     & c     & 0     & 1         & 1      & 1        & 1     \\
y   & 120   & 0.825 & 0.382 & 0     & 0         & 1      & 1        & 1     \\
z   & 243   & 0.778 & 0.417 & 0     & 0         & 1      & 1        & 1     
    \end{filecontents}

\documentclass{article} \usepackage[margin=1in]{geometry} \usepackage{pdflscape} \usepackage{amsmath, amssymb} \usepackage{bm} \usepackage{setspace} % line spacing \onehalfspacing \usepackage{graphicx} \usepackage{adjustbox} \usepackage{rotating} % for sidewaystable

\usepackage{booktabs} \usepackage{dcolumn} % aligning decimals \newcolumntype{d}[1]{D{.}{.}{#1}} \usepackage{threeparttable}

\let\estinput=\input % define a new input command so that we can still flatten the document

\newcommand{\estauto}[3]{ \begin{tabular}{l*{#2}{#3}} \toprule \estinput{#1} \ \bottomrule \end{tabular} }

\newcommand{\sym}[1]{\rlap{#1}} \usepackage{tabulary} \usepackage{hyperref}

\title{Project Name} \author{X Y Z} \date{September 2021}

\begin{document} \maketitle

\section{Summary Statistics (Tables)} \subsection{Consent} \begin{table}[!htbp] \centering \caption{caption} \label{tab:meetattend} \estauto{xyz.txt}{8}{c} \ % <--- added \

\small{\textit{Notes:}}

\end{table} \end{document}

In comparison with your MWE are differences in:

  • how the table is set
  • how tale is inserted in document

Compilation result is:

enter image description here

Zarko
  • 296,517