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

相关推荐
2601_957190901 分钟前
飞行影院安装施工指南:场地、动感系统与影片内容配套
大数据·前端·人工智能
爱折腾的小黑牛2 分钟前
简记往来批量录入功能的实现:从文本到结构化数据
前端·算法
YHHLAI28 分钟前
Agent 智能体开发实战 · 第六课:MCP 协议 —— 让 Agent 跨进程调用工具
前端·人工智能
SmartBoyW33 分钟前
前端死磕:一文彻底搞懂 JS 事件循环 (Event Loop) 与宏微任务
前端·javascript
爱勇宝1 小时前
3位工程师靠“删AI代码”创业,一周收费1万美元:以后最贵的能力,可能不是写代码
前端·后端·架构
Curvatureflight1 小时前
客户端日志上报怎么设计?让线上问题不再只靠用户截图
前端·系统架构
不法1 小时前
uniapp map地图导航/地图路线
前端·vue.js·uni-app
星栈2 小时前
LiveView 页面越写越卡,我最后抓到的凶手不是数据库,是我自己乱塞 `assigns`
前端·前端框架·elixir