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

相关推荐
昔人'27 分钟前
css使用 :where() 来简化大型 CSS 选择器列表
前端·css
昔人'30 分钟前
css `dorp-shadow`
前端·css
流***陌38 分钟前
扭蛋机 Roll 福利房小程序前端功能设计:融合趣味互动与福利适配
前端·小程序
烛阴1 小时前
用 Python 揭秘 IP 地址背后的地理位置和信息
前端·python
前端开发爱好者1 小时前
尤雨溪官宣:"新玩具" 比 Prettier 快 45 倍!
前端·javascript·vue.js
why技术1 小时前
从18w到1600w播放量,我的一点思考。
java·前端·后端
欧阳呀2 小时前
Vue+element ui导入组件封装——超级优雅版
前端·javascript·vue.js·elementui
清风徐来QCQ2 小时前
css总结
前端
天***88963 小时前
js封装一个双精度算法实现
开发语言·前端·javascript
Algebraaaaa3 小时前
什么是前端、后端与全栈开发,Qt属于什么?
开发语言·前端·qt