basic-grammar
Basic Syntax
Basic Structure of a LaTeX Document
A complete LaTeX document is divided into three parts: document class declaration, preamble, and body.
- Document class: defines the overall document type (article, report, book)
- Preamble: before
\begin{document}, where packages are loaded and global settings are configured - Body: between
\begin{document}and\end{document}, containing all main content %is the comment symbol; the rest of the line will not be compiled
\documentclass{article}
% Preamble: load packages
\usepackage{ctex} % Chinese support package
\usepackage{amsmath} % Math formula package
\begin{document}
Hello, LaTeX!
This is a minimal example document.
\end{document}
Hello, LaTeX!
This is a minimal example document.
Common document classes:
article: short articles, conference papersreport: course reports, theses, supports chaptersbook: book typesetting