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{}为三级标题

相关推荐
李姆斯6 小时前
为啥Agent在coding表现这么好,但是在别的领域就是差的不少?
前端·agent·ai编程
鱼与宇9 小时前
前端Web(html+css+js+vue3)
前端
雪芽蓝域zzs10 小时前
(六)打包优化 + Nginx 部署完整配置 + 项目收尾
前端·vue.js
研☆香11 小时前
聊一聊前端的常见字 关键字
开发语言·前端·javascript
东风破_11 小时前
JWT 1:从一个登录请求开始,理解 React 项目里的 API 层与 Mock
前端·后端
东风破_11 小时前
JWT 3:为什么 Token 要放进 Authorization?Axios 拦截器到底解决了什么?
前端·后端
东风破_11 小时前
JWT 5:路由守卫是什么?把整个 JWT 登录鉴权流程串起来
前端·后端
东风破_11 小时前
JWT 2:HTTP 是无状态的,为什么登录成功后还要给 Token?
前端·后端
东风破_11 小时前
JWT 4:Zustand 到底解决了什么?为什么登录状态要放进 Store?
前端·后端
IT_陈寒11 小时前
Vite动态导入差点让我秃头,原来问题出在这
前端·人工智能·后端