LaTeX 中的 Frontier 输出

LaTeX 中的 Frontier 输出

使用 Stata 为边界输出生成的代码时出现此错误:

LaTeX Error: Illegal character in array arg.

代码如下:

\begin{table}[htbp]\centering
\def\sym#1{\ifmmode^{#1}\else\(^{#1}\)\fi}
\caption{Regression table\label{tab1}}
\begin{tabular}{l*{1}{D{.}{.}{-1}}}
\toprule
                    &\multicolumn{1}{c}{(1)}\\
                    &\multicolumn{1}{c}{log\_sorg\_out}\\
\midrule
Frontier            &                     \\
log\_sorg\_land       &       0.189\sym{***}\\
                    &      (4.37)         \\
\addlinespace
log\_labour          &       0.332\sym{**} \\
                    &      (3.23)         \\
\addlinespace
log\_oxen            &       0.221         \\
                    &      (1.45)         \\
\addlinespace
log\_capital         &    -0.00469         \\
                    &     (-0.10)         \\
\addlinespace
Constant            &       6.895\sym{***}\\
                    &      (5.46)         \\
\midrule
Sigma               &                     \\
Constant            &      -0.360\sym{***}\\
                    &     (-3.29)         \\
\midrule
Gamma               &                     \\
Constant            &      -0.263         \\
                    &     (-0.48)         \\
\midrule
Mu                  &                     \\
Constant            &       1.856         \\
                    &      (1.61)         \\
\midrule
Eta                 &                     \\
Constant            &     -0.0390         \\
                    &     (-0.67)         \\
\midrule
Observations        &         192         \\
\bottomrule
\multicolumn{2}{l}{\footnotesize \textit{t} statistics in parentheses}\\
\multicolumn{2}{l}{\footnotesize \sym{*} \(p<0.05\), \sym{**} \(p<0.01\), \sym{***} \(p<0.001\)}\\
\end{tabular}
\end{table}

答案1

您必须\usepackage{dcolumn}在序言中添加它,否则列类型D未定义。

\documentclass{article}
\usepackage{booktabs}
\usepackage{dcolumn}

\begin{document}

\begin{table}[htbp]
\def\sym#1{\ifmmode^{#1}\else\(^{#1}\)\fi}
    \centering
    \caption{Regression table}\label{tab1}
    \begin{tabular}{l*{1}{D{.}{.}{-1}}}
        \toprule
        &\multicolumn{1}{c}{(1)}\\
        &\multicolumn{1}{c}{log\_sorg\_out}\\
        \midrule
        Frontier            &          \\          
        log\_sorg\_land       &       0.189\sym{***}\\
        &      (4.37)         \\
        \addlinespace
        log\_labour          &       0.332\sym{**} \\
        &      (3.23)         \\
        \addlinespace
        log\_oxen            &       0.221         \\
        &      (1.45)         \\
        \addlinespace
        log\_capital         &    -0.00469         \\
        &     (-0.10)         \\
        \addlinespace
        Constant            &       6.895\sym{***}\\
        &      (5.46)         \\
        \midrule
        Sigma               &                     \\
        Constant            &      -0.360\sym{***}\\
        &     (-3.29)         \\
        \midrule
        Gamma               &                     \\
        Constant            &      -0.263         \\
        &     (-0.48)         \\
        \midrule
        Mu                  &                     \\
        Constant            &       1.856         \\
        &      (1.61)         \\
        \midrule
        Eta                 &                     \\
        Constant            &     -0.0390         \\
        &     (-0.67)         \\
        \midrule
        Observations        &         192         \\
        \bottomrule
        \multicolumn{2}{l}{\footnotesize \textit{t} statistics in parentheses}\\
        \multicolumn{2}{l}{\footnotesize \sym{*} \(p<0.05\), \sym{**} \(p<0.01\), \sym{***} \(p<0.001\)}\\
    \end{tabular}
\end{table}
\end{document}

在此处输入图片描述

相关内容