![即使没有错误,Overleaf 也无法编译](https://linux22.com/image/478038/%E5%8D%B3%E4%BD%BF%E6%B2%A1%E6%9C%89%E9%94%99%E8%AF%AF%EF%BC%8COverleaf%20%E4%B9%9F%E6%97%A0%E6%B3%95%E7%BC%96%E8%AF%91.png)
我的问题是 Overleaf 无法编译我的文件,也无法生成 PDF。你能帮我解决这个问题吗?这是我的网址https://www.overleaf.com/read/yyffrwsrdbwq 它很长所以我不会复制粘贴它。
答案1
你的代码中有很多错误。这就是你无法编译代码的原因。
为了给您一个起点,请查看我从您给出的代码中浓缩出来的以下代码,以向您展示表格中的错误。请注意,您的公式中也有错误需要纠正,但如果您在纠正表格后无法解决问题,我认为您应该就该问题提出一个新问题...
\documentclass[12pt]{article}
\usepackage[T1]{fontenc}
\usepackage[english]{babel}
\usepackage[utf8]{inputenc} % <=========================================
\usepackage{amsmath}
\usepackage{booktabs} % <=============================================== missing!
\usepackage{longtable}
\usepackage{caption}
\usepackage{setspace}
\usepackage{csquotes}
%\usepackage[backend=biber,style=authoryear]{biblatex} % only this line!
\usepackage[style=numeric-comp,natbib=true]{biblatex} % or only this line!
\addbibresource{references.bib}
\usepackage{hyperref}
\begin{document}
\doublespacing
% SEC1
%\input{./section/section_1}
\clearpage
\section{Does Inter-Municipal Cooperation Really Reduce Delivery Costs? An Empirical Evaluation of the Role of Scale Economies, Transaction Costs, and Governance Arrangements}
\subsection{Motivation and Objectives}
\label{sec:Intro}
Therefore, our first hypothesis states the following:%\\ % <=========== no! never!
%\\ % <================================================================ no! never!
\textbf{Hypothesis 1: Studies of small municipalities tend to find IMC more cost-advantageous.}
\begin{longtable}{l l l} % <============================================ 3 columns
\caption{Multivariate studies included in the meta-regression analysis}\label{subsec:Intro/table}\\
\toprule
\textbf{Study} & \textbf{Service} & \textbf{Effect}\\
\midrule
Bel \& Costas (2006) & solid waste & saves costs \\
Sørensen (2007) & solid waste & increases costs \\
Bel \& Mur (2009) & solid waste & saves costs \\
Dijkgraaf \& Gradus (2013) & solid waste & mixed results \\
Dijkgraaf \& Gradus (2014) & solid waste & no impact \\
Frère, Leprince \& Paty (2014) & multiservice & no impact \\
Bel, Fageda \& Mur (2014) & solid waste & saves costs \\
Soukopova \& Klimovsky (2016a) & solid waste & saves costs \\
Soukopova \& Klimovsky (2016b) & solid waste & saves costs \\
Soukopova et al. (2016) & solid waste & increases costs \\
Niaounakis \& Blank (2017) & tax collection & no impact \\
Soukopová et al. (2017) & solid waste & saves costs \\
Blåka (2017a) & fire service & no impact \\
Soukopová \& Vaceková (2018) & solid waste & saves costs \\
Soukopova \& Sládecek (2018) & solid waste & saves costs \\
Ferraresi, Migali \& Rizzo (2018) & multiservice & saves costs \\
Allers \& de Greef (2018) & several services & mixed results \\
Bel, Qian \& Warner (WP) & several services & mixed results\\
\bottomrule
\end{longtable}
\begin{center}
\begin{tabular}{ c c }
$b_j$ & reported coefficient \\ % <==============================
$\beta$ & true effect \\
$\alpha_k$ & meta-regression coefficients\\
$Z_{jk}$ & meta-independent variables\\ % <==========================
$e_j$ & disturbance term of the meta-regression
\end{tabular}
\end{center}
\begin{longtable}{l|rrrrr}
\toprule
& OLS & Robust OLS & GEE & GLS \\
\midrule
Sample Size & 6.78E-05 & 6.78E-05* & 7.15E-05** & 1.30E-04\\
Year Data & -0.152 & -0.152 & -0.142 & -0.034\\
US & -1.790* & -1.790 & -1.831 & -4.101\\
Multi-Service 1 & 4.185*** & 4.185*** & 4.185*** & 3.290***\\
Panel & -3.727*** & -3.727*** & -3.820** & -5.377**\\
Population & 4.65E-06** & 4.65E-06** & 4.44E-06*** & 3.85E-05***\\
Transaction Costs & -0.777 & -0.777 & -0.782 & -0.320\\
Delegation & -5.473*** & -5.473*** & -5.377*** & -5.498***\\
Constant & 306.799 & 306.799 & 287.147 & 70.857\\
\bottomrule
\end{longtable}
\label{subsec:Intro/rfs} % <====================================== ?????
See Table \ref{table:table-1} in Section \ref{subsec:Intro/table} for details.
\end{document}
我用 标记了重要的代码更改<==========
。
不要使用\\
来开始新段落,而应使用空白行:
Therefore, our first hypothesis states the following:%\\ % <=========== no! never!
%\\ % <================================================================ no! never!
您的第一个 longtable 被定义为使用 4 列,但您只有三列的数据。表格的开头应该有标题,请注意标签必须跟在命令后面\caption
。请注意,longtable
命令\caption{...}\label{}\\
必须以以下内容结尾\\
:
\begin{longtable}{l l l} % <============================================ 3 columns
\caption{Multivariate studies included in the meta-regression analysis}\label{subsec:Intro/table}\\
\toprule
\textbf{Study} & \textbf{Service} & \textbf{Effect}\\
\midrule
Bel \& Costas (2006) & solid waste & saves costs \\
请查看我添加了包booktabs
以便能够使用命令\toprule
,\midrule
和\bottomrule
。请查看我在表格中进行的漂亮打印,以获得更易读的表格代码...
在您的第二张表中,您忘记添加$
数学内容:
\begin{center}
\begin{tabular}{ c c }
$b_j$ & reported coefficient \\ % <==============================
$\beta$ & true effect \\
$\alpha_k$ & meta-regression coefficients\\
$Z_{jk}$ & meta-independent variables\\ % <==========================
$e_j$ & disturbance term of the meta-regression
\end{tabular}
\end{center}
请注意,您必须使用$Z_{jk}$
索引 jk! 来获取 Z,$Z_j_k$
这完全是错误的!
在您最后显示的表格中
\begin{longtable}{l|rrrrr}
\toprule
& OLS & Robust OLS & GEE & GLS \\
\midrule
Sample Size & 6.78E-05 & 6.78E-05* & 7.15E-05** & 1.30E-04\\
Year Data & -0.152 & -0.152 & -0.142 & -0.034\\
US & -1.790* & -1.790 & -1.831 & -4.101\\
Multi-Service 1 & 4.185*** & 4.185*** & 4.185*** & 3.290***\\
Panel & -3.727*** & -3.727*** & -3.820** & -5.377**\\
Population & 4.65E-06** & 4.65E-06** & 4.44E-06*** & 3.85E-05***\\
Transaction Costs & -0.777 & -0.777 & -0.782 & -0.320\\
Delegation & -5.473*** & -5.473*** & -5.377*** & -5.498***\\
Constant & 306.799 & 306.799 & 287.147 & 70.857\\
\bottomrule
\end{longtable}
\label{subsec:Intro/rfs} % <====================================== ?????
我猜那\label
应该是之前的表格的标签吧?如果是的话,添加一个\caption
以下内容\label
,就像在第一个表格中所做的那样...
通过此答案中提到的更正,您将获得上面的编译代码,结果如下:
以及表 2 和表 3:
我建议去掉标有红色箭头的垂直规则
\begin{longtable}{l|rrrrr}
到
\begin{longtable}{lrrrrr}
请按照此处所示更正您的原始代码,然后检查公式中的错误。
请参阅,这是为了帮助您入门,有更多可能性来获得更好的表格,但首先,获得编译代码很重要,我猜......
请提出一个新问题,仅显示您有问题的公式的可编译代码......