使用 \chapter 命令时未定义控制序列

使用 \chapter 命令时未定义控制序列

我是新来的 Latex 学习者,正在遵循指南。我创建了一个模板文档。我使用 \chapter{} 命令创建新章节,但出现错误,提示未定义控制序列。如果我删除此命令,文件将显示预期结果。

在此处输入图片描述 这是我的 Tex 代码。

 \documentclass[12pt, a4paper]{article}
\usepackage{graphicx}
\title{First \LaTeX{} article}
\author{Syed Ahmed  \\Electrical Dept. UET  \and {Talha Shabbir} \\ USPCASE NUST}
\date{February 2023}
\begin{document}
\maketitle
First document. This is a simple example, with no
extra parameters or packages included.
\section{Mathematics Section}
\begin{itemize}
    \item Einstien's Equation
    \begin{equation}
        E = mc^2
    \end{equation}
    Where  \\ E = Energy \\ m = mass \\ c = Speed of Light
\end{itemize}
\begin{itemize}
    \item L'Hopital's rule 
    \begin{equation}
        \lim_{x \to c} \frac{f(x)}{g(x)} = \lim_{x \to c} \frac{f^{'}(x)}{g^{'}(x)}
    \end{equation}
\end{itemize}
\begin{itemize}
    \item Maxwell's Equations
       \[\nabla \cdot \textbf{D} = \rho\]
       \[\nabla \cdot \textbf{B} = 0\]
       \[ \nabla \times \textbf{E} = - \frac{\partial \textbf{B} }{\partial t}\]
       \[\nabla \times \textbf{B} = \mu_0j + \frac{1}{c^2} \frac{\partial \textbf{E}}{\partial t}\]
\end{itemize}
\begin{abstract}
    The importance of water has been always vivid from the dawn of history. During the early stages of human evolution, the human ancestors used water for just the basic life need to sustain however with passage of time humans began to utilize water for other purposes such as irrigation, storage, cleaning, hygiene etc. However the use of water today is at much larger scale as compared to anything in the past of humanity. This led to the shortage of drinkable and usable water all around the world. Different methods and techniques have been proposed and implemented to clean the water from different facilities and sectors. One of the major cause of water pollution is contamination due to the dying chemicals in textile industry. This article proposes a new technique to not just clean the polluted water but also make it drinkable by purifying in much more affordable and environmental friendly way as compared to the conventional techniques. 
    \newline \textbf{Keywords:} Water contamination, water treatment, Dye water cleaning.
\end{abstract}
\chapter{First Chapter}
\section{Number System}
bgjkjkjk
\end{document}

这是在线 overleaf 项目链接。 https://www.overleaf.com/2427273277jcfqjtyzpbnr

答案1

经过一番研究,我发现章节命令仅在书籍(或报告)文档类中可用。我在文章类中尝试过它。

答案2

Leslie Lamport 基本上创建了默认的 LaTeX 文档类。您应该阅读他的手册 Leslie Lamport 的“LATEX 文档准备系统、用户指南和参考手册”,Addison-Wesley,1994 年及以后。

在其中他说“文章文档类不包含命令\chapter,...”。 (但它确实出现在他的reportbook类中)。

无需研究,只需阅读基本文档。

当尝试回答问题时,如果你知道自己在说什么会很有帮助。 --- GOM

相关内容