我从 Rstudio 导入了 stargazer 代码,但出现以下错误:
-错误行 1 !LaTeX 错误:环境表未定义。请参阅 LaTeX 手册或 LaTeX Companion 了解解释。输入 H 可立即获得帮助.... \begin{table}
-错误第 2 行!LaTeX 错误:\caption 超出浮点数。有关解释,请参阅 LaTeX 手册或 LaTeX Companion。输入 H 可立即获得帮助.... \caption
-错误行 66 !LaTeX 错误:\begin{document} 以 \end{table} 结束。请参阅 LaTeX 手册或 LaTeX Companion 了解解释。输入 H 可立即获得帮助.... \end{table}
-错误行 1!紧急停止。<> ./test.tex (作业中止,未找到合法的 \end)这是您使用的 TeX 内存量:25 个字符串,总共 480930579 个字符串字符,总共 2909512245229 个字,总共 300000015996 个多字母控制序列,总共 15000+200000532684 个字,用于 25 种字体的字体信息,总共 3000000 个字,用于 90001141 个连字异常,总共 819119i、8n、15p、118b、173s 个堆栈位置,总共 5000i、500n、10000p、200000b、50000s!==> 发生致命错误,未生成输出 PDF 文件!
我直接从 Rstudio 复制了代码。这是我的代码:
\begin{table}[!htbp] \centering
\caption{}
\label{}
\begin{tabular}{@{\extracolsep{5pt}}lc}
\\[-1.8ex]\hline
\hline \\[-1.8ex]
& \multicolumn{1}{c}{\textit{Dependent variable:}} \\
\cline{2-2}
\\[-1.8ex] & log\_AMOUNT\_RAISED\_USD \\
\hline \\[-1.8ex]
EDUCATIOL\_BACKGROUND & 0.177 \\
& (0.478) \\
& \\
MBA & $-$2.477$^{**}$ \\
& (1.162) \\
& \\
YEARS\_ACTIVE & 0.054 \\
& (0.048) \\
& \\
PRIOR\_EXP & $-$0.625 \\
& (0.729) \\
& \\
CONTROL\_OF\_CORRUPTION & 0.314 \\
& (0.341) \\
& \\
ICO\_WEBSITE\_DUMMY & 2.798 \\
& (3.561) \\
& \\
PRE\_ICO\_DUMMY & $-$2.451$^{***}$ \\
& (0.751) \\
& \\
BLOCKCHAINPLATFORM\_DUMMY\_ETH\_OR\_BIT & 0.726 \\
& (1.249) \\
& \\
AverageBitcoinPrice & 0.00002 \\
& (0.0001) \\
& \\
factor(YEAR)2017 & 0.422 \\
& (7.029) \\
& \\
factor(YEAR)2018 & $-$3.322 \\
& (7.064) \\
& \\
logPRICE\_AT\_ICO & $-$0.634 \\
& (0.759) \\
& \\
WHITELISTKYC\_DUMMY & $-$0.165 \\
& (0.918) \\
& \\
ICOBENCH\_RATING & 5.004$^{***}$ \\
& (0.584) \\
& \\
Constant & $-$8.108 \\
& (8.099) \\
& \\
\hline \\[-1.8ex]
Observations & 373 \\
R$^{2}$ & 0.244 \\
Adjusted R$^{2}$ & 0.215 \\
Residual Std. Error & 6.849 (df = 358) \\
F Statistic & 8.271$^{***}$ (df = 14; 358) \\
\hline
\hline \\[-1.8ex]
\textit{Note:} & \multicolumn{1}{r}{$^{*}$p$<$0.1; $^{**}$p$<$0.05; $^{***}$p$<$0.01} \\
\end{tabular}
\end{table}
答案1
我会借此机会提供答案;)
这是 MWE 从头开始发布的逐字代码片段:
\documentclass[draft]{article} % <- draft option shows the solid rule on the side, according to the float too large warning
\begin{document}
\begin{table}[!htbp] \centering
\caption{}
\label{}
\begin{tabular}{@{\extracolsep{5pt}}lc}
\\[-1.8ex]\hline
\hline \\[-1.8ex]
& \multicolumn{1}{c}{\textit{Dependent variable:}} \\
\cline{2-2}
\\[-1.8ex] & log\_AMOUNT\_RAISED\_USD \\
\hline \\[-1.8ex]
EDUCATIOL\_BACKGROUND & 0.177 \\
& (0.478) \\
& \\
MBA & $-$2.477$^{**}$ \\
& (1.162) \\
& \\
YEARS\_ACTIVE & 0.054 \\
& (0.048) \\
& \\
PRIOR\_EXP & $-$0.625 \\
& (0.729) \\
& \\
CONTROL\_OF\_CORRUPTION & 0.314 \\
& (0.341) \\
& \\
ICO\_WEBSITE\_DUMMY & 2.798 \\
& (3.561) \\
& \\
PRE\_ICO\_DUMMY & $-$2.451$^{***}$ \\
& (0.751) \\
& \\
BLOCKCHAINPLATFORM\_DUMMY\_ETH\_OR\_BIT & 0.726 \\
& (1.249) \\
& \\
AverageBitcoinPrice & 0.00002 \\
& (0.0001) \\
& \\
factor(YEAR)2017 & 0.422 \\
& (7.029) \\
& \\
factor(YEAR)2018 & $-$3.322 \\
& (7.064) \\
& \\
logPRICE\_AT\_ICO & $-$0.634 \\
& (0.759) \\
& \\
WHITELISTKYC\_DUMMY & $-$0.165 \\
& (0.918) \\
& \\
ICOBENCH\_RATING & 5.004$^{***}$ \\
& (0.584) \\
& \\
Constant & $-$8.108 \\
& (8.099) \\
& \\
\hline \\[-1.8ex]
Observations & 373 \\
R$^{2}$ & 0.244 \\
Adjusted R$^{2}$ & 0.215 \\
Residual Std. Error & 6.849 (df = 358) \\
F Statistic & 8.271$^{***}$ (df = 14; 358) \\
\hline
\hline \\[-1.8ex]
\textit{Note:} & \multicolumn{1}{r}{$^{*}$p$<$0.1; $^{**}$p$<$0.05; $^{***}$p$<$0.01} \\
\end{tabular}
\end{table}
\end{document}
它可以正确编译,但是表对于页面来说太大,如日志所述:
LaTeX Warning: Float too large for page by 135.04451pt on input line 70.
对原始代码片段进行一些修改后,我可以提出以下建议。更改内容在评论中详细说明。显然,字符串BLOCKCHAINPLATFORM\_DUMMY\_ETH\_OR\_BIT
很长。
\documentclass[draft]{article} % <- draft option shows the solid rule on the side, according to the float too large warning
\usepackage{booktabs}
\newcommand{\otoprule}{\midrule[\heavyrulewidth]}
\usepackage{multirow}
\usepackage{threeparttable} % to insert the notes
\begin{document}
\begin{table}[p] % just leave p(age) as the table is just too large for t(op) or b(ottom)
% \centering
\begin{threeparttable}
\caption{Your imported table}
\label{tab:yit}
\footnotesize % just reducing the font size allows to fit the table in the page
\begin{tabular}{lc}
\toprule
& \textit{Dependent variable:} \\ % no need for multicolumn in this case
\cline{2-2}
& log\_AMOUNT\_RAISED\_USD \\
\otoprule
\multirow{2}{*}{EDUCATIOL\_BACKGROUND} & 0.177 \\
& (0.478) \\ % I removed extra empty lines apparently used as separators and replaced them with \midrule
\midrule
\multirow{2}{*}{MBA} & $-2.477$\tnote{b} \\
& (1.162) \\ \midrule
\multirow{2}{*}{YEARS\_ACTIVE} & 0.054 \\
& (0.048) \\ \midrule
\multirow{2}{*}{PRIOR\_EXP} & $-0.625$ \\
& (0.729) \\ \midrule
\multirow{2}{*}{CONTROL\_OF\_CORRUPTION} & 0.314 \\
& (0.341) \\ \midrule
\multirow{2}{*}{ICO\_WEBSITE\_DUMMY} & 2.798 \\
& (3.561) \\ \midrule
\multirow{2}{*}{PRE\_ICO\_DUMMY} & $-2.451$\tnote{c} \\
& (0.751) \\ \midrule
\multirow{2}{*}{BLOCKCHAINPLATFORM\_DUMMY\_ETH\_OR\_BIT} & 0.726 \\
& (1.249) \\ \midrule
\multirow{2}{*}{AverageBitcoinPrice} & 0.00002 \\
& (0.0001) \\ \midrule
\multirow{2}{*}{factor(YEAR)2017} & 0.422 \\
& (7.029) \\ \midrule
\multirow{2}{*}{factor(YEAR)2018} & $-3.322$ \\
& (7.064) \\ \midrule
\multirow{2}{*}{logPRICE\_AT\_ICO} & $-0.634$ \\
& (0.759) \\ \midrule
\multirow{2}{*}{WHITELISTKYC\_DUMMY} & $-0.165$ \\
& (0.918) \\ \midrule
\multirow{2}{*}{ICOBENCH\_RATING} & 5.004\tnote{c} \\
& (0.584) \\ \midrule
\multirow{2}{*}{Constant} & $-8.108$ \\
& (8.099) \\ \midrule
Observations & 373 \\
R$^{2}$ & 0.244 \\
Adjusted R$^{2}$ & 0.215 \\
Residual Std. Error & 6.849 (df = 358) \\
F Statistic & 8.271\tnote{c} (df = 14; 358) \\
\bottomrule
\end{tabular}
\textit{Note:}
\begin{tablenotes}
\item[a] p$<$0.1; % apparently this is not used anywher, but I'll leave it
\item[b] p$<$0.05;
\item[c] p$<$0.01.
\end{tablenotes}
\end{threeparttable}
\end{table}
\end{document}
显然,关于内联数学格式还有很多话要说;但我想我们已经在这方面花了足够的时间。