Latex 錯誤:未定義的控制序列、外部 par 模式、欠滿和過滿 hbox

Latex 錯誤:未定義的控制序列、外部 par 模式、欠滿和過滿 hbox

我試圖在 Latex 中放入 Stata 回歸表,但我的程式碼產生以下錯誤:

Undefined control sequence \estwide{PEAssignment2tabl1.tex}{6}{c}
Not in outer par mode. \begin{table}[htbp]
Undefined control sequence \estwide{PEAssignment2tabl1.tex}{6}{c}
Undefined control sequence \estwide{PEAssignment2tabl1.tex}{6}{c}
Underfull \hbox (badness 10000) in paragraph
Underfull \hbox (badness 10000) in paragraph
Overfull \hbox (240.51797pt too wide) in paragraph

程式碼開始:

\documentclass[10pt]{article}
\usepackage[left=0.5in, right=0.5in, top=0.5in, bottom=0.5in]{geometry}

\newcommand{\sym}[1]{\rlap{#1}}% Thanks to David Carlisle

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

\newcommand{\estwide}[3]{
    \vspace{.75ex}{
        \begin{tabular*}
        {\textwidth}{@{\hskip\tabcolsep\extracolsep\fill}l*{#2}{#3}}
        \toprule
        \estinput{#1}
        \bottomrule
        \addlinespace[.75ex]
        \end{tabular*}
        }
    }   

\newcommand{\estauto}[3]{
    \vspace{.75ex}{
        \begin{tabular}{l*{#2}{#3}}
        \toprule
        \estinput{#1}
        \bottomrule
        \addlinespace[.75ex]
        \end{tabular}
        }
    }

% Allow line breaks with \\ in specialcells
    \newcommand{\specialcell}[2][c]{%
\begin{tabular}[#1]{@{}c@{}}#2\end{tabular}}

% *****************************************************************
% Custom subcaptions
% *****************************************************************
% Note/Source/Text after Tables
\newcommand{\figtext}[1]{
\vspace{-1.9ex}
\captionsetup{justification=justified,font=footnotesize}
\caption*{\hspace{6pt}\hangindent=1.5em #1}
}
\newcommand{\fignote}[1]{\figtext{\emph{Note:~}~#1}}

\newcommand{\figsource}[1]{\figtext{\emph{Source:~}~#1}}

% Add significance note with \starnote
\newcommand{\starnote}{\figtext{* p < 0.1, ** p < 0.05, *** p < 0.01. Standard errors in parentheses.}}

% *****************************************************************
% siunitx
% *****************************************************************
\usepackage{siunitx} % centering in tables
\sisetup{
    detect-mode,
    tight-spacing       = true,
    group-digits        = false ,
    input-signs     = ,
    input-symbols       = ( ) [ ] - + *,
    input-open-uncertainty  = ,
    input-close-uncertainty = ,
    table-align-text-post   = false
    }

\begin{document}
\title{Assignment 2 \\ \vspace{0.001 mm} {\large Program Evaluation, Spring 2014} \\             \vspace{0.001 mm} {\large Sarah Armstrong}}
\maketitle

\begin{table}
\caption{Sample Characteristics by the Amount of Co-Holding (\pounds)}
\estwide{PEAssignment2tabl1.tex}{6}{c}
\label{table2}
\end{table}


\end{document}

我在以下位置找到了序言代碼http://www.jwe.cc/2012/03/stata-latex-tables-estout/

答案1

發布的程式碼中來自 tex 的(第一個)錯誤不是您列出的錯誤之一,而是:

! Undefined control sequence.
\estwide ...tracolsep \fill }l*{#2}{#3}} \toprule 

\toprule由您尚未載入的 booktabs 套件定義。如果我添加

\usepackage{booktabs}

並註解掉

  %\estinput{#1}

因為我沒有該文件

您的範例運行沒有錯誤。

相關內容