技术标签: LaTeX论文排版学习 latex
本套LaTeX笔记是根据B站视频:https://www.bilibili.com/video/BV15b411j7Au 所做,仅记录本人学习,若有侵权行为,请联系我删除!
这里再介绍一个在线网站,可以在线编译查看效果。不方便下载软件的小伙伴可以使用网页版本在线编辑、编译、查看。
视频教程使用的软件是Tex Live,它是一个免费的跨平台的LaTeX发行版软件,可以从清华大学镜像网站进行下载。
点击文件texlivexxxx.iso进行下载,这里我下载的文件是texlive2021.iso,大小是4.1GB,所以请保证硬盘有足够的空间进行安装。
下载完之后,是一个ISO文件,可以直接使用解压软件进行解压。
至此,TexLive2021的下载完成。
找到install-tl-windows.bat文件,使用管理员身份运行,如图:可以修改安装路径,我安装在了D盘,建议放在C盘以外的其他盘。
点击左侧的Customize,可以将用不到的语言和功能取消勾选,加快安装的进度,我的语言取消的还剩下图中的三种。再取消右侧的“Texworks editor; TL…”勾选,当然你也可以按照默认,最后点击“安装”。
等待时间根据安装内容的多少确定,直到看到下面的界面,说明安装完成了。因为我已经安装过TexLive2021了,所以下面的图是我从网上找的。
为了验证TexLive2021是否安装成功,需要在命令行窗口输入命令,如果可以看到版本信息,说明安装正确。
tex -v
latex -v
xelatex -v
返回到主目录下
cd \
新建一个名为testLatex的文件夹
mkdir testLatex
使用记事本新建一个名为test.tex的文件,没有就新建;有就覆盖。
notepad test.tex
输入如下内容后保存:
\documentclass{
article}
\begin{
document}
Hello \LaTeX.
\end{
document}
查看当前目录下是否有test.tex文件
dir
使用latex进行编译
latex test.tex
查看当前目录
dir
多了一个test.dvi文件。我们使用dvipdfmx将dvi文件转换为pdf文件。
dvipdfmx test.dvi
打开此pdf文件
test.pdf
除了使用latex编译,再用dvipdfmx来生成pdf文件之外,我们还可以直接使用xelatex命令将tex源文件编译成pdf文件。注意,xelatex是一个支持utf-8的编译命令,即支持中文。
xelatex test.tex
我们可以将一些编译的过程做成一个批处理文件,即后缀名为bat的文本文件。例如,我们新建一个build.bat文件
在build.bat文件中,我们输入
latex test.tex
dvipdfmx test.dvi
del *.aux *.dvi *.log
运行此批处理文件
build
同样,我们也可以为xelatex新建一个批处理文件buildx.bat
xelatex test.tex
del *.dvi *.aux *.log
运行此批处理文件进行编译
buildx
之前说过,xelatex支持中文编译,但是上面编译结果显示并不能对中文进行编译,原因在于:
\documentclass{
article}
\usepackage{
ctex}
\begin{
document}
你好,\LaTeX 。
\end{
document}
好了,经过前面的演示,我们清楚了如何来编写一个LaTeX源文件,并且编译生成最终的pdf文件的过程。当然,如果我们完全在命令行内记事本中操作的话,这是一个非常繁琐的过程,不符合我们现在更为简单的操作的要求。为此,我们可以用一个称为vs code的IDE工具来实现LaTeX文档的编写、编译以及查看等过程。
注:此处视频中讲的是TexStudio,但是我在搭建深度学习环境的时候已经安装了VS Code,且经过我在网上的搜索,TexLive+VS Code现在是主流,网上有更多人推荐使用。因此,下面我以VS Code的下载、安装为例,而不是视频中的TexStudio。
首先,在VSCode官网下载VSCode软件
点击Download进行下载
然后进行安装
VSCode的安装比较简单,next,next就安装好了。若要查看具体过程,请参考博客。
接下来是在VSCode中进行LaTeX文档编写的配置。
install,安装LaTeX Workshop插件。
设置过程请查看博客。
我的配置文件为:
// ======================== LaTeX 设置 BEGIN ========================
// bibtex 格式
"latex-workshop.bibtex-format.tab": "tab",
// 自动编译,全部关闭,当且仅当你认为有需要的时候才会去做编译
"latex-workshop.latex.autoBuild.run": "never",
"latex-workshop.latex.autoBuild.cleanAndRetry.enabled": false,
// 设置 latex-workshop 的 PDF 预览程序,external 指的是外部程序
"latex-workshop.view.pdf.viewer": "external",
"latex-workshop.view.pdf.ref.viewer": "external",
"latex-workshop.view.pdf.external.viewer.command": "C:/Users/Administrator/AppData/Local/SumatraPDF/SumatraPDF.exe", // 注意修改路径
"latex-workshop.view.pdf.external.viewer.args": [
"%PDF%"
],
// 配置正向、反向搜索:.tex -> .pdf
"latex-workshop.view.pdf.external.synctex.command": "C:/Users/Administrator/AppData/Local/SumatraPDF/SumatraPDF.exe", // 注意修改路径
"latex-workshop.view.pdf.external.synctex.args": [
// 正向搜索
"-forward-search",
"%TEX%",
"%LINE%",
"-reuse-instance",
// 反向搜索
"-inverse-search",
"\"C:/Users/Administrator/AppData/Local/Programs/Microsoft VS Code/Code.exe\" \"C:/Users/Administrator/AppData/Local/Programs/Microsoft VS Code/resources/app/out/cli.js\" -gr %f:%l",
"%PDF%"
],
// 这是一些独立的编译选项,可以作为工具被编译方案调用
"latex-workshop.latex.tools": [
{
// Windows 原生安装 TeX Live 2020 的编译选项
"name": "Windows XeLaTeX",
"command": "xelatex",
"args": [
"-synctex=1",
"-interaction=nonstopmode",
"-file-line-error",
"-pdf",
"%DOCFILE%"
]
},
{
// Windows Biber 编译
"name": "Windows Biber",
"command": "biber",
"args": [
"%DOCFILE%"
]
},
{
// WSL XeLaTeX 编译一般的含有中文字符的文档
"name": "WSL XeLaTeX",
"command": "wsl",
"args": [
"/usr/local/texlive/2020/bin/x86_64-linux/xelatex",
"-synctex=1",
"-interaction=nonstopmode",
"-file-line-error",
"-pdf",
//"-output-directory=%OUTDIR%",
//"-aux-directory=%OUTDIR%",
"%DOCFILE%"
]
},
{
// WSL biber / bibtex 编译带有 citation 标记项目的文档
"name": "WSL Biber",
"command": "wsl",
"args": [
"/usr/local/texlive/2020/bin/x86_64-linux/biber",
"%DOCFILE%"
]
},
{
// macOS 或者 Linux 的简单编译
// 两种操作系统的操作方式相同
"name": "macOS / Linux XeLaTeX",
"commmand": "xelatex",
"args": [
"-synctex=1",
"-interaction=nonstopmode",
"-file-line-error",
"-pdf",
"%DOCFILE%"
]
},
{
// macOS 或者 Linux 的索引编译
// 两种操作系统的操作方式相同
"name": "macOS / Linux Biber",
"command": "biber",
"args": [
"%DOCFILE%"
]
}
],
// 这是一些编译方案,会出现在 GUI 菜单里
"latex-workshop.latex.recipes": [
{
// 1.1 Windows 编译简单的小文档,这个选项不太常用,因为绝大多数文章都需要有参考文献索引
"name": "Windows XeLaTeX 简单编译",
"tools": [
"Windows XeLaTeX"
]
},
{
// 1.2 Windows 编译带有索引的论文,需要进行四次编译;-> 符号只是一种标记而已,没有程序上的意义
"name": "Windows xe->bib->xe->xe 复杂编译",
"tools": [
"Windows XeLaTeX",
"Windows Biber",
"Windows XeLaTeX",
"Windows XeLaTeX"
]
},
{
// 2.1 WSL 编译简单的小文档,这个选项不太常用,因为我绝大多数文章都需要有引用。
"name": "XeLaTeX 简单编译",
"tools": [
"WSL XeLaTeX"
]
},
{
// 2.2 带有 citation 索引的文档,需要进行四次编译;-> 符号只是一种标记而已,没有程序上的意义
"name": "xe->bib->xe->xe 复杂编译",
"tools": [
"WSL XeLaTeX",
"WSL Biber",
"WSL XeLaTeX",
"WSL XeLaTeX"
]
},
{
// 3.1 macOS 简单 小文档
"name": "macOS XeLaTeX 简单编译",
"tools": [
"macOS XeLaTeX"
]
},
{
// 3.2 macOS 四次编译
"name": "macOS xe->bib->xe->xe 复杂编译",
"tools": [
"macOS / Linux XeLaTeX",
"macOS / Linux Biber",
"macOS / Linux XeLaTeX",
"macOS / Linux XeLaTeX"
]
}
],
// 清空中间文件
"latex-workshop.latex.clean.fileTypes": [
"*.aux",
"*.bbl",
"*.blg",
"*.idx",
"*.ind",
"*.lof",
"*.lot",
"*.out",
"*.toc",
"*.acn",
"*.acr",
"*.alg",
"*.glg",
"*.glo",
"*.gls",
"*.ist",
"*.fls",
"*.log",
"*.fdb_latexmk",
"*.bcf",
"*.run.xml",
"*.synctex.gz"
]
// ======================== LaTeX 设置 END ========================
重启VSCode。
在安装、配置好VSCode这个IDE之后,我们就可以使用它来进行LaTeX源文件的编写、编译以及最终生成的PDF文件的查看操作了。
首先,我们创建一个testvscode.tex文件,因为该文件在编译过程中会产生许多其他文件,所以我们新建一个testvscode文件夹来存储这些文件。
我们通过一个实例来分析一下LaTeX文件的基本结构。
tex文件的结构分为导言区和正文区(文档区),导言区可以进行一些全局的设置,正文区(文档区)就写正文。
% %后面的内容是注释
% 导言区
\documentclass{
article} % 文档类除了article,还有book, report, letter
% 引入ctex的宏包使得支持中文
\usepackage{
ctex}
\title{
My First Document} % 文档题目
\author{
Yahu Yang} % 作者
\date{
\today} % \today表示今天的日期
% 正文区(文档区)
% 正文区以\begin{
document}开始,以\end{
document}结束
\begin{
document}
% 使导言区的内容在正文区显示
\maketitle
Hello World!
% 增加一个空行,在编译输出的时候,代表换行;多个空行会被视作一个空行
% here is my big formula
% 使用$$包裹的部分在输出的时候,按照数学模式行内输出
Let $f(x)$ be defined by the formule
% $$$$包裹的部分在输出的时候,会新起一行居中输出
$$f(x)=3x^2+x-1$$ which is a polynomial
of degree 2.
\end{
document}
LaTeX中处理中文需要注意两点:
% 导言区
\documentclass{
article}
% 引入ctex的宏包使得支持中文
\usepackage{
ctex}
% 正文区使用了自定义的命令\degree
\newcommand\degree{
^\circ}
\title{
\heiti 杂谈勾股定理} % 文档题目
\author{
\kaishu 张三} % 作者
\date{
\today} % \today表示今天的日期
% 正文区(文档区)
% 正文区以\begin{
document}开始,以\end{
document}结束
\begin{
document}
% 使导言区的内容在正文区显示
\maketitle
勾股定理可以用现代语言表述如下:
直角三角形斜边的平方等于两腰的平方和。
可以用符号语言表述为:设直角三角形$ABC$,其中$\angle C=90\degree$,则有:
% equation环境表示产生带编号的公式
\begin{
equation}
AB^2 = BC^2 + AC^2.
\end{
equation}
% 增加一个空行,在编译输出的时候,代表换行;多个空行会被视作一个空行
% here is my big formula
% 使用$$包裹的部分在输出的时候,按照数学模式行内输出
Let $f(x)$ be defined by the formule
% $$$$包裹的部分在输出的时候,会新起一行居中输出
$$f(x)=3x^2+x-1$$ which is a polynomial
of degree 2.
\end{
document}
此外,我们还可以在控制台输入
texdoc ctex
查看ctex宏包手册
输入
texdoc lshort-zh
可以查看texlive提供的任何一个中文帮助文件。
LaTeX的这5种属性都可以通过命令或声明进行设置,关于字体编码,后面再进行讨论,本节课主要讨论字体族、字体系列、字体形状和字体大小的设置。
字体大小默认值是10pt,修改默认值,需要写在\documentclass[11pt]{article}的方括号里,这里的10pt是article定义的,除了10pt,还有11pt和12pt,没有其他的了。
% 导言区
% 10pt是默认正常的字体大小,即下文中的normalsize
\documentclass[10pt]{
article}
\usepackage{
ctex}
% 自定义字体,类似于C语言中的自定义函数,在上面定义,下面调用
\newcommand{
\myfont}{
\textbf{
\textsf{
Fancy Text}}}
% 正文区(文档区)
\begin{
document}
% 字体族设置(罗马字体、无衬线字体、打字机字体)
% 字体命令 {
}中是作用到的文字
\textrm{
Roman Family} \textsf{
Sans Serif Family}
\texttt{
Typewriter Family}
% 字体声明 后面紧跟的文字是作用到的文字
% 在字体声明时,如果不带{
}限定范围,那么后面的所有文字都按照字体声明来显示,
% 直达碰到下一个字体声明为止。
{
\rmfamily Roman Family} {
\sffamily Sans Serif Family}
{
\ttfamily Typewriter Family}
{
\sffamily who you are? you find self on everyone around.
take you as the same as others!}
{
\ttfamily Are you wiser than others? definitely no.
in some ways, may it is true. What can you achieve?
a luxurious house? a brillilant car? an admirable
career? who knows?}
% 字体系列设置(粗细、宽度)
% 字体命令
\textmd{
Medium Series} \textbf{
Boldface Series}
% 字体声明
{
\mdseries Medium Series} {
\bfseries Boldface Series}
% 字体形状设置(直立、斜体、伪斜体、小型大写)
%字体命令
\textup{
Upright Shape} \textit{
Italic Shape}
\textsl{
Slanted Shape} \textsc{
Small Caps Shape}
% 字体声明
{
\upshape Upright Shape} {
\itshape Italic Shape}
{
\slshape Slanted Shape} {
\scshape Small Caps Shape}
% 中文字体
% \quad表示空格
{
\songti 宋体} \quad {
\heiti 黑体} \quad {
\fangsong 仿宋}
\quad {
\kaishu 楷书}
中文字体的\textbf{
粗体}与\textit{
斜体}
% 字体大小设置
% 字体大小是通过一系列声明实现的,这些声明是与normalsize
% 相对的大小
{
\tiny Hello}\\
{
\scriptsize Hello}\\
{
\footnotesize Hello}\\
{
\small Hello}\\
{
\normalsize Hello}\\
{
\large Hello}\\
{
\Large Hello}\\
{
\LARGE Hello}\\
{
\huge Hello}\\
{
\Huge Hello}\\
% 中文字号设置命令
\zihao{
5} 你好!
% latex格式与内容分离
\myfont
\end{
document}
其他内容可以参考ctex手册
texdoc ctex
% 导言区
\documentclass{
article} % ctexbook, ctexrep
\usepackage{
ctex}
% 正文区(文档区)
\begin{
document}
\section{
引言}
\section{
实验方法}
\section{
实验结果}
\subsection{
数据}
\subsection{
图表}
\subsubsection{
实验条件}
\subsubsection{
实验过程}
\subsection{
结果分析}
\section{
结论}
\section{
致谢}
\end{
document}
% 导言区
\documentclass{
article} % ctexbook, ctexrep
\usepackage{
ctex}
% 正文区(文档区)
\begin{
document}
\section{
引言}
人工智能是计算机科学的一个分支,它企图了解智能的实质
,并生产出一种新的能以人类智能相似的方式做出反应的智
能机器,该领域的研究包括机器人、语言识别、图像识别、
自然语言处理和专家系统等。人工智能从诞生以来,理论和
技术日益成熟,应用领域也不断扩大,可以设想,未来人工
智能带来的科技产品,将会是人类智慧的“容器”。人工智能
可以对人的意识、思维的信息过程的模拟。人工智能不是人
的智能,但能像人那样思考、也可能超过人的智能。
人工智能是一门极富挑战性的科学,从事这项工作的人必须
懂得计算机知识,心理学和哲学。人工智能是包括十分广泛
的科学,它由不同的领域组成,如机器学习,计算机视觉等
等,总的说来,人工智能研究的一个主要目标是使机器能够
胜任一些通常需要人类智能才能完成的复杂工作。但不同的
时代、不同的人对这种“复杂工作”的理解是不同的。
\section{
实验方法}
\section{
实验结果}
\subsection{
数据}
\subsection{
图表}
\subsubsection{
实验条件}
\subsubsection{
实验过程}
\subsection{
结果分析}
\section{
结论}
\section{
致谢}
\end{
document}
% 导言区
\documentclass{
article} % ctexbook, ctexrep
\usepackage{
ctex}
% 正文区(文档区)
\begin{
document}
\section{
引言}
人工智能是计算机科学的一个分支,它企图了解智能的实质
,并生产出一种新的能以人类智能相似的方式做出反应的智
能机器,该领域的研究包括机器人、语言识别、图像识别、
自然语言处理和专家系统等。人工智能从诞生以来,理论和
技术日益成熟,应用领域也不断扩大,可以设想,未来人工
智能带来的科技产品,将会是人类智慧的“容器”。人工智能
可以对人的意识、思维的信息过程的模拟。人工智能不是人
的智能,但能像人那样思考、也可能超过人的智能。
人工智能是一门极富挑战性的科学,从事这项工作的人必须
懂得计算机知识,心理学和哲学。人工智能是包括十分广泛
的科学,它由不同的领域组成,如机器学习,计算机视觉等
等,总的说来,人工智能研究的一个主要目标是使机器能够
胜任一些通常需要人类智能才能完成的复杂工作。\\ 但不同的
时代、不同的人对这种“复杂工作”的理解是不同的。
\section{
实验方法}
\section{
实验结果}
\subsection{
数据}
\subsection{
图表}
\subsubsection{
实验条件}
\subsubsection{
实验过程}
\subsection{
结果分析}
\section{
结论}
\section{
致谢}
\end{
document}
% 导言区
\documentclass{
article} % ctexbook, ctexrep
\usepackage{
ctex}
% 正文区(文档区)
\begin{
document}
\section{
引言}
人工智能是计算机科学的一个分支,它企图了解智能的实质
,并生产出一种新的能以人类智能相似的方式做出反应的智
能机器,该领域的研究包括机器人、语言识别、图像识别、
自然语言处理和专家系统等。人工智能从诞生以来,理论和
技术日益成熟,应用领域也不断扩大,可以设想,未来人工
智能带来的科技产品,将会是人类智慧的“容器”。人工智能
可以对人的意识、思维的信息过程的模拟。人工智能不是人
的智能,但能像人那样思考、也可能超过人的智能。
人工智能是一门极富挑战性的科学,从事这项工作的人必须
懂得计算机知识,心理学和哲学。人工智能是包括十分广泛
的科学,它由不同的领域组成,如机器学习,计算机视觉等
等,总的说来,人工智能研究的一个主要目标是使机器能够
胜任一些通常需要人类智能才能完成的复杂工作。\par 但不同的
时代、不同的人对这种“复杂工作”的理解是不同的。
\section{
实验方法}
\section{
实验结果}
\subsection{
数据}
\subsection{
图表}
\subsubsection{
实验条件}
\subsubsection{
实验过程}
\subsection{
结果分析}
\section{
结论}
\section{
致谢}
\end{
document}
当然,我们也可以使用ctexart这样的文档类来实现相应的操作。
% 导言区
\documentclass{
ctexart} % ctexbook, ctexrep
% \usepackage{
ctex}
% 正文区(文档区)
\begin{
document}
\section{
引言}
人工智能是计算机科学的一个分支,它企图了解智能的实质
,并生产出一种新的能以人类智能相似的方式做出反应的智
能机器,该领域的研究包括机器人、语言识别、图像识别、
自然语言处理和专家系统等。人工智能从诞生以来,理论和
技术日益成熟,应用领域也不断扩大,可以设想,未来人工
智能带来的科技产品,将会是人类智慧的“容器”。人工智能
可以对人的意识、思维的信息过程的模拟。人工智能不是人
的智能,但能像人那样思考、也可能超过人的智能。
人工智能是一门极富挑战性的科学,从事这项工作的人必须
懂得计算机知识,心理学和哲学。人工智能是包括十分广泛
的科学,它由不同的领域组成,如机器学习,计算机视觉等
等,总的说来,人工智能研究的一个主要目标是使机器能够
胜任一些通常需要人类智能才能完成的复杂工作。\par 但不同的
时代、不同的人对这种“复杂工作”的理解是不同的。
\section{
实验方法}
\section{
实验结果}
\subsection{
数据}
\subsection{
图表}
\subsubsection{
实验条件}
\subsubsection{
实验过程}
\subsection{
结果分析}
\section{
结论}
\section{
致谢}
\end{
document}
请注意,此时section是居中排版的。当然,这些设置是可以更改的。
% 导言区
\documentclass{
ctexart} % ctexbook, ctexrep
% \usepackage{
ctex}
% ============设置标题的格式============
\ctexset{
section = {
format+ = \zihao{
-4} \heiti \raggedright,
name = {
,、},
beforeskip = 1.0ex plus 0.2ex minus .2ex,
afterskip = 1.0ex plus 0.2ex minus .2ex,
aftername = \hspace{
0pt}
},
subsection = {
format+ = \zihao{
5} \heiti \raggedright,
% name = {
\thesubsection、},
name = {
,、},
number = \arabic{
subsection},
beforeskip = 1.0ex plus 0.2ex minus .2ex,
afterskip = 1.0ex plus 0.2ex minus .2ex,
aftername = \hspace{
0pt}
}
}
% 正文区(文档区)
\begin{
document}
\section{
引言}
人工智能是计算机科学的一个分支,它企图了解智能的实质
,并生产出一种新的能以人类智能相似的方式做出反应的智
能机器,该领域的研究包括机器人、语言识别、图像识别、
自然语言处理和专家系统等。人工智能从诞生以来,理论和
技术日益成熟,应用领域也不断扩大,可以设想,未来人工
智能带来的科技产品,将会是人类智慧的“容器”。人工智能
可以对人的意识、思维的信息过程的模拟。人工智能不是人
的智能,但能像人那样思考、也可能超过人的智能。
人工智能是一门极富挑战性的科学,从事这项工作的人必须
懂得计算机知识,心理学和哲学。人工智能是包括十分广泛
的科学,它由不同的领域组成,如机器学习,计算机视觉等
等,总的说来,人工智能研究的一个主要目标是使机器能够
胜任一些通常需要人类智能才能完成的复杂工作。\par 但不同的
时代、不同的人对这种“复杂工作”的理解是不同的。
\section{
实验方法}
\section{
实验结果}
\subsection{
数据}
\subsection{
图表}
\subsubsection{
实验条件}
\subsubsection{
实验过程}
\subsection{
结果分析}
\section{
结论}
\section{
致谢}
\end{
document}
请注意,此时section已变为要求的排版格式。
类似的,我们还可以用\chapter命令来产生来章节的大纲。
% 导言区
\documentclass{
ctexbook} % ctexbook, ctexrep
% \usepackage{
ctex}
% ============设置标题的格式============
\ctexset{
section = {
format+ = \zihao{
-4} \heiti \raggedright,
name = {
,、},
beforeskip = 1.0ex plus 0.2ex minus .2ex,
afterskip = 1.0ex plus 0.2ex minus .2ex,
aftername = \hspace{
0pt}
},
subsection = {
format+ = \zihao{
5} \heiti \raggedright,
% name = {
\thesubsection、},
name = {
,、},
number = \arabic{
subsection},
beforeskip = 1.0ex plus 0.2ex minus .2ex,
afterskip = 1.0ex plus 0.2ex minus .2ex,
aftername = \hspace{
0pt}
}
}
% 正文区(文档区)
\begin{
document}
\chapter{
绪论}
\section{
研究的目的和意义}
\section{
国内外研究现状}
\subsection{
国外研究现状}
\subsection{
国内研究现状}
\section{
研究内容}
\section{
研究方法与技术路线}
\subsection{
研究内容}
\subsection{
技术路线}
\chapter{
实验与结果分析}
\section{
引言}
\section{
实验方法}
\section{
实验结果}
\subsection{
数据}
\subsection{
图表}
\subsubsection{
实验条件}
\subsubsection{
实验过程}
\subsection{
结果分析}
\section{
结论}
\section{
致谢}
\end{
document}
注意,此时的subsubsection是不起作用的。
同时,我们还可以使用\tableofcontents命令来产生整个文档的目录。
% 导言区
\documentclass{
ctexbook} % ctexbook, ctexrep
% \usepackage{
ctex}
% ============设置标题的格式============
\ctexset{
section = {
format+ = \zihao{
-4} \heiti \raggedright,
name = {
,、},
beforeskip = 1.0ex plus 0.2ex minus .2ex,
afterskip = 1.0ex plus 0.2ex minus .2ex,
aftername = \hspace{
0pt}
},
subsection = {
format+ = \zihao{
5} \heiti \raggedright,
% name = {
\thesubsection、},
name = {
,、},
number = \arabic{
subsection},
beforeskip = 1.0ex plus 0.2ex minus .2ex,
afterskip = 1.0ex plus 0.2ex minus .2ex,
aftername = \hspace{
0pt}
}
}
% 正文区(文档区)
\begin{
document}
\tableofcontents
\chapter{
绪论}
\section{
研究的目的和意义}
\section{
国内外研究现状}
\subsection{
国外研究现状}
\subsection{
国内研究现状}
\section{
研究内容}
\section{
研究方法与技术路线}
\subsection{
研究内容}
\subsection{
技术路线}
\chapter{
实验与结果分析}
\section{
引言}
\section{
实验方法}
\section{
实验结果}
\subsection{
数据}
\subsection{
图表}
\subsubsection{
实验条件}
\subsubsection{
实验过程}
\subsection{
结果分析}
\section{
结论}
\section{
致谢}
\end{
document}
对于这些细节,我们可以查看相关手册。比如,在命令行输入
texdoc ctex
来打开ctex的宏包手册,便可以查阅ctexset命令的详细使用方法。
在导言区进行格式的设置,将内容与格式分离,是LaTeX排版的基本思想。
这一讲,我们讲解LaTeX中部分特殊字符的处理。主要有空白字符、控制符、排版符号、标志符号、引号、连字符、非英文字符和重音符号。
% 导言区
\documentclass{
article}
\usepackage{
ctex} % 处理中文的宏包
% 正文区(文稿区)
\begin{
document}
\section{
空白符号}
\section{
\LaTeX 控制符}
\section{
排版符号}
\section{
\TeX 标志符号}
\section{
引号}
\section{
连字符}
\section{
非英文字符}
\section{
重音符号(以o为例)}
\end{
document}
输入一段英文和一段中文
% 导言区
\documentclass{
article}
\usepackage{
ctex} % 处理中文的宏包
% 正文区(文稿区)
\begin{
document}
\section{
空白符号}
Artificial intelligence is a branch of computer
science. It attempts to understand the essence
of intelligence and produce a new intelligent
machine that can respond in a similar way to
human intelligence. The research in this field
includes robot, language recognition, image
recognition, natural language processing and
expert system. Since the birth of artificial
intelligence, the theory and technology have
become increasingly mature, and the application
field has been expanding. It can be imagined
that the scientific and technological products
brought by artificial intelligence in the future
will be the "container" of human wisdom.
Artificial intelligence can simulate the
information process of human consciousness
and thinking. Artificial intelligence is not
human intelligence, but it can think like
people and may exceed human intelligence.
人工智能是计算机科学的一个分支,它企图了解智能的实质
,并生产出一种新的能以人类智能相似的方式做出反应的智
能机器,该领域的研究包括机器人、语言识别、图像识别、
自然语言处理和专家系统等。人工智能从诞生以来,理论和
技术日益成熟,应用领域也不断扩大,可以设想,未来人工
智能带来的科技产品,将会是人类智慧的“容器”。人工智能
可以对人的意识、思维的信息过程的模拟。人工智能不是人
的智能,但能像人那样思考、也可能超过人的智能。
\section{
\LaTeX 控制符}
\section{
排版符号}
\section{
\TeX 标志符号}
\section{
引号}
\section{
连字符}
\section{
非英文字符}
\section{
重音符号(以o为例)}
\end{
document}
% 导言区
\documentclass{
article}
\usepackage{
ctex} % 处理中文的宏包
% 正文区(文稿区)
\begin{
document}
\section{
空白符号}
Artificial intelligence is a
branch of computer science. It attempts to
understand the essence of intelligence and
produce a new intelligent machine that can
respond in a similar way to human
intelligence. The research in this field
includes robot, language recognition, image
recognition, natural language processing and
expert system. Since the birth of artificial
intelligence, the theory and technology have
become increasingly mature, and the application
field has been expanding. It can be imagined
that the scientific and technological products
brought by artificial intelligence in the future
will be the "container" of human wisdom.
Artificial intelligence can simulate the
information process of human consciousness
and thinking. Artificial intelligence is not
human intelligence, but it can think like
people and may exceed human intelligence.
人工智能是 计算机科学的一个分支,它企
图了解智能的实质,并生产出一种新的能以人类智能相似的
方式做出反应的智能机器,该领域的研究包括机器人、语言
识别、图像识别、自然语言处理和专家系统等。人工智能从
诞生以来,理论和技术日益成熟,应用领域也不断扩大,可
以设想,未来人工智能带来的科技产品,将会是人类智慧的
“容器”。人工智能可以对人的意识、思维的信息过程的模拟。
人工智能不是人的智能,但能像人那样思考、也可能超过人
的智能。
\section{
\LaTeX 控制符}
\section{
排版符号}
\section{
\TeX 标志符号}
\section{
引号}
\section{
连字符}
\section{
非英文字符}
\section{
重音符号(以o为例)}
\end{
document}
% 导言区
\documentclass{
article}
\usepackage{
ctex} % 处理中文的宏包
% 正文区(文稿区)
\begin{
document}
\section{
空白符号}
Artificial intelligence is a
branch of computer science. It attempts to
understand the essence of intelligence and
produce a new intelligent machine that can
respond in a similar way to human
intelligence. The research in this field
includes robot, language recognition, image
recognition, natural language processing and
expert system. Since the birth of artificial
intelligence, the theory and technology have
become increasingly mature, and the application
field has been expanding. It can be imagined
that the scientific and technological products
brought by artificial intelligence in the future
will be the "container" of human wisdom.
Artificial intelligence can simulate the
information process of human consciousness
and thinking. Artificial intelligence is not
human intelligence, but it can think like
people and may exceed human intelligence.
人工智能是 计算机科学的一个分支,它企
图了解智能的实质,并branch of computer science生产出一种新的能以人类智能相似的
方式做出反应的智能机器,该领域的研究包括机器人、语言
识别、图像识别、自然语言处理和专家系统等。人工智能从
诞生以来,理论和技术日益成熟,应用领域也不断扩大,可
以设想,未来人工智能带来的科技产品,将会是人类智慧的
“容器”。人工智能可以对人的意识、思维的信息过程的模拟。
人工智能不是人的智能,但能像人那样思考、也可能超过人
的智能。
\section{
\LaTeX 控制符}
\section{
排版符号}
\section{
\TeX 标志符号}
\section{
引号}
\section{
连字符}
\section{
非英文字符}
\section{
重音符号(以o为例)}
\end{
document}
注意,此时在中文和英文之间会自动产生空格。
总结一下:
空白符号
\section{
空白符号}
% 空行分段,多个空行等同一个空行
% 自动缩进,绝对不能使用空格代替
% 英文中多个空格处理为1个空格,中文中空格将被忽略
% 汉字与其它字符的间距会自动由XeLaTeX处理
% 禁止使用中文全角空格
Artificial intelligence is a
branch of computer science. It attempts to
understand the essence of intelligence and
produce a new intelligent machine that can
respond in a similar way to human
intelligence. The research in this field
includes robot, language recognition, image
recognition, natural language processing and
expert system. Since the birth of artificial
intelligence, the theory and technology have
become increasingly mature, and the application
field has been expanding. It can be imagined
that the scientific and technological products
brought by artificial intelligence in the future
will be the "container" of human wisdom.
Artificial intelligence can simulate the
information process of human consciousness
and thinking. Artificial intelligence is not
human intelligence, but it can think like
people and may exceed human intelligence.
人工智能是 计算机科学的一个分支,它企
图了解智能的实质,并branch of computer science生产出一种新的能以人类智能相似的
方式做出反应的智能机器,该领域的研究包括机器人、语言
识别、图像识别、自然语言处理和专家系统等。人工智能从
诞生以来,理论和技术日益成熟,应用领域也不断扩大,可
以设想,未来人工智能带来的科技产品,将会是人类智慧的
“容器”。人工智能可以对人的意识、思维的信息过程的模拟。
人工智能不是人的智能,但能像人那样思考、也可能超过人
的智能。
% 1em(当前字体中M的宽度)
a\quad b
% 2em
a\qquad b
% 约为1/6个em
a\,b a\thinspace b
% 0.5个em
a\enspace b
% 空格
a\ b
% 硬空格
a~b
% 1pc=12pt=4.218mm
a\kern 1pc b
a\kern -1em b
a\hskip 1em b
a\hspace{
35pt}b
% 占位宽度
a\hphantom{
xyz}b
% 弹性长度
a\hfill b
控制符
\section{
\LaTeX 控制符}
\# \$ \% \{
\} \~{
} \_{
} \^{
} \textbackslash
\&
排版符号
\section{
排版符号}
\S \P \dag \ddag \copyright \pounds
标志符号
也可以使用命令产生LaTeX的一些标志符号
\section{
\TeX 标志符号}
% 基本符号
\TeX{
} \LaTeX{
} \LaTeXe{
}
那么,类似的,能不能用XeLaTeX命令来产生XeLaTeX的一些标志符号呢?编译运行,会出现编译错误,编译错误说明没有\XeLaTeX这个命令,需要用\usepackage命令引入一个特殊的宏包。重新编译运行,便可以得到XeLaTeX的标志符号。
\section{
\TeX 标志符号}
% 基本符号
\TeX{
} \LaTeX{
} \LaTeXe{
}
\XeLaTeX
当然,我们也可以产生LaTeX的其他标志,同样,我们需要用\usepackage命令来引入特殊的宏包
\usepackage{
texnames} % 一些LOGO
\usepackage{
mflogo}
\section{
\TeX 标志符号}
% 基本符号
\TeX{
} \LaTeX{
} \LaTeXe{
}
\XeLaTeX
% texnames宏包提供
\AmSTeX{
} \AmS- \LaTeX{
}
\BibTeX{
} \LuaTeX{
}
% mflogo宏包提供
\METAFONT{
} \MF{
} \MP{
}
下面,我们讨论一下LaTeX中引号的问题。
引号
在LaTeX中,引号分为单引号和双引号,并有左右之分。在LaTeX中,用单个`表示左单引号,用’表示右单引号,用连续两个 撇号表示左双引号,用连续两个单引号表示右双引号。例如
\section{
引号}
` ' ``'' ``你好''
连字符
对于连字符,可以分别使用一个、两个、三个连续的减号,来生成短、中、长三种不同的连字符。
\section{
连字符}
- -- ---
非英文字符
也可以用命令产生非英文字符
\section{
非英文字符}
\oe \OE \ae \AE \aa \AA \o \O \l \L \ss \SS !`
?`
重音符号
还可以产生重音符号
\section{
重音符号(以o为例)}
\`o \'o \^o \''o \~o \=o \.o \u{
o} \v{
o} \H{
o}
\r{
o} \t{
o} \b{
o} \c{
o} \d{
o}
本节代码:
% 导言区
\documentclass{
article}
\usepackage{
ctex} % 处理中文的宏包
\usepackage{
xltxtra} % 提供了针对XeTeX的的改进并且加入了XeTeX的LOGO
\usepackage{
texnames} % 一些LOGO
\usepackage{
mflogo}
% 正文区(文稿区)
\begin{
document}
\section{
空白符号}
% 空行分段,多个空行等同一个空行
% 自动缩进,绝对不能使用空格代替
% 英文中多个空格处理为1个空格,中文中空格将被忽略
% 汉字与其它字符的间距会自动由XeLaTeX处理
% 禁止使用中文全角空格
Artificial intelligence is a
branch of computer science. It attempts to
understand the essence of intelligence and
produce a new intelligent machine that can
respond in a similar way to human
intelligence. The research in this field
includes robot, language recognition, image
recognition, natural language processing and
expert system. Since the birth of artificial
intelligence, the theory and technology have
become increasingly mature, and the application
field has been expanding. It can be imagined
that the scientific and technological products
brought by artificial intelligence in the future
will be the "container" of human wisdom.
Artificial intelligence can simulate the
information process of human consciousness
and thinking. Artificial intelligence is not
human intelligence, but it can think like
people and may exceed human intelligence.
人工智能是 计算机科学的一个分支,它企
图了解智能的实质,并branch of computer science生产出一种新的能以人类智能相似的
方式做出反应的智能机器,该领域的研究包括机器人、语言
识别、图像识别、自然语言处理和专家系统等。人工智能从
诞生以来,理论和技术日益成熟,应用领域也不断扩大,可
以设想,未来人工智能带来的科技产品,将会是人类智慧的
“容器”。人工智能可以对人的意识、思维的信息过程的模拟。
人工智能不是人的智能,但能像人那样思考、也可能超过人
的智能。
% 1em(当前字体中M的宽度)
a\quad b
% 2em
a\qquad b
% 约为1/6个em
a\,b a\thinspace b
% 0.5个em
a\enspace b
% 空格
a\ b
% 硬空格
a~b
% 1pc=12pt=4.218mm
a\kern 1pc b
a\kern -1em b
a\hskip 1em b
a\hspace{
35pt}b
% 占位宽度
a\hphantom{
xyz}b
% 弹性长度
a\hfill b
\section{
\LaTeX 控制符}
\# \$ \% \{
\} \~{
} \_{
} \^{
} \textbackslash
\&
\section{
排版符号}
\S \P \dag \ddag \copyright \pounds
\section{
\TeX 标志符号}
% 基本符号
\TeX{
} \LaTeX{
} \LaTeXe{
}
\XeLaTeX
% texnames宏包提供
\AmSTeX{
} \AmS- \LaTeX{
}
\BibTeX{
} \LuaTeX{
}
% mflogo宏包提供
\METAFONT{
} \MF{
} \MP{
}
\section{
引号}
` ' ``'' ``你好''
\section{
连字符}
- -- ---
\section{
非英文字符}
\oe \OE \ae \AE \aa \AA \o \O \l \L \ss \SS !`
?`
\section{
重音符号(以o为例)}
\`o \'o \^o \''o \~o \=o \.o \u{
o} \v{
o} \H{
o}
\r{
o} \t{
o} \b{
o} \c{
o} \d{
o}
\end{
document}
这一讲,我们讨论一下LaTeX中的插图问题。
在LaTeX中,是通过graphicx宏包实现插图的。为此,我们需要用\usepackage命令引入graphicx宏包,然后在文档区使用\includegraphics命令插入图像,该命令的必选参数用于指定需要插入的图像的文件名,其可选参数用于指定图像的缩放比例、旋转等参数。当使用XeLaTeX编译时,graphicx宏包支持多种图像文件格式。还可以通过\graphicspath命令指定图像文件的搜索路径,将图像等资源文件进行分门别类管理,是非常有必要的。例如,可以将所有图像文件放在当前路径下的figures文件夹中,此时可以用\graphicspath命令指定搜索路径为当前路径下的figures文件夹,当然,也可以添加其他路径,注意要用{}实现分组。查看各图像文件的文件名,然后用\includegraphics命令插入图像,用必选参数指定文件名,编译运行并查看结果。
% 导言区
\documentclass{
ctexart} % ctexbook, ctexrep
% \usepackage{
ctex}
% 导言区:\usepackage{
graphicx}
% 语法:\includegraphics[<选项>]{
<文件名>}
% 格式:EPS,PDF,PNG,JPEG,BMP
\usepackage{
graphicx}
\graphicspath{
{
figures/},{
pics/}} % 图片在当前目录下的figures目录
% 正文区(文档区)
\begin{
document}
\LaTeX{
}中的插图:
\includegraphics{
second}
\end{
document}
采用同样的方式,插入其他两幅图像。当然,也可以加入文件后缀名。编译运行并查看结果
\includegraphics{
second.jpg}
\includegraphics{
third.jpg}
\includegraphics{
fifth.jpg}
显然,插图太大,无法正常排版。为此,我么可以为\includegraphics命令引入可选参数,注意,可选参数使用[]表示的。
\LaTeX{
}中的插图:
\includegraphics{
second.jpg}
\includegraphics{
third.jpg}
\includegraphics{
fifth.jpg}
% 指定缩放因子
\includegraphics[scale=0.9]{
second}
\includegraphics[scale=0.9]{
third}
\includegraphics[scale=0.9]{
fifth}
% 图像高度
\includegraphics[height=2cm]{
second}
\includegraphics[height=2cm]{
third}
\includegraphics[height=2cm]{
fifth}
% 图像宽度
\includegraphics[width=2cm]{
second}
\includegraphics[width=2cm]{
third}
\includegraphics[width=2cm]{
fifth}
% 图像相对高度
\includegraphics[height=0.1\textheight]{
second}
\includegraphics[height=0.1\textheight]{
third}
\includegraphics[height=0.1\textheight]{
fifth}
% 图像相对宽度
\includegraphics[width=0.2\textwidth]{
second}
\includegraphics[width=0.2\textwidth]{
third}
\includegraphics[width=0.2\textwidth]{
fifth}
% 同时指定多个参数
% 同时指定相对宽度和旋转角度
% 不同参数之间用逗号进行分割
\includegraphics[angle=-45,width=0.2\textwidth]{
second}
\includegraphics[width=0.2\textwidth]{
third}
\includegraphics[angle=45,width=0.2\textwidth]{
fifth}
关于这些命令的细节,可以使用
texdoc graphicx
帮助文档进行查看。
本节代码:
% 导言区
\documentclass{
ctexart} % ctexbook, ctexrep
% \usepackage{
ctex}
% 导言区:\usepackage{
graphicx}
% 语法:\includegraphics[<选项>]{
<文件名>}
% 格式:EPS,PDF,PNG,JPEG,BMP
\usepackage{
graphicx}
\graphicspath{
{
figures/},{
pics/}} % 图片在当前目录下的figures目录
% 正文区(文档区)
\begin{
document}
\LaTeX{
}中的插图:
\includegraphics{
second.jpg}
\includegraphics{
third.jpg}
\includegraphics{
fifth.jpg}
% 指定缩放因子
\includegraphics[scale=0.9]{
second}
\includegraphics[scale=0.9]{
third}
\includegraphics[scale=0.9]{
fifth}
% 图像高度
\includegraphics[height=2cm]{
second}
\includegraphics[height=2cm]{
third}
\includegraphics[height=2cm]{
fifth}
% 图像宽度
\includegraphics[width=2cm]{
second}
\includegraphics[width=2cm]{
third}
\includegraphics[width=2cm]{
fifth}
% 图像相对高度
\includegraphics[height=0.1\textheight]{
second}
\includegraphics[height=0.1\textheight]{
third}
\includegraphics[height=0.1\textheight]{
fifth}
% 图像相对宽度
\includegraphics[width=0.2\textwidth]{
second}
\includegraphics[width=0.2\textwidth]{
third}
\includegraphics[width=0.2\textwidth]{
fifth}
% 同时指定多个参数
% 同时指定相对宽度和旋转角度
% 不同参数之间用逗号进行分割
\includegraphics[angle=-45,width=0.2\textwidth]{
second}
\includegraphics[width=0.2\textwidth]{
third}
\includegraphics[angle=45,width=0.2\textwidth]{
fifth}
\end{
document}
这一讲,我们主要讨论LaTeX中表格的制作和排版问题。
编译运行并查看结果
% 导言区
\documentclass{
ctexart} % ctexbook, ctexrep
% \usepackage{
ctex}
% 正文区(文档区)
\begin{
document}
\begin{
tabular}{
l c c c r}
姓名 & 语文 & 数学 & 外语 & 备注 \\
张三 & 87 & 100 & 93 & 优秀 \\
李四 & 75 & 64 & 52 & 补考另行通知 \\
王二 & 80 & 82 & 78 & \\
\end{
tabular}
\end{
document}
% 导言区
\documentclass{
ctexart} % ctexbook, ctexrep
% \usepackage{
ctex}
% 正文区(文档区)
\begin{
document}
\begin{
tabular}{
l | c | c | c | r}
姓名 & 语文 & 数学 & 外语 & 备注 \\
张三 & 87 & 100 & 93 & 优秀 \\
李四 & 75 & 64 & 52 & 补考另行通知 \\
王二 & 80 & 82 & 78 & \\
\end{
tabular}
\end{
document}
% 导言区
\documentclass{
ctexart} % ctexbook, ctexrep
% \usepackage{
ctex}
% 正文区(文档区)
\begin{
document}
\begin{
tabular}{
l||c|c|c|r}
\hline
姓名 & 语文 & 数学 & 外语 & 备注 \\
\hline \hline
张三 & 87 & 100 & 93 & 优秀 \\
\hline
李四 & 75 & 64 & 52 & 补考另行通知 \\
\hline
王二 & 80 & 82 & 78 & \\
\hline
\end{
tabular}
\end{
document}
% 导言区
\documentclass{
ctexart} % ctexbook, ctexrep
% \usepackage{
ctex}
% 正文区(文档区)
\begin{
document}
\begin{
tabular}{
|l||c|c|c|r|}
\hline
姓名 & 语文 & 数学 & 外语 & 备注 \\
\hline \hline
张三 & 87 & 100 & 93 & 优秀 \\
\hline
李四 & 75 & 64 & 52 & 补考另行通知 \\
\hline
王二 & 80 & 82 & 78 & \\
\hline
\end{
tabular}
\end{
document}
% 导言区
\documentclass{
ctexart} % ctexbook, ctexrep
% \usepackage{
ctex}
% 正文区(文档区)
\begin{
document}
\begin{
tabular}{
|l|c|c|c|r|}
\hline
姓名 & 语文 & 数学 & 外语 & 备注 \\
\hline
张三 & 87 & 100 & 93 & 优秀 \\
\hline
李四 & 75 & 64 & 52 & 补考另行通知 \\
\hline
王二 & 80 & 82 & 78 & \\
\hline
\end{
tabular}
\end{
document}
% 导言区
\documentclass{
ctexart} % ctexbook, ctexrep
% \usepackage{
ctex}
% 正文区(文档区)
\begin{
document}
\begin{
tabular}{
|l|c|c|c|p{
1.5cm}|}
\hline
姓名 & 语文 & 数学 & 外语 & 备注 \\
\hline
张三 & 87 & 100 & 93 & 优秀 \\
\hline
李四 & 75 & 64 & 52 & 补考另行通知 \\
\hline
王二 & 80 & 82 & 78 & \\
\hline
\end{
tabular}
\end{
document}
texdoc booktab
打开宏包说明文件。
例如三线表
texdoc longtab
跨页长表格
综合表格宏包
texdoc tabu
利用这些宏包,就可以实现更为复杂的表格。
本节代码:
% 导言区
\documentclass{
ctexart} % ctexbook, ctexrep
% \usepackage{
ctex}
% \begin{
tabular}[<垂直对齐方式>]{
<列格式说明>}
<表项> & <表项> & ... & <表项> \\
......
% \end{
tabular}
% 用\\表示换行
% 用&表示不同的列
% l-本列左对齐
% c-本列居中对齐
% r-本列右对齐
% p{
<宽>}-本列宽度固定,能够自动换行
% 正文区(文档区)
\begin{
document}
\begin{
tabular}{
|l|c|c|c|p{
1.5cm}|}
\hline
姓名 & 语文 & 数学 & 外语 & 备注 \\
\hline
张三 & 87 & 100 & 93 & 优秀 \\
\hline
李四 & 75 & 64 & 52 & 补考另行通知 \\
\hline
王二 & 80 & 82 & 78 & \\
\hline
\end{
tabular}
\end{
document}
这一小节,将讨论LaTeX中的浮动体问题。
% 导言区
\documentclass{
ctexart} % ctexbook, ctexrep
% \usepackage{
ctex}
\usepackage{
graphicx}
\graphicspath{
{
figures/}} % 图片在当前目录下的figures目录
% 正文区(文档区)
\begin{
document}
\LaTeX{
}中的插图:
\includegraphics[scale=0.3]{
seventh}
在\LaTeX{
}中的表格
\begin{
tabular}{
|l|c|c|c|r|}
\hline
姓名 & 语文 & 数学 & 外语 & 备注 \\
\hline
张三 & 87 & 100 & 93 & 优秀 \\
\hline
李四 & 75 & 64 & 52 & 补考另行通知 \\
\hline
王二 & 80 & 82 & 78 & \\
\hline
\end{
tabular}
\end{
document}
% 导言区
\documentclass{
ctexart} % ctexbook, ctexrep
% \usepackage{
ctex}
\usepackage{
graphicx}
\graphicspath{
{
figures/}} % 图片在当前目录下的figures目录
% 正文区(文档区)
\begin{
document}
\LaTeX{
}中的插图:
\begin{
figure}
\includegraphics[scale=0.3]{
seventh}
\end{
figure}
在\LaTeX{
}中的表格:
\begin{
table}
\begin{
tabular}{
|l|c|c|c|r|}
\hline
姓名 & 语文 & 数学 & 外语 & 备注 \\
\hline
张三 & 87 & 100 & 93 & 优秀 \\
\hline
李四 & 75 & 64 & 52 & 补考另行通知 \\
\hline
王二 & 80 & 82 & 78 & \\
\hline
\end{
tabular}
\end{
table}
\end{
document}
可以看到,图像与表格的位置都发生了浮动。
% 导言区
\documentclass{
ctexart} % ctexbook, ctexrep
% \usepackage{
ctex}
\usepackage{
graphicx}
\graphicspath{
{
figures/}} % 图片在当前目录下的figures目录
% 正文区(文档区)
\begin{
document}
\LaTeX{
}中的插图:
\begin{
figure}
\centering
\includegraphics[scale=0.3]{
seventh}
\end{
figure}
在\LaTeX{
}中的表格:
\begin{
table}
\centering
\begin{
tabular}{
|l|c|c|c|r|}
\hline
姓名 & 语文 & 数学 & 外语 & 备注 \\
\hline
张三 & 87 & 100 & 93 & 优秀 \\
\hline
李四 & 75 & 64 & 52 & 补考另行通知 \\
\hline
王二 & 80 & 82 & 78 & \\
\hline
\end{
tabular}
\end{
table}
\end{
document}
由于\centering命令是在figure环境和table环境中,所以他只影响环境中的内容。
% 导言区
\documentclass{
ctexart} % ctexbook, ctexrep
% \usepackage{
ctex}
\usepackage{
graphicx}
\graphicspath{
{
figures/}} % 图片在当前目录下的figures目录
% 正文区(文档区)
\begin{
document}
\LaTeX{
}中的插图:
\begin{
figure}[htbp]
\centering
\includegraphics[scale=0.3]{
seventh}
\end{
figure}
在\LaTeX{
}中的表格:
\begin{
table}
\centering
\begin{
tabular}{
|l|c|c|c|r|}
\hline
姓名 & 语文 & 数学 & 外语 & 备注 \\
\hline
张三 & 87 & 100 & 93 & 优秀 \\
\hline
李四 & 75 & 64 & 52 & 补考另行通知 \\
\hline
王二 & 80 & 82 & 78 & \\
\hline
\end{
tabular}
\end{
table}
\end{
document}
% 导言区
\documentclass{
ctexart} % ctexbook, ctexrep
% \usepackage{
ctex}
\usepackage{
graphicx}
\graphicspath{
{
figures/}} % 图片在当前目录下的figures目录
% 正文区(文档区)
\begin{
document}
\LaTeX{
}中的插图:
\begin{
figure}[htbp]
\centering
\includegraphics[scale=0.3]{
seventh}
\caption{
\TeX 系统的吉祥物---小狮子}
\end{
figure}
在\LaTeX{
}中的表格:
\begin{
table}
\centering
\begin{
tabular}{
|l|c|c|c|r|}
\hline
姓名 & 语文 & 数学 & 外语 & 备注 \\
\hline
张三 & 87 & 100 & 93 & 优秀 \\
\hline
李四 & 75 & 64 & 52 & 补考另行通知 \\
\hline
王二 & 80 & 82 & 78 & \\
\hline
\end{
tabular}
\end{
table}
\end{
document}
由排版结果可以看到,插图被自动进行了编号。
% 导言区
\documentclass{
ctexart} % ctexbook, ctexrep
% \usepackage{
ctex}
\usepackage{
graphicx}
\graphicspath{
{
figures/}} % 图片在当前目录下的figures目录
% 正文区(文档区)
\begin{
document}
\LaTeX{
}中的插图:
\begin{
figure}[htbp]
\centering
\includegraphics[scale=0.3]{
seventh}
\caption{
\TeX 系统的吉祥物---小狮子}
\end{
figure}
在\LaTeX{
}中的表格:
\begin{
table}
\centering
\caption{
考试成绩单}
\begin{
tabular}{
|l|c|c|c|r|}
\hline
姓名 & 语文 & 数学 & 外语 & 备注 \\
\hline
张三 & 87 & 100 & 93 & 优秀 \\
\hline
李四 & 75 & 64 & 52 & 补考另行通知 \\
\hline
王二 & 80 & 82 & 78 & \\
\hline
\end{
tabular}
\end{
table}
\end{
document}
可以看到,表格也被进行了自动编号,并且与插图的编号是相互独立的。
% 导言区
\documentclass{
ctexart} % ctexbook, ctexrep
% \usepackage{
ctex}
\usepackage{
graphicx}
\graphicspath{
{
figures/}} % 图片在当前目录下的figures目录
% 正文区(文档区)
\begin{
document}
\LaTeX{
}中的插图:
\begin{
figure}[htbp]
\centering
\includegraphics[scale=0.3]{
seventh}
\caption{
\TeX 系统的吉祥物---小狮子}
\end{
figure}
在\LaTeX{
}中的表格:
\begin{
table}[h]
\centering
\caption{
考试成绩单}
\begin{
tabular}{
|l|c|c|c|r|}
\hline
姓名 & 语文 & 数学 & 外语 & 备注 \\
\hline
张三 & 87 & 100 & 93 & 优秀 \\
\hline
李四 & 75 & 64 & 52 & 补考另行通知 \\
\hline
王二 & 80 & 82 & 78 & \\
\hline
\end{
tabular}
\end{
table}
\end{
document}
% 导言区
\documentclass{
ctexart} % ctexbook, ctexrep
% \usepackage{
ctex}
\usepackage{
graphicx}
\graphicspath{
{
figures/}} % 图片在当前目录下的figures目录
% 正文区(文档区)
\begin{
document}
\LaTeX{
}中\TeX 系统的吉祥物---小狮子见图\ref{
fig-seventh}。
\begin{
figure}[htbp]
\centering
\includegraphics[scale=0.3]{
seventh}
\caption{
\TeX 系统的吉祥物---小狮子}\label{
fig-seventh}
\end{
figure}
在\LaTeX{
}中的表格:
\begin{
table}[h]
\centering
\caption{
考试成绩单}
\begin{
tabular}{
|l|c|c|c|r|}
\hline
姓名 & 语文 & 数学 & 外语 & 备注 \\
\hline
张三 & 87 & 100 & 93 & 优秀 \\
\hline
李四 & 75 & 64 & 52 & 补考另行通知 \\
\hline
王二 & 80 & 82 & 78 & \\
\hline
\end{
tabular}
\end{
table}
\end{
document}
% 导言区
\documentclass{
ctexart} % ctexbook, ctexrep
% \usepackage{
ctex}
\usepackage{
graphicx}
\graphicspath{
{
figures/}} % 图片在当前目录下的figures目录
% 正文区(文档区)
\begin{
document}
\LaTeX{
}中\TeX 系统的吉祥物---小狮子见图\ref{
fig-seventh}。
\begin{
figure}[htbp]
\centering
\includegraphics[scale=0.3]{
seventh}
\caption{
\TeX 系统的吉祥物---小狮子}\label{
fig-seventh}
\end{
figure}
当然,在\LaTeX{
}中也可以使用表\ref{
tab-score}所示的表格。
\begin{
table}[h]
\centering
\caption{
考试成绩单}\label{
tab-score}
\begin{
tabular}{
|l|c|c|c|r|}
\hline
姓名 & 语文 & 数学 & 外语 & 备注 \\
\hline
张三 & 87 & 100 & 93 & 优秀 \\
\hline
李四 & 75 & 64 & 52 & 补考另行通知 \\
\hline
王二 & 80 & 82 & 78 & \\
\hline
\end{
tabular}
\end{
table}
\end{
document}
从而实现了表格的交叉引用。
% 导言区
\documentclass{
ctexart} % ctexbook, ctexrep
% \usepackage{
ctex}
\usepackage{
graphicx}
\graphicspath{
{
figures/}} % 图片在当前目录下的figures目录
% 正文区(文档区)
\begin{
document}
\LaTeX{
}中\TeX 系统的吉祥物---小狮子见图\ref{
fig-seventh}。
\begin{
figure}[htbp]
\centering
\includegraphics[scale=0.3]{
seventh}
\caption{
\TeX 系统的吉祥物---小狮子}\label{
fig-seventh}
\end{
figure}
遥望太白,看积雪皑皑,别有一番风景(图\ref{
fig-fifth})
\begin{
figure}[htbp] % 允许各个位置
\centering
\includegraphics[scale=0.3]{
fifth}
\caption{
太白山}\label{
fig-fifth}
\end{
figure}
熟练使用\LaTeX 中的TiKz,可以绘制如图\ref{
fig-eighth}所示的精美矢量图。
\begin{
figure}[htbp] % 允许各个位置
\centering
\includegraphics[scale=0.3]{
eighth}
\caption{
\LaTeX 中的绘图}\label{
fig-eighth}
\end{
figure}
当然,在\LaTeX{
}中也可以使用表\ref{
tab-score}所示的表格。
\begin{
table}[h]
\centering
\caption{
考试成绩单}\label{
tab-score}
\begin{
tabular}{
|l|c|c|c|r|}
\hline
姓名 & 语文 & 数学 & 外语 & 备注 \\
\hline
张三 & 87 & 100 & 93 & 优秀 \\
\hline
李四 & 75 & 64 & 52 & 补考另行通知 \\
\hline
王二 & 80 & 82 & 78 & \\
\hline
\end{
tabular}
\end{
table}
\end{
document}
由结果可以看出,所有的插图都进行了正确的编号,并且实现了正确的交叉引用。可以在源代码中适当的插入空行,使得源代码更加清晰。
当然,如果不需要某一部分内容时,我们可以将这部分内容进行注释。
% 导言区
\documentclass{
ctexart} % ctexbook, ctexrep
% \usepackage{
ctex}
\usepackage{
graphicx}
\graphicspath{
{
figures/}} % 图片在当前目录下的figures目录
% 正文区(文档区)
\begin{
document}
\LaTeX{
}中\TeX 系统的吉祥物---小狮子见图\ref{
fig-seventh}。
\begin{
figure}[htbp]
\centering
\includegraphics[scale=0.3]{
seventh}
\caption{
\TeX 系统的吉祥物---小狮子}\label{
fig-seventh}
\end{
figure}
% 遥望太白,看积雪皑皑,别有一番风景(图\ref{
fig-fifth})
% \begin{
figure}[htbp] % 允许各个位置
% \centering
% \includegraphics[scale=0.3]{
fifth}
% \caption{
太白山}\label{
fig-fifth}
% \end{
figure}
熟练使用\LaTeX 中的TiKz,可以绘制如图\ref{
fig-eighth}所示的精美矢量图。
\begin{
figure}[htbp] % 允许各个位置
\centering
\includegraphics[scale=0.3]{
eighth}
\caption{
\LaTeX 中的绘图}\label{
fig-eighth}
\end{
figure}
当然,在\LaTeX{
}中也可以使用表\ref{
tab-score}所示的表格。
\begin{
table}[h]
\centering
\caption{
考试成绩单}\label{
tab-score}
\begin{
tabular}{
|l|c|c|c|r|}
\hline
姓名 & 语文 & 数学 & 外语 & 备注 \\
\hline
张三 & 87 & 100 & 93 & 优秀 \\
\hline
李四 & 75 & 64 & 52 & 补考另行通知 \\
\hline
王二 & 80 & 82 & 78 & \\
\hline
\end{
tabular}
\end{
table}
\end{
document}
从排版结果可以看出,剩余的插图都进行了正确的编号和正确的交叉引用。如果需要找回原来的内容,只需要去掉注释即可。可以再注释一部分内容进行测试
% 导言区
\documentclass{
ctexart} % ctexbook, ctexrep
% \usepackage{
ctex}
\usepackage{
graphicx}
\graphicspath{
{
figures/}} % 图片在当前目录下的figures目录
% 正文区(文档区)
\begin{
document}
% \LaTeX{
}中\TeX 系统的吉祥物---小狮子见图\ref{
fig-seventh}。
% \begin{
figure}[htbp]
% \centering
% \includegraphics[scale=0.3]{
seventh}
% \caption{
\TeX 系统的吉祥物---小狮子}\label{
fig-seventh}
% \end{
figure}
遥望太白,看积雪皑皑,别有一番风景(图\ref{
fig-fifth})
\begin{
figure}[htbp] % 允许各个位置
\centering
\includegraphics[scale=0.3]{
fifth}
\caption{
太白山}\label{
fig-fifth}
\end{
figure}
熟练使用\LaTeX 中的TiKz,可以绘制如图\ref{
fig-eighth}所示的精美矢量图。
\begin{
figure}[htbp] % 允许各个位置
\centering
\includegraphics[scale=0.3]{
eighth}
\caption{
\LaTeX 中的绘图}\label{
fig-eighth}
\end{
figure}
当然,在\LaTeX{
}中也可以使用表\ref{
tab-score}所示的表格。
\begin{
table}[h]
\centering
\caption{
考试成绩单}\label{
tab-score}
\begin{
tabular}{
|l|c|c|c|r|}
\hline
姓名 & 语文 & 数学 & 外语 & 备注 \\
\hline
张三 & 87 & 100 & 93 & 优秀 \\
\hline
李四 & 75 & 64 & 52 & 补考另行通知 \\
\hline
王二 & 80 & 82 & 78 & \\
\hline
\end{
tabular}
\end{
table}
\end{
document}
取消注释,可以看到浮动体的编号和交叉引用是自动完成的。
这一讲,讲解了浮动体的概念、利用浮动体可以实现灵活分页、给图表添加标题以及实现交叉引用。浮动体可以通过figure环境和table环境实现,并且可以设置浮动体的允许排版位置,允许位置有:
本节代码:
% 导言区
\documentclass{
ctexart} % ctexbook, ctexrep
% \usepackage{
ctex}
\usepackage{
graphicx}
\graphicspath{
{
figures/}} % 图片在当前目录下的figures目录
% 浮动体
% 实现灵活分页(避免无法分割的内容产生的页面留白
% 给图表添加标题
% 交叉引用
% figure环境(table环境与之类似)
% \begin{
figure}[<允许位置>]
% <任意内容>
% \end{
figure}
% 正文区(文档区)
% <允许位置>参数(默认tbp)
% h,此处(here)-代码所在的上下文位置
% t,页顶(top)-代码所在页面或之后页面的顶部
% b,页底(bottom)-代码所在页面或之后页面的底部
% p,独立一页(page)-浮动页面
% 标题控制(caption、bicaption等宏包)
% 并排与子图表(subcaption、subfig、floatrow等宏包)
% 绕排(picinpar、wrapfig等宏包)
\begin{
document}
\LaTeX{
}中\TeX 系统的吉祥物---小狮子见图\ref{
fig-seventh}。
\begin{
figure}[htbp]
\centering
\includegraphics[scale=0.3]{
seventh}
\caption{
\TeX 系统的吉祥物---小狮子}\label{
fig-seventh}
\end{
figure}
遥望太白,看积雪皑皑,别有一番风景(图\ref{
fig-fifth})
\begin{
figure}[htbp] % 允许各个位置
\centering
\includegraphics[scale=0.3]{
fifth}
\caption{
太白山}\label{
fig-fifth}
\end{
figure}
熟练使用\LaTeX 中的TiKz,可以绘制如图\ref{
fig-eighth}所示的精美矢量图。
\begin{
figure}[htbp] % 允许各个位置
\centering
\includegraphics[scale=0.3]{
eighth}
\caption{
\LaTeX 中的绘图}\label{
fig-eighth}
\end{
figure}
当然,在\LaTeX{
}中也可以使用表\ref{
tab-score}所示的表格。
\begin{
table}[h]
\centering
\caption{
考试成绩单}\label{
tab-score}
\begin{
tabular}{
|l|c|c|c|r|}
\hline
姓名 & 语文 & 数学 & 外语 & 备注 \\
\hline
张三 & 87 & 100 & 93 & 优秀 \\
\hline
李四 & 75 & 64 & 52 & 补考另行通知 \\
\hline
王二 & 80 & 82 & 78 & \\
\hline
\end{
tabular}
\end{
table}
\end{
document}
参考文献
[1] https://blog.csdn.net/qq_36059561/article/details/113838429
文章浏览阅读1w次,点赞2次,收藏27次。来源:机器人小妹 很多时候企业拥有重复,乏味且困难的工作流程,这些流程往往会减慢生产速度并增加运营成本。为了降低生产成本,企业别无选择,只能自动化某些功能以降低生产成本。 通过数字化..._人工智能平台
文章浏览阅读2.2k次。热加载能够在每次保存修改的代码后自动刷新 electron 应用界面,而不必每次去手动操作重新运行,这极大的提升了开发效率。安装 electron 热加载插件热加载虽然很方便,但是不是每个 electron 项目必须的,所以想要舒服的开发 electron 就只能给 electron 项目单独的安装热加载插件[electron-reloader]:// 在项目的根目录下安装 electron-reloader,国内建议使用 cnpm 代替 npmnpm install electron-relo._electron-reloader
文章浏览阅读942次。在11.0 进行定制化开发,会根据需要去掉recovery模式的一些选项 就是在device.cpp去掉一些选项就可以了。_android recovery 删除 部分菜单
文章浏览阅读3.7k次。https://www.yuque.com/mnn/cn/cvrt_linux_mac基础依赖这些依赖是无关编译选项的基础编译依赖• cmake(3.10 以上)• protobuf (3.0 以上)• 指protobuf库以及protobuf编译器。版本号使用 protoc --version 打印出来。• 在某些Linux发行版上这两个包是分开发布的,需要手动安装• Ubuntu需要分别安装 libprotobuf-dev 以及 protobuf-compiler 两个包•..._mnn 编译linux
文章浏览阅读1.8k次。CSS3新增动画属性“@-webkit-keyframes”,从字面就可以看出其含义——关键帧,这与Flash中的含义一致。利用CSS3制作动画效果其原理与Flash一样,我们需要定义关键帧处的状态效果,由CSS3来驱动产生动画效果。下面讲解一下如何利用CSS3制作淡入淡出的动画效果。具体实例可参考刚进入本站时的淡入效果。1. 定义动画,名称为fadeIn@-webkit-keyf_css3入场效果淡入淡出
文章浏览阅读2.8k次。计算机系统应包括硬件和软件两个子系统,硬件和软件又必须依次分别包括中央处理器和系统软件。按人的要求接收和存储信息,自动进行数据处理和计算,并输出结果信息的机器系统。计算机是脑力的延伸和扩充,是近代科学的重大成就之一。计算机系统由硬件(子)系统和软件(子)系统组成。前者是借助电、磁、光、机械等原理构成的各种物理部件的有机组合,是系统赖以工作的实体。后者是各种程序和文件,用于指挥全系统按指定的要求进行..._计算机系统包括硬件系统和软件系统 软件又必须包括
文章浏览阅读7.9k次,点赞3次,收藏22次。一 定义这是最早出现的置换算法。该算法总是淘汰最先进入内存的页面,即选择在内存中驻留时间最久的页面予以淘汰。该算法实现简单,只需把一个进程已调入内存的页面,按先后次序链接成一个队列,并设置一个指针,称为替换指针,使它总是指向最老的页面。但该算法与进程实际运行的规律不相适应,因为在进程中,有些页面经常被访问,比如,含有全局变量、常用函数、例程等的页面,FIFO 算法并不能保证这些页面不被淘汰。这里,我_进程调度fifo算法代码
文章浏览阅读133次。rownum是oracle才有的写法,rownum在oracle中可以用于取第一条数据,或者批量写数据时限定批量写的数量等mysql取第一条数据写法SELECT * FROM t order by id LIMIT 1;oracle取第一条数据写法SELECT * FROM t where rownum =1 order by id;ok,上面是mysql和oracle取第一条数据的写法对比,不过..._mysql 替换@rownum的写法
文章浏览阅读790次,点赞3次,收藏4次。官网下载下载链接:http://www.eclipse.org/downloads/点击Download下载完成后双击运行我选择第2个,看自己需要(我选择企业级应用,如果只是单纯学习java选第一个就行)进入下一步后选择jre和安装路径修改jvm/jre的时候也可以选择本地的(点后面的文件夹进去),但是我们没有11版本的,所以还是用他的吧选择接受安装中安装过程中如果有其他界面弹出就点accept就行..._ecjelm
文章浏览阅读245次。原文链接:https://linux.cn/article-7801-1.htmlifconfigping <IP地址>:发送ICMP echo消息到某个主机traceroute <IP地址>:用于跟踪IP包的路由路由:netstat -r: 打印路由表route add :添加静态路由路径routed:控制动态路由的BSD守护程序。运行RIP路由协议gat..._ifconfig 删除vlan
文章浏览阅读224次。reduxredux里要求把数据都放在公共的存储区域叫store里面,组件中尽量少放数据,假如绿色的组件要给很多灰色的组件传值,绿色的组件只需要改变store里面对应的数据就行了,接着灰色的组件会自动感知到store里的数据发生了改变,store只要有变化,灰色的组件就会自动从store里重新取数据,这样绿色组件的数据就很方便的传到其它灰色组件里了。redux就是把公用的数据放在公共的区域去存..._redux redis
文章浏览阅读2.2k次,点赞3次,收藏6次。unzip版本不支持4G以上的压缩包所以要使用p7zip:Linux一个高压缩率软件wget http://sourceforge.net/projects/p7zip/files/p7zip/9.20.1/p7zip_9.20.1_src_all.tar.bz2tar jxvf p7zip_9.20.1_src_all.tar.bz2cd p7zip_9.20.1make && make install 如果安装失败,看一下报错是不是因为没有下载gcc 和 gcc ++(p7_linux 7za解压中文乱码