You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

LaTeX论文主文档恢复\maketitle后编译报错,请求技术协助

LaTeX毕业论文主文档编译报错排查修复

问题描述

原本运行正常的毕业论文LaTeX主文档,误删\maketitle命令后重新添加,现在无法编译执行并报错,需排查解决。

原始代码

% Thesis master document
 \documentclass[final,12pt,a4paper,oneside]{book}
 \setcounter{secnumdepth}{3}
  \textheight =24.2 cm 
 \textwidth =15 cm 
 \topmargin =-15mm

 \usepackage[round]{natbib}

 \usepackage{amssymb}

 \usepackage{graphics}
usepackage{graphicx}
usepackage{epsfig}
usepackage{amsmath}
usepackage{amsthm}
usepackage{bm}
usepackage{layout}
usepackage {mathrsfs}
usepackage{listings}
usepackage{float}

def\hang{\hangindent\parindent}
def\rf{\par\noindent\hang}

 \newtheorem{defin}{Definition}
 \newtheorem{theorem}{Theorem}
 \newtheorem{result}{Result}


 \begin{document}

 \baselineskip = 18pt
 
 \pagestyle{plain}
 
 \frontmatter
 
 \include{Title}

 
 
 \maketitle
 \tableofcontents
 \listoftables
 %\listoffigures
 \include{Introduction}
 
 \mainmatter
 
 \include{Chapter1}
 \include{Chapter2}
 \include{Chapter3}
 \include{Chapter4}
 \include{Conclusion}
 %\include{Appendix}
 
 \backmatter
 
 \include{Bibliography}
 
 \end{document}

错误排查与修复方案

  1. 语法错误:缺失命令前缀反斜杠

    • 多个usepackage命令缺少\,比如usepackage{graphicx}应改为\usepackage{graphicx},这是编译失败的核心原因之一
    • 自定义命令def\hang和def\rf缺少\,需改为\def\hang{\hangindent\parindent}和\def\rf{\par\noindent\hang}
  2. 逻辑冲突:\maketitle位置与自定义标题页重复

    • 在book文档类中,\maketitle会自动生成标题页,但你已经通过\include{Title}引入了自定义标题页,两者重复会导致排版冲突。建议移除\maketitle,保留自定义的Title.tex标题页即可。

修复后的完整代码

% Thesis master document
\documentclass[final,12pt,a4paper,oneside]{book}
\setcounter{secnumdepth}{3}
\textheight=24.2cm 
\textwidth=15cm 
\topmargin=-15mm

\usepackage[round]{natbib}
\usepackage{amssymb}
\usepackage{graphics}
\usepackage{graphicx}
\usepackage{epsfig}
\usepackage{amsmath}
\usepackage{amsthm}
\usepackage{bm}
\usepackage{layout}
\usepackage{mathrsfs}
\usepackage{listings}
\usepackage{float}

\def\hang{\hangindent\parindent}
\def\rf{\par\noindent\hang}

\newtheorem{defin}{Definition}
\newtheorem{theorem}{Theorem}
\newtheorem{result}{Result}

\begin{document}

\baselineskip=18pt
\pagestyle{plain}

\frontmatter

\include{Title}

\tableofcontents
\listoftables
%\listoffigures
\include{Introduction}

\mainmatter

\include{Chapter1}
\include{Chapter2}
\include{Chapter3}
\include{Chapter4}
\include{Conclusion}
%\include{Appendix}

\backmatter

\include{Bibliography}

\end{document}

内容的提问来源于stack exchange,提问作者Juliet

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.08.15 06:20:45