\usepackage{booktabs}에서 오류가 발생했습니다.

\usepackage{booktabs}에서 오류가 발생했습니다.
\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}

이전 게시물에 대해 사과드립니다. 저는 포럼과 라텍스를 처음 접하고 처음으로 게시했습니다. 프로젝트에 다음과 같은 xyz.tex라는 파일이 있습니다.

            &\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\\

오버리드에서 PDF를 컴파일하는 동안 오류가 발생했지만 \usepackage{booktabs}를 제거하면 PDF가 렌더링되지만 테이블에 줄이 없습니다. 오류를 붙여넣는 방법을 잘 모르겠습니다. 왜 그런 일이 일어나고 있는지 잘 모르겠습니다. 도움을 주시면 감사하겠습니다.

답변1

노력하다

\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}

MWE와 비교하면 다음과 같은 차이점이 있습니다.

  • 테이블이 어떻게 세팅되어 있는지
  • 이야기가 문서에 삽입되는 방법

컴파일 결과는 다음과 같습니다

여기에 이미지 설명을 입력하세요

관련 정보