LaTeX系列1——主结构

初学,可交流,轻喷

复制代码
\documentclass{book}
\begin{document}
\title{Book Title}
\author{Author Name}
\date{\today}
\maketitle

\chapter{Introduction}
This is the introduction chapter of the book.

\section{First Section}
The first section of the book.

\subsection{Subsection}
A subsection within the first section.

\chapter{Another Chapter}
Another chapter in the book.

\end{document}
\chapter{Methodology}
The methodology is explained in this chapter.

\chapter{Conclusion}
In conclusion, the report summarizes key findings.

\end{document}

以上是用LaTeX去排版一本书

格式规范为:'\命令名{命令参数}'

其中有以下几行重要代码:

1.在文档的最前面要用\documentclass{}来指定文档类型,会根据指定的文档类型形成特定的整体布局和格式等(如默认页边距,页眉页脚等)

\documentclass{book} 即为将文档类型定义为Book

2.\begin{document}和\end{document}

首先\begin{}和\end{}是一对命令,用于定义一个环境,在一个环境中可以指定统一的格式或功能

这些环境用于创建不同的元素,如正文、列表、数学公式等,使用\begin{}和\end{}对文档的不同部分进行划分和控制

\begin{document}和\\end{document}意味着对整个文档进行控制

3.\title{Book Title}

\author{Author Name}
\date{\today}
\maketitle

前三行用于指定封面的标题,作者信息和日期

\maketitle指根据信息生成封面,如果没有这行信息,即使有标题作者和时间也不会生成封面

4.\maketitle和\begin{document}的位置关系

\begin{document}要在\maketitle之前,可以理解为封面也属于文档的内容

所以\begin{document} 和 \title{Book Title}

\title{Book Title} \author{Author Name}

\author{Author Name} \date{\today}

\date{\today} \begin{document}

\maketitle \maketitle

以上两种写法都是正确的

5.\chapter表示一级标题,\section表示二级标题,\subsection表示三级标题,\subsubsection表示四级标题?

对于documentclass为book的文档来说是的,但对于其他文档类型不一定,如\documentclass{article}时,\section{}为一级标题,\subsection{}为二级标题,\subsubsection{}为三级标题

相关推荐
英俊潇洒美少年3 小时前
Vue 生产环境打包:SourceMap、压缩、混淆、加密全解 + 最佳实践
前端·javascript·vue.js
巴博尔3 小时前
UNIAPP中NVUE页面 动画
android·前端·javascript·ios·uni-app
她说人狗殊途5 小时前
基于 vue-cli 创建
前端·javascript·vue.js
AZaLEan__6 小时前
前端移动端适配与 Bootstrap
前端·bootstrap·html
大家的林语冰6 小时前
Deno 2.8 正式发布,再次超越 Bun,史上最大的次版本升级诞生!
前端·javascript·node.js
渣渣xiong6 小时前
从零开始:前端转型AI agent直到就业第五十七天-第五十八天
前端·人工智能·python
AI周红伟7 小时前
周红伟:长鑫科技(CXMT)财务全景分析
前端·chrome·科技
excel7 小时前
JS 正则在多次 test() 时为什么会出现 lastIndex 缓存问题?
前端
IT_陈寒7 小时前
为什么 Java 的 Optional 让我调试到深夜?
前端·人工智能·后端
米丘8 小时前
React 19.x 的 lazy 与 Suspense
前端·javascript·react.js