Hero Circle Shape
Hero Moon Shape
Hero Right Shape
比特派苹果版下载链接|latex教程

比特派苹果版下载链接|latex教程

  • 作者: 比特派苹果版下载链接
  • 2024-03-07 19:35:43

【LaTeX】新手教程:从入门到日常使用 - 知乎

【LaTeX】新手教程:从入门到日常使用 - 知乎切换模式写文章登录/注册【LaTeX】新手教程:从入门到日常使用Dylaaan​数学话题下的优秀答主最近在策划一场LaTeX培训讲座,在此之前根据自己的经验,以及参考网络上的资料,整理出本份教程。本份教程适合完全没有用过LaTeX的读者使用,学习完后应该能满足LaTeX日常使用的要求。如果之前已经使用过LaTeX的话,也可以参考本文学习。如果本份教程有没有讲清楚的地方、可以改进的地方或者错误,欢迎大家在评论区指出。另外,这篇文章也被上传到了我的个人网站:LaTeX:从入门到日常使用。前言:排版工具与书写工具的讨论LaTeX是一种“非所见即所得”的排版系统,用户需要输入特定的代码,保存在后缀为.tex的文件中,通过编译得到所需的pdf文件,例如以下代码:\documentclass{article}

\begin{document}

Hello, world!

\end{document}最后输出的结果是一个pdf文件,内容是”Hello, world!“。如何理解“非所见即所得”呢?在这里举个“所见即所得”的例子:Word。Word的界面就是一张A4纸,输入的时候是什么样子,最后呈现出来就是什么样子。这给了我们极高的自由度,也非常容易上手,但是有如下问题: - 对于对细节不敏感的用户,Word的排版常常会在细节存在问题,比如两段话之间行间距不同、字体不同、标题样式不同等; - 对于撰写论文的用户,Word的标题、章节、图表、参考文献等无法自动标号,也很难在正文中引用; - 对于有公式输入需求的用户,Word自带的公式不稳定,而公式插件效果常常不好。相比之下,使用LaTeX进行排版,就像是在铺好的轨道上驾驶火车一样。使用LaTeX没有办法像Word一样非常自由,但是可以保证规范性,这使得LaTeX非常适合用于论文的排版。在学习的过程中,也将会感受到这一点。无论是LaTeX还是Word,其归根结底都只是排版工具,用Word也可以排出LaTeX的效果,用LaTeX也可以排出Word的效果。另外,笔者最建议的书写工具是Markdown,其书写的过程中可以不在意排版,也支持使用LaTeX语法输入公式,与LaTeX之间的转换非常方便。准备工作:安装LaTeX与配置环境安装Tex Live官方的地址是http://mirror.ctan.org/systems/texlive/Images/texlive2021.iso,但是可能速度较慢,以下是一些国内的镜像地址:清华大学:https://mirrors.tuna.tsinghua.edu.cn/CTAN/systems/texlive/Images/texlive2021.iso;北京交通大学:https://mirror.bjtu.edu.cn/ctan/systems/texlive/Images/texlive2021.iso;上海交通大学:https://mirrors.sjtug.sjtu.edu.cn/ctan/systems/texlive/Images/texlive2021.iso;中国科技大学:https://mirrors.ustc.edu.cn/CTAN/systems/texlive/Images/texlive2021.iso;重庆大学:https://mirrors.cqu.edu.cn/CTAN/systems/texlive/Images/texlive2021.iso;腾讯云:https://mirrors.cloud.tencent.com/CTAN/systems/texlive/Images/texlive2021.iso。其中的iso文件可以使用压缩软件解压,或者加载到光盘,接下来直接安装就行了。对于其他操作系统的用户(如MacOS),可以参考TeX Live 下载及安装说明 | 始终 (liam.page)中的方法。选择TeX编辑器对于新手,最推荐的编辑器是TeXworks,非常适合用来上手,也避免了配置环境带来的问题。如果想要提高效率的话,可以选用:TeXstudio,安装地址为TeXstudio - A LaTeX editor (sourceforge.net);宇宙第一的Visual Studio Code,这是笔者最建议的TeX编辑器,不过需要手动配置LaTeX,较为麻烦;另外,也有在线的编辑器,如Overleaf, 在线LaTeX编辑器。选择pdf阅读器和编辑器LaTeX编译的结果是pdf文件,建议选用专业的pdf阅读器或pdf编辑器。特别是在阅读beamer类型的文件时,不同的阅读器效果差别极大。在这里推荐Acrobat:Adobe Acrobat Reader,免费,可用于查看、签署、协作处理和批注 PDF 文件,安装地址为Adobe Acrobat Reader (中国);Adobe Acrobat Pro,付费,可用于创建、保护、转换和编辑 PDF文件,安装地址为Adobe Acrobat | Adobe Document Cloud。利用LaTeX编写文档文档类型TeX有多种文档类型可选,笔者较常用的有如下几种类型:对于英文,可以用book、article和beamer;对于中文,可以用ctexbook、ctexart和ctexbeamer,这些类型自带了对中文的支持。不同的文件类型,编写的过程中也会有一定的差异,如果直接修改文件类型的话,甚至会报错。以下统一选用ctexart。在编辑框第一行,输入如下内容来设置文件类型:\documentclass{ctexart}另外,一般也可以在\documentclass处设置基本参数,笔者通常设置默认字体大小为12pt,纸张大小为A4,单面打印。需要将第一行的内容替换为:\documentclass[12pt, a4paper, oneside]{ctexart}文件的正文部分需要放入document环境中,在document环境外的部分不会出现在文件中。\documentclass[12pt, a4paper, oneside]{ctexart}

\begin{document}

这里是正文.

\end{document}宏包为了完成一些功能(如定理环境),还需要在导言区,也即document环境之前加载宏包。加载宏包的代码是\usepackage{}。本份教程中,与数学公式与定理环境相关的宏包为amsmath、amsthm、amssymb,用于插入图片的宏包为graphicx,代码如下:\usepackage{amsmath, amsthm, amssymb, graphicx}另外,在加载宏包时还可以设置基本参数,如使用超链接宏包hyperref,可以设置引用的颜色为黑色等,代码如下:\usepackage[bookmarks=true, colorlinks, citecolor=blue, linkcolor=black]{hyperref}标题标题可以用\title{}设置,作者可以用\author设置,日期可以用\date{}设置,这些都需要放在导言区。为了在文档中显示标题信息,需要使用\maketitle。例如:\documentclass[12pt, a4paper, oneside]{ctexart}

\usepackage{amsmath, amsthm, amssymb, graphicx}

\usepackage[bookmarks=true, colorlinks, citecolor=blue, linkcolor=black]{hyperref}

% 导言区

\title{我的第一个\LaTeX 文档}

\author{Dylaaan}

\date{\today}

\begin{document}

\maketitle

这里是正文.

\end{document}正文正文可以直接在document环境中书写,没有必要加入空格来缩进,因为文档默认会进行首行缩进。相邻的两行在编译时仍然会视为同一段。在LaTeX中,另起一段的方式是使用一行相隔,例如:我是第一段.

我是第二段.这样编译出来就是两个段落。在正文部分,多余的空格、回车等等都会被自动忽略,这保证了全文排版不会突然多出一行或者多出一个空格。另外,另起一页的方式是:\newpage笔者在编写文档时,为了保证美观,通常将中文标点符号替换为英文标点符号(需要注意的是英文标点符号后面还有一个空格),这比较适合数学类型的文档。在正文中,还可以设置局部的特殊字体:字体命令直立\textup{}意大利\textit{}倾斜\textsl{}小型大写\textsc{}加宽加粗\textbf{}章节对于ctexart文件类型,章节可以用\section{}和\subsection{}命令来标记,例如:\documentclass[12pt, a4paper, oneside]{ctexart}

\usepackage{amsmath, amsthm, amssymb, graphicx}

\usepackage[bookmarks=true, colorlinks, citecolor=blue, linkcolor=black]{hyperref}

% 导言区

\title{我的第一个\LaTeX 文档}

\author{Dylaaan}

\date{\today}

\begin{document}

\maketitle

\section{一级标题}

\subsection{二级标题}

这里是正文.

\subsection{二级标题}

这里是正文.

\end{document}目录在有了章节的结构之后,使用\tableofcontents命令就可以在指定位置生成目录。通常带有目录的文件需要编译两次,因为需要先在目录中生成.toc文件,再据此生成目录。\documentclass[12pt, a4paper, oneside]{ctexart}

\usepackage{amsmath, amsthm, amssymb, graphicx}

\usepackage[bookmarks=true, colorlinks, citecolor=blue, linkcolor=black]{hyperref}

% 导言区

\title{我的第一个\LaTeX 文档}

\author{Dylaaan}

\date{\today}

\begin{document}

\maketitle

\tableofcontents

\section{一级标题}

\subsection{二级标题}

这里是正文.

\subsection{二级标题}

这里是正文.

\end{document}图片插入图片需要使用graphicx宏包,建议使用如下方式:\begin{figure}[htbp]

\centering

\includegraphics[width=8cm]{图片.jpg}

\caption{图片标题}

\end{figure}其中,[htbp]的作用是自动选择插入图片的最优位置,\centering设置让图片居中,[width=8cm]设置了图片的宽度为8cm,\caption{}用于设置图片的标题。表格LaTeX中表格的插入较为麻烦,可以直接使用Create LaTeX tables online – TablesGenerator.com来生成。建议使用如下方式:\begin{table}[htbp]

\centering

\caption{表格标题}

\begin{tabular}{ccc}

1 & 2 & 3 \\

4 & 5 & 6 \\

7 & 8 & 9

\end{tabular}

\end{table}列表LaTeX中的列表环境包含无序列表itemize、有序列表enumerate和描述description,以enumerate为例,用法如下:\begin{enumerate}

\item 这是第一点;

\item 这是第二点;

\item 这是第三点.

\end{enumerate}另外,也可以自定义\item的样式:\begin{enumerate}

\item[(1)] 这是第一点;

\item[(2)] 这是第二点;

\item[(3)] 这是第三点.

\end{enumerate}定理环境定理环境需要使用amsthm宏包,首先在导言区加入:\newtheorem{theorem}{定理}[section]其中{theorem}是环境的名称,{定理}设置了该环境显示的名称是“定理”,[section]的作用是让theorem环境在每个section中单独编号。在正文中,用如下方式来加入一条定理:\begin{theorem}[定理名称]

这里是定理的内容.

\end{theorem}其中[定理名称]不是必须的。另外,我们还可以建立新的环境,如果要让新的环境和theorem环境一起计数的话,可以用如下方式:\newtheorem{theorem}{定理}[section]

\newtheorem{definition}[theorem]{定义}

\newtheorem{lemma}[theorem]{引理}

\newtheorem{corollary}[theorem]{推论}

\newtheorem{example}[theorem]{例}

\newtheorem{proposition}[theorem]{命题}另外,定理的证明可以直接用proof环境。页面最开始选择文件类型时,我们设置的页面大小是a4paper,除此之外,我们也可以修改页面大小为b5paper等等。一般情况下,LaTeX默认的页边距很大,为了让每一页显示的内容更多一些,我们可以使用geometry宏包,并在导言区加入以下代码:\usepackage{geometry}

\geometry{left=2.54cm, right=2.54cm, top=3.18cm, bottom=3.18cm}另外,为了设置行间距,可以使用如下代码:\linespread{1.5}页码默认的页码编码方式是阿拉伯数字,用户也可以自己设置为小写罗马数字:\pagenumbering{roman}另外,aiph表示小写字母,Aiph表示大写字母,Roman表示大写罗马数字,arabic表示默认的阿拉伯数字。如果要设置页码的话,可以用如下代码来设置页码从0开始:\setcounter{page}{0}数学公式的输入方式行内公式行内公式通常使用$..$来输入,这通常被称为公式环境,例如:若$a>0$, $b>0$, 则$a+b>0$.公式环境通常使用特殊的字体,并且默认为斜体。需要注意的是,只要是公式,就需要放入公式环境中。如果需要在行内公式中展现出行间公式的效果,可以在前面加入\displaystyle,例如设$\displaystyle\lim_{n\to\infty}x_n=x$.行间公式行间公式需要用$$..$$来输入,笔者习惯的输入方式如下:若$a>0$, $b>0$, 则

$$

a+b>0.

$$这种输入方式的一个好处是,这同时也是Markdown的语法。需要注意的是,行间公式也是正文的一部分,需要与正文连贯,并且加入标点符号。关于具体的输入方式,可以参考在线LaTeX公式编辑器-编辑器 (latexlive.com),在这里只列举一些需要注意的。上下标上标可以用^输入,例如a^n,效果为 a^n ;下标可以用_来输入,例如a_1,效果为 a_1 。上下标只会读取第一个字符,如果上下标的内容较多的话,需要改成^{}或_{}。分式分式可以用\dfrac{}{}来输入,例如\dfrac{a}{b},效果为 \dfrac{a}{b} 。为了在行间、分子、分母或者指数上输入较小的分式,可以改用\frac{}{},例如a^\frac{1}{n},效果为 a^\frac{1}{n} 。括号括号可以直接用(..)输入,但是需要注意的是,有时候括号内的内容高度较大,需要改用\left(..\right)。例如\left(1+\dfrac{1}{n}\right)^n,效果是 \left(1+\dfrac{1}{n}\right)^n 。在中间需要隔开时,可以用\left(..\middle|..\right)。另外,输入大括号{}时需要用\{..\},其中\起到了转义作用。加粗对于加粗的公式,建议使用bm宏包,并且用命令\bm{}来加粗,这可以保留公式的斜体。大括号在这里可以使用cases环境,可以用于分段函数或者方程组,例如$$

f(x)=\begin{cases}

x, & x>0, \\

-x, & x\leq 0.

\end{cases}

$$效果为f(x)=\begin{cases} x, & x>0, \\ -x, & x\leq 0. \end{cases} 多行公式多行公式通常使用aligned环境,例如$$

\begin{aligned}

a & =b+c \\

& =d+e

\end{aligned}

$$效果为 \begin{aligned} a & =b+c \\ & =d+e \end{aligned} 矩阵和行列式矩阵可以用bmatrix环境和pmatrix环境,分别为方括号和圆括号,例如$$

\begin{bmatrix}

a & b \\

c & d

\end{bmatrix}

$$效果为 \begin{bmatrix} a & b \\ c & d \end{bmatrix} 。如果要输入行列式的话,可以使用vmatrix环境,用法同上。最后的话这个教程比较简短,涉及到的东西也比较少,耐心学习完后,应该能满足日常使用的需求。LaTeX的使用还需要一定的熟练度,仍有时间的读者还可以考虑:试着用LaTeX抄几页书籍或者写几页文章,增加熟练度;配置Visual Studio Code上的LaTeX,探索效率更高的编辑器;研究如何美化排版,或是使用网络上的精美模板,让排版的效果更好。编辑于 2022-02-25 11:46LaTeXLaTeX 排版与设计数学​赞同 4485​​93 条评论​分享​喜欢​收藏​申请

LaTeX详细教程+技巧总结_csdn latex-CSDN博客

>

LaTeX详细教程+技巧总结_csdn latex-CSDN博客

LaTeX详细教程+技巧总结

置顶

NSJim

已于 2023-08-15 15:51:38 修改

阅读量10w+

收藏

6.3k

点赞数

864

分类专栏:

# LaTeX

文章标签:

LaTeX

Overleaf

技巧总结

详细教程

于 2020-11-29 20:10:11 首次发布

版权声明:本文为博主原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。

本文链接:https://blog.csdn.net/NSJim/article/details/109066847

版权

LaTeX

专栏收录该内容

6 篇文章

154 订阅

订阅专栏

LaTeX技巧总结

前言LaTeX工具介绍Overleaf(推荐)使用流程切换界面语言更改编译器文档定位快捷键

TeXLive和TeXStudio

LaTeX模板LaTeX技巧LaTeX中文支持首行缩进进行缩进不进行缩进

显示下划线

LaTeX基础导言区与正文区文档类型宏包编译器注释单行注释多行注释

英文引号空格换行换段新页转义字符可选参数[htbp]

文章架构纸张布局标题级别标题、作者、时间摘要引用、脚注架构

字体,大小,颜色链接列表图片可选参数[htbp]单张图片多张图片

表格数学公式公式支持注意事项公式编号自动编号手动编号

自定义标题样式算法(伪代码)代码块基础用法高级用法

论文写作模板双栏跨栏图表无自动编号的标题引用公式引用图片引用表格引用页面内参考文献引用bib参考文献引用改变引用颜色

前言

若想学习Markdown,请参见我的另一篇博客:Markdown详细教程+技巧总结 。 若想直接学习LaTeX数学公式,请参见我的另一篇博客:LaTeX数学公式-详细教程 。

本篇文章介绍LaTeX的基本用法,并有自己的经验和总结。另外,可以从LaTeX的官方文档进行学习,官方文档大部分是英文文档,链接:LaTeX在线文档 ,LaTex宏包文档。

本篇文章内容包含LaTeX工具,LaTeX模板,LaTeX技巧,LaTeX基础,文章架构,字体、大小和颜色,链接,列表,图片,表格,数学公式,算法(伪代码),代码块,论文写作,等等。

LaTeX工具

介绍

LaTeX工具分为在线工具和本地工具,本地工具又分为前台和后台。在线工具推荐Overleaf,本地工具推荐前台使用TeXStudio,后台推荐使用TeXLive(后台工具有TeXLive,MikTeX,CTeX等)。

各个后台的比较:TeXLive有跨平台的性质,适用于Linux、Mac以及Windows系统;TeXLive是完全安装,大小大概为5G左右;每年有一次更新。TeXStudio只适用于Windows系统;它只安装基本的东西,其他任何需要的东西可以动态安装;只有发生重大变化时才会更新。CTeX只适用于Windows系统;默认编码不是UTF-8;已经不再维护,不再更新了,容易出Bug。

可以根据需求选择合适的本地后台,若觉得安装配置比较麻烦,则可以使用Overleaf在线工具,有网络即可使用,更重要的是国内也可以使用,并支持中文界面。详细使用方法在下文介绍。

Overleaf(推荐)

网址:Overleaf 。 注册账户并登录后即可使用。

使用流程

点击New Project后还可以使用Templates模板,如下图: 新建项目后,左边为源代码视图,右边为预览视图。可以点击左上角的Menu下载源文件,PDF文件,或设置编译器,如下图: 展开Recompile按钮可以设置自动编译,并忽略语法检查,如下图:

切换界面语言

方法1

点击Overleaf界面左下角的国旗标志可以切换界面语言,切换成中文的操作如下图:

方法2

直接更改网址如下:https://cn.overleaf.com/project 即可切换界面语言为中文。

更改编译器

在项目菜单的设置中可以更改,如下图:

文档定位

在项目中线顶部有2个箭头样式的按钮,可以使tex文档和PDF文档相互定位,如下图: 补充: 左键双击PDF文档的特定位置,tex文档会跳转到对应位置。

快捷键

Overleaf内置了很多快捷键,本人分类为常用快捷键和全部快捷键如下:

常用快捷键 Ctrl+B:粗体 Ctrl+I:斜体 Ctrl+/:注释 Ctrl+Z:撤销 Ctrl+Y:重做 Ctrl+F:查找和替换 Ctrl+Home:到文档顶部 Ctrl+End:到文档底部 Ctrl+S:重新编译 Ctrl+Enter:重新编译

全部快捷键 可以在Overleaf项目中点击菜单中的快捷键选项查看,如下图:

2021年5月

TeXLive和TeXStudio

安装及配置详情可参见其他人的博客:LaTeX新手入门以及TeXlive和TeXstudio的安装使用 。

本人一般使用在线工具Overleaf,因此个人教程暂略,后期若安装本地环境再进行完善。

LaTeX模板

LaTeX有很多模板,可以直接使用,方便用户排版。

Overleaf中一些常用模板,包含Project,Resume,Homework,Letter,Memo,Poster,Book,Journal,Thesis。

用户可以直接在Overleaf中使用,也可以下载到本地进行使用。

LaTeX技巧

LaTeX

LaTeX编辑器中,内置了一个语句,用来展现LaTeX的Logo,代码和效果如下:

代码:

\LaTex

显示:

中文支持

无论是在线工具还是本地工具,LaTeX默认都是不支持中文的,因此需要在源代码和配置上稍作修改才可以让LaTeX支持中文,步骤如下:

编译器配置:XeLaTeX,可在Overleaf的菜单 - 编译器处修改。tex文件编码:utf-8,一般默认为utf-8编码,无需修改。代码开头添加: 方式1(推荐):添加宏包\usepackage[UTF8]{ctex}

方式2:设置文档类型\documentclass[UTF8]{ctexart}

首行缩进

进行缩进

若LaTeX默认没有段首缩进,因此要首行缩进需要进行修改。在导言区加入如下代码(距离单位一般为pt或em,pt是绝对单位;em是相对单位,表示1个中文字符宽度;本人比较喜欢em):

% 使用indentfirst宏包

\usepackage{indentfirst}

% 设置首行缩进距离

\setlength{\parindent}{2em}

不进行缩进

若LaTeX已经是段首缩进的,因此要段首不进行缩进需要进行修改。

方式1(推荐): 单段取消缩进,放在段首即可。

\noindent

方式2: 全局取消缩进,在想缩进的段落再进行缩进。 放在导言区:

\setlength{\parindent}{0pt}

放在想要缩进的段落:

\hspace*{2em}段落\\

显示下划线

方法1 使用转义字符:\_

方法2 使用LaTeX命令:\textunderscore

方法3 导入宏包:\usepackage{underscore}

例子1(方法1和2):

a\_b

a\textunderscore b

显示:

例子2(方法3):

\usepackage{underscore}

a_b

显示:

LaTeX基础

导言区与正文区

在begin{document}和end{document}之间的就是正文区,而在这之前的就是导言区。

文档类型

\documentclass{article}是确定了文档类型为article,一般LaTeX提供三种基本文档,此外两种是report和book。三者分别用来写小篇幅的文章、中篇幅的报告和长篇幅的书籍。

宏包

LaTeX导言区可以导入各种宏包,以使用相应宏包的功能,一条语句中可以导入多个宏包,语法如下:

\usepackage{宏包1, 宏包2}

常用的宏包: ctex:中文支持 amsmath:latex数学公式支持 graphicx:插入图片 algorithm和algorithmic:算法排版 listings:插入代码块 等等

编译器

LaTeX的编译器有pdfLaTeX,LaTeX,XeLaTeX,LuaLaTeX,在设置中可以进行更改。Overleaf默认的编译器为pdfLaTeX,因此要使其支持中文需要改为XeLaTeX。

注释

Overleaf等工具中可以使用快捷键Ctrl+/来批量注释或批量取消注释。

单行注释

% 注释内容

多行注释

方式1(推荐):

\iffalse

注释内容

\fi

方式2: 使用\usepackage{verbatim}宏包

\begin{comment}

注释内容

\end{comment}

英文引号

在LaTeX中输入英文引号时,导出的PDF显示的是顺撇的,如下:

代码:

'English'

''English''

显示: 要想正确输入英文引号,把左侧的引号用 ` 代替即可,如下:

代码:

`English'

``English''

显示:

空格

LaTeX支持

空格方式源代码显示宽度quad空格a \quad b

a

b

a \quad b

ab1个中文字符的宽度qquad空格a \qquad b

a

b

a \qquad b

ab2个中文字符的宽度大空格a\ b

a

 

b

a\ b

a b1/3字符宽度没有空格ab

a

b

ab

ab

LaTeX数学公式支持

除上述空格以外,还支持如下空格:

空格方式源代码显示宽度中等空格$a\;b$

a

  

b

a\;b

ab2/7字符宽度小空格$a\,b$

a

b

a\,b

ab1/6字符宽度紧贴$a\!b$

a

 ⁣

b

a\!b

ab缩进1/6字符宽度

换行

\\:换行,一般在一行的最后写。 \\[offset]:换行,并且与下一行的行间距为原来行间距+offset,offset单位一般是em或pt。

注意: 若要在表格单元格内换行,无法使用\\进行换行,需要在导言区导入\usepackage{makecell}宏包进行换行,详情见表格章节。

换段

源代码空一行即可进行换段(推荐)。 也可以使用代码\par进行换段,一般在一段的最后写。

新页

使用\newpage进行换页,一般在一页的最后写。

转义字符

写法:\+字符

用途:当某些特殊字符与LaTeX语法冲突时,使用转义字符可以使字符强制显示。

示例:\%,可以显示出百分号,而不是注释的含义;\_,显示下划线,而不是下标;\^显示符号本身,而不是上标。

例子:

\%home\_name\%=honor

显示: 补充:若想不使用转义字符显示下划线,有2种方法,详情请见 LaTeX技巧-显示下划线 章节。

可选参数[htbp]

LaTeX插入图片、表格等元素时,第一行后面有一个可选参数[htbp],例如,\begin{figure}[htbp]。

[htbp]是个可选参数项,允许用户指定图片、表格等元素被放置的位置。这一可选参数项可以是下列字母的任意组合。

h(here): 当前位置;将图形放置在 正文文本中给出该图形环境的地方。如果本页所剩的页面不够, 这一参数将不起作用。 t(top): 顶部;将图形放置在页面的顶部。 b(bottom): 底部;将图形放置在页面的底部。 p(page): 浮动页;将图形放置在一只允许有浮动对象的页面上。

注意:在使用这些参数时:

如果在图形环境中没有给出上述任一参数,则缺省为 [tbp]。给出参数的顺序不会影响到最后的结果。因为在考虑这些参数时LaTeX总是尝试以 h-t-b-p 的顺序来确定图形的位置。所以 [hb] 和 [bh] 都以h-b 的顺序来排版。给出的参数越多,LaTeX的排版结果就会越好。[htbp], [tbp], [htp], [tp] 这些组合得到的效果不错,[h]也是常用的选择。

文章架构

纸张布局

% 设置页面的环境,a4纸张大小,左右上下边距信息

\usepackage[a4paper,left=10mm,right=10mm,top=15mm,bottom=15mm]{geometry}

标题级别

例子:

\section{一级标题}

\subsection{二级标题}

\subsubsection{二级标题}

显示:

标题、作者、时间

注意:\maketitle这一行一定要在\begin{document}的后面,否则LaTeX会判定为语法错误。

例子:

\documentclass{article} % article 文档

\usepackage[UTF8]{ctex} % 使用宏包(为了能够显示汉字)

% 设置页面的环境,a4纸张大小,左右上下边距信息

\usepackage[a4paper,left=10mm,right=10mm,top=15mm,bottom=15mm]{geometry}

\title{NSJim的文章} % 文章标题

\author{NSJim} % 作者的名称

\date{\today} % 当天日期

% 正文开始

\begin{document}

\maketitle % 添加这一句才能够显示标题等信息

% 正文结束

\end{document}

显示:

摘要

在\maketitle下添加内容,如下:

\maketitle %添加这一句才能够显示标题等信息

%摘要开始部分

\begin{abstract}

该部分内容是放置摘要信息的。该部分内容是放置摘要信息的。该部分内容是放置摘要信息的。该部分内容是放置摘要信息的。该部分内容是放置摘要信息的。

\end{abstract}

显示:

引用、脚注

引用:写在\begin{quote}和\end{quote}之间。 脚注:在需要添加脚注的文字后添加\footnote{脚注内容}即可。

例子:

西游记\footnote{中国古典四大名著之一}小说开头写道:

\begin{quote}

{\kaishu 东胜神洲有一花果山,山顶一石,受日月精华,生出一石猴。之后因为成功闯入水帘洞,被花果山诸猴拜为“美猴王”。}

\end{quote}

显示

架构

标题设置:一级标题\section{},耳机标题\subsection{},三级标题\subsubsection{}; 段落设置:在一段的最后添加\par代表一段的结束; 目录设置:在\begin{document}内容中添加:\tableofcontents

以下为一个示例:

\documentclass{article} % article 文档

\usepackage[UTF8]{ctex} % 使用宏包(为了能够显示汉字)

% 设置页面的环境,a4纸张大小,左右上下边距信息

\usepackage[a4paper,left=10mm,right=10mm,top=15mm,bottom=15mm]{geometry}

\title{NSJim的文章} % 文章标题

\author{NSJim} % 作者的名称

\date{\today} % 当天日期

% 正文开始

\begin{document}

\maketitle % 添加这一句才能够显示标题等信息

% 生成目录设置

\renewcommand{\contentsname}{目录} %将content转为目录

\tableofcontents

% 摘要开始部分

\begin{abstract}

该部分内容是放置摘要信息的。该部分内容是放置摘要信息的。该部分内容是放置摘要信息的。该部分内容是放置摘要信息的。该部分内容是放置摘要信息的。

\end{abstract}

% 标题开始

\section{一级标题1}

第一段一级标题下的内容,一级标题下的内容,一级标题下的内容,一级标题下的内容,一级标题下的内容,一级标题下的内容,一级标题下的内容,一级标题下的内容。\par

第二段一级标题下的内容,一级标题下的内容,一级标题下的内容,一级标题下的内容,一级标题下的内容,一级标题下的内容,一级标题下的内容,一级标题下的内容。

\subsection{二级标题1.1}

二级标题下的内容。

\subsubsection{三级标题下的内容1.1.1}

三级标题下的内容。

\section{一级标题2}

一级标题2中的内容

% 正文结束

\end{document}

显示:

字体,大小,颜色

字体

使用代码:{\字体 内容}(推荐),有时可使用\字体{内容}(不推荐,容易出问题)。

例子:

{\songti 宋体}

{\heiti 黑体}

{\fangsong 仿宋}

{\kaishu 楷书}

{\bf 粗体}

{\it 斜体}

{\sl 斜体}

\textbf{粗体}

\textit{斜体}

\textsl{斜体}

显示:

大小

例子:

{\tiny Hello} \\

{\scriptsize Hello} \\

{\footnotesize Hello} \\

{\small Hello} \\

{\normalsize Hello} \\

{\large Hello} \\

显示: 颜色

需要导入宏包\usepackage{xcolor}

\documentclass{article}

\usepackage[UTF8]{ctex}

\usepackage{color,xcolor}

\setlength{\parindent}{0pt}

% 预先定义好的颜色: red, green, blue, white, black, yellow, gray, darkgray, lightgray, brown, cyan, lime, magenta, olive, orange, pink, purple, teal, violet.

% 定义颜色的5种方式

\definecolor{light-gray}{gray}{0.95} % 1.灰度

\definecolor{orange}{rgb}{1,0.5,0} % 2.rgb

\definecolor{orange}{RGB}{255,127,0} % 3.RGB

\definecolor{orange}{HTML}{FF7F00} % 4.HTML

\definecolor{orange}{cmyk}{0,0.5,1,0} % 5.cmyk

\begin{document}

% \pagecolor{yellow} %设置背景色为黄色

% 使用颜色的常用方式

\textcolor{green}{绿色} % textcolor+颜色

\color{orange}{橙色} % color+颜色

\textcolor[rgb]{0,1,0}{绿色} % textcolor+rgb

\color[rgb]{1,0,0}{红色} % color+rgb

% 使用底色

\colorbox{red}{\color{black}红底黑字}

\fcolorbox{red}{green}{红框绿底} % 框色+背景色

\end{document}

显示:

链接

导入宏包:\usepackage{url} 插入超链接:\url{www.baidu.com}

列表

未完,待续。

图片

可选参数[htbp]

LaTeX插入图片、表格等元素时,第一行后面有一个可选参数[htbp],例如,\begin{figure}[htbp]。

[htbp]是个可选参数项,允许用户指定图片、表格等元素被放置的位置。这一可选参数项可以是下列字母的任意组合。

h(here): 当前位置;将图形放置在 正文文本中给出该图形环境的地方。如果本页所剩的页面不够, 这一参数将不起作用。 t(top): 顶部;将图形放置在页面的顶部。 b(bottom): 底部;将图形放置在页面的底部。 p(page): 浮动页;将图形放置在允许有浮动对象的页面上。

注意:在使用这些参数时:

如果在图形环境中没有给出上述任一参数,则缺省为 [tbp]。给出参数的顺序不会影响到最后的结果。因为在考虑这些参数时LaTeX总是尝试以 h-t-b-p 的顺序来确定图形的位置。所以 [hb] 和 [bh] 都以h-b 的顺序来排版。给出的参数越多,LaTeX的排版结果就会越好。[htbp], [tbp], [htp], [tp] 这些组合得到的效果不错,[h]也是常用的选择。

单张图片

需要导入宏包:\usepackage{graphicx}

例子:

%开始插入图片

\begin{figure}[htbp] % htbp代表图片插入位置的设置

\centering %图片居中

%添加图片;[]中为可选参数,可以设置图片的宽高;{}中为图片的相对位置

\includegraphics[width=6cm]{image.jpg}

\caption{达尔文游戏} % 图片标题

\label{pic1} % 图片标签

\end{figure}

显示:

多张图片

并排插入两张图片 方式1:图片编号增加1 两张图片公用一个大的图题,图片的编号只增加一个。

\begin{figure}[ht]

\centering

\subfigure[11-1]{ %小图题的名称

\includegraphics[width=4cm]{11-1}}

\hspace{10pt} %2张图片的水平距离

\subfigure[11-2]{

\includegraphics[width=4cm]{11-2}}

\caption{两张图片公用的图题}

\end{figure}

方式2:图片编号增加2 每张图片有自己的图题,这种方法会使LaTeX中图片的编号顺序向后增加。

\begin{figure}[h]

\begin{minipage}[t]{0.45\linewidth}

\centering

\includegraphics[width=5.5cm,height=3.5cm]{10}

\caption{第一张图片的图题.}

\end{minipage}

\begin{minipage}[t]{0.45\linewidth} %图片占用一行宽度的45%

\hspace{10pt}

\includegraphics[width=5.5cm,height=3.5cm]{11}

\caption{第二章图片的图题.}

\end{minipage}

\end{figure}

并排插入多张图片

\begin{figure}

\centering

{

\includegraphics[width=2.5cm]{10-1}}

\hspace{10pt} %每张图片水平距离

{

\includegraphics[width=2.5cm]{10-2}}

\hspace{10pt}

{

\includegraphics[width=2.5cm]{10-3}}

\hspace{10pt}

{

\includegraphics[width=2.5cm]{10-4}}

\hspace{10pt}

\caption{并排插入4张图片}

\end{figure}

竖排插入多张图片

\begin{figure}[h]

\centering

\subfigure[场景1]{

\begin{minipage}[t]{0.45\textwidth}

\centering

\includegraphics[width=0.8\textwidth]{wolf2} \\

\vspace{10pt} %2张图片的垂直距离

\includegraphics[width=0.8\textwidth]{wolf3}

\end{minipage}

\end{figure}

}

表格

技巧:若不想手动输入LaTeX语法生成表格,可以使用在线生成LaTeX表格的网站。可以从Excel里面粘贴或导入,可以实现单元格合并,而且会在合并行或合并列的时候提醒要引入对应的宏包。 网址:https://www.tablesgenerator.com/

当然,也可以使用LaTeX语法生成表格,示例如下:

例子:

\begin{table}[htbp] % htbp代表表格浮动位置

% 表格居中

\centering

% 添加表头

\caption{变量表}

% 创建table环境

\begin{tabular}{|cc|c|} % 3个c代表3列都居中,也可以设置l或r,|代表竖线位置

% 表格的输入

\hline % 一条水平线

x & y & z \\ % \\为换行符

\hline

11 & 22 & 33 \\

\hline

\end{tabular}

\end{table}

显示:

表格单元格内换行 需要使用\usepackage{makecell}宏包。将单元格的内容替换为\makecell{XX\\XXXX},\makecell{}中的\\可以在单元格内换行。

例子:

\begin{table}[htbp] % htbp代表表格浮动位置

\centering

\caption{变量表}

\begin{tabular}{|cc|c|}

\hline

x & y & z \\

\hline

11 & \makecell{Long\\text} & 33 \\

\hline

\end{tabular}

\end{table}

显示:

数学公式

公式支持

LaTeX要输入数学公式需要导入宏包\usepackage{amsmath};若要对公式的字体进行修改,还需要引入宏包\usepackage{amsfonts}。

LaTeX数学公式的各种细节请参见我的另一篇博客:LaTeX数学公式-详细教程 。

官方文档: 传送门:官方文档 网址:https://math.meta.stackexchange.com/questions/5020/mathjax-basic-tutorial-and-quick-reference中文教程: 传送门:中文教程 网址:https://www.jianshu.com/p/25f0139637b7技巧:使用在线LaTeX公式编辑器,来生成LaTeX公式代码,然后复制到Markdown编辑器中,并在两边加上$或$$即可。 在线LaTeX公式编辑器网址:https://private.codecogs.com/latex/eqneditor.php插入公式 左对齐公式(行中公式):$数学公式$ 居中公式(独立公式):$$数学公式$$ 注意:使用$行中公式时,数学公式与$连接处不要有空格,否则公式不会显示;使用$$居中公式时,数学公式与$$连接处可以有空格。即$ 数学公式 $ 不显示公式。注释:%为单行注释,例子详见后文。细节:请参见我的另一篇博客:LaTeX数学公式-详细教程 。

注意事项

使用$,即行中公式时,数学公式与$连接处不要有空格,否则公式不会显示。使用$$,即居中公式时,数学公式与$$连接处可以有空格。即$ 数学公式 $ 不显示公式。使用$$时,上方要空一行。=不要单独打一行,否则可能会出错。+ - * / = ( ) | , . '等符号直接在$或$$之间输入即可识别。

公式编号

自动编号

使用\begin{equation}和\end{equation}进行公式输入,要同时使用,且编号不能够修改。

例子:

\begin{equation}

a^2+b^2=c^2

\end{equation}

显示:

手动编号

在公式末尾使用\tag{编号}来实现公式手动编号,大括号内的内容可以自定义。需要使用\usepackage{amsmath}宏包,不能写在$或$$中,会报错。

例子:

\begin{equation}

a^2+b^2=c^2

\tag{2}

\end{equation}

显示:

自定义标题样式

在导言区使用\newtheorem{example}{Example}[section]可以自定义标题样式,例子如下。

例子:

\newtheorem{example}{Example}[section] % 自定义example样式

\begin{document}

\maketitle

\section{Introduction}

\begin{example}{Test1}

Hello world!

\end{example}

\begin{example}{Test2}

Hello world!

\end{example}

\end{document}

显示:

算法(伪代码)

需要使用\usepackage{algorithm}和\usepackage{algorithmic}宏包,if、for等关键字要按照规范书写,如\IF \ENDIF。

例子:

\documentclass{article}

\usepackage[UTF8]{ctex}

\usepackage{algorithm} % 排版算法

\usepackage{algorithmic} % 排版算法

\title{Algorithm}

\author{NSJim Green}

\date{October 2020}

\begin{document}

\maketitle

\section{Algorithm 1}

\begin{algorithm}

\caption{CheckSum(A,x)} %算法标题

\label{alg2} %标签

\begin{algorithmic} %算法开始

\STATE {\bf Input:} An array A and a value x %也可以用\textbf{Input:}

\STATE {\bf Output:} A bool value show if there is two elements in A whose sum is x

\STATE A $\gets$ SORT(A)

\STATE n $\gets$ length(n)

\FOR{i $\gets$ 0 to n}

\IF{Binary-search(A,x-A[i],1,n)}

\STATE return true

\ENDIF

\ENDFOR

\STATE return false

\end{algorithmic}

\end{algorithm}

\end{document}

显示:

代码块

基础用法

使用\usepackage{listings}宏包,并使用\lstset{}进行基础设置,然后使用\begin{lstlisting}[language=xxx]和\end{lstlisting}插入代码块。

基础设置包括行号,不显示字符串空格,代码块边框,不包含颜色等设置,要设置颜色和字体请见下文的高级用法。

例子:

\documentclass{article}

\usepackage[UTF8]{ctex}

\usepackage{listings}

% 代码块基础设置

\lstset{

numbers=left, % 在左侧显示行号

showstringspaces=false, % 不显示字符串中的空格

frame=single, % 设置代码块边框

}

\title{Code block}

\author{NSJim Green}

\date{October 2020}

\begin{document}

\maketitle

\section{C Language}

\begin{lstlisting}[language=c]

#include

// main function

int main() {

printf("Hello World!");

return 0;

}

\end{lstlisting}

\end{document}

显示:

高级用法

使用\usepackage{listings}和\usepackage{xcolor}宏包,并使用\lstset{}进行高级设置,然后使用\begin{lstlisting}[language=xxx]和\end{lstlisting}插入代码块。

高级设置除基础设置外,还包括关键字格式,字符串格式等设置。

例子:

\documentclass{article}

\usepackage[UTF8]{ctex}

\usepackage{listings}

\usepackage{xcolor}

% 代码块高级设置

\lstset{

% basicstyle=\footnotesize, % 设置整体的字体大小

showstringspaces=false, % 不显示字符串中的空格

frame=single, % 设置代码块边框

numbers=left, % 在左侧显示行号

% numberstyle=\footnotesize\color{gray}, % 设置行号格式

numberstyle=\color{darkgray}, % 设置行号格式

backgroundcolor=\color{white}, % 设置背景颜色

keywordstyle=\color{blue}, % 设置关键字颜色

commentstyle=\it\color[RGB]{0,100,0}, % 设置代码注释的格式

stringstyle=\sl\color{red}, % 设置字符串格式

}

\title{Code block}

\author{NSJim Green}

\date{October 2020}

\begin{document}

\maketitle

\section{C Language}

\begin{lstlisting}[language=c]

#include

// main function

int main() {

printf("Hello World!");

return 0;

}

\end{lstlisting}

\end{document}

显示:

论文写作

模板

论文写作可以使用合适的模板,例如IEEE的模板,只需在文档类型处修改即可,代码如下:

\documentclass[conference]{IEEEtran}

双栏

更改文档的单双栏模式,只需更改文档类型处的选项即可,代码如下: 单栏:

\documentclass[onecolumn]{article}

双栏:

\documentclass[twocolumn]{article}

跨栏图表

在双栏编辑模式下,图片只能在一栏中显示,而且如果图片的宽度超过单栏文本宽度,则只能显示其中一部分,剩下的部分会溢出。

若想在双栏模式下插入跨栏图表可将环境替换为带*的figure或table环境,代码如下:

\begin{figure*}

……

\end{figure*}

\begin{talbe*}

……

\end{table*}

无自动编号的标题

LaTeX中的标题都是自动编号的,若想使用无编号的标题,可使用带*的section代码,如下:

\section*{References}

引用

LaTeX中的公式,图表,参考文献都是自动编号的,添加\label语句后可以进行引用,还可以设置引用格式,使用方法如下:

公式引用

需导入amsmath宏包,代码为\usepackage{amsmath}。

公式

\begin{equation}

z=x+y

\label{eq1}

\end{equation}

引用

Eq. (\ref{eq1})

或导入amsmath宏包,使用如下代码(推荐):

Eq. \eqref{eq1}

图片引用

需导入graphicx宏包,代码为\usepackage{graphicx}。

图片

\begin{figure}[htbp]

\centering

\includegraphics[width=8cm]{image/fig01-network model.png}

\caption{Network model.}

\label{fig1}

\end{figure}

引用

Fig. \ref{fig1}

表格引用

表格

\begin{table}[htbp]

\caption{Parameters for simulation}

\begin{center}

\begin{tabular}{|c|c|c|c|}

\hline

\textbf{Parameters}&\textbf{Values} \\

\hline

Count of Nodes & 2 to 160 \\

Simulation time & 60s \\

Layer used & Logical Link Layer \\

Type of Antenna & Omni Directional \\

Queue type & Drop tail \\

MAC & 802.11 \\

\hline

\end{tabular}

\label{tab1}

\end{center}

\end{table}

引用

Table. \ref{tab1}

页面内参考文献引用

参考文献

\begin{thebibliography}{00}

\bibitem{b1} Ben-Othman J, Yahya B. Energy efficient and QoS based routing protocol for wireless sensor networks. J Parallel Distrib Comput 2010;2010(70):849–57.

\bibitem{b2} Younis M, Youssef M, Arisha K. Energy-aware routing in cluster-based sensor networks. In: Proceedings of the IEEE 20th international symposium on modeling, analysis and simulation of computer and telecommunication systems; 2012. p. 0129. https://doi.org/10.1109/MASCOT.2002.1167069.

\bibitem{b3} Al-Karaki JN, Kamal AE. Routing techniques in wireless sensor networks: a survey. IEEE J Wirel Commun 2004;11(6):6–28. 2004.

\end{thebibliography}

引用

\cite{b1}

\cite{b2}

\cite{b3}

bib参考文献引用

流程

在论文投稿官方网站上获取论文LaTeX模板,其中包含bib文件,可对bib文件重命名。在tex文件中找到bib文件声明位置,进行修改,若没有bib文件声明,则添加声明。在谷歌学术等文献检索网站上检索参考文献,在引用中复制BibTeX格式的代码,粘贴到bib文件的末尾。在tex文件中需要引用参考文献的位置使用\cite{BibTexName}语法进行引用,其中BibTeXName为BibTeX代码中的第一行的名称。

bib声明 在tex文件中,结尾处,\end{document}之前,找到如下代码:

\bibliographystyle{FormatName}

\bibliography{BibName}

可进行修改,其中,FormatName为格式名称,BibName为bib文件名称。

示例:

\bibliographystyle{ACM-Reference-Format}

\bibliography{ref}

BibTeX代码 在谷歌学术等文献检索软件中检索需要的参考文献,以Conditional generative adversarial nets为例,在文献处点击引用,选择BibTeX格式,如下图:

复制BibTeX代码,示例如下。将其粘贴到bib文件的末尾。

@article{mirza2014conditional,

title={Conditional generative adversarial nets},

author={Mirza, Mehdi and Osindero, Simon},

journal={arXiv preprint arXiv:1411.1784},

year={2014}

}

引用 在tex文件中,要引用参考文献时,使用\cite{}语法进行引用,中括号的内容为BibTeX代码的第一行内容。

以上文的BibTeX为例,进行引用:

Conditional GAN (CGAN) \cite{mirza2014conditional}.

显示:

改变引用颜色

改变引用颜色前最好在导言区导入xcolor宏包,代码为\usepackage{xcolor}。 改变引用颜色需要在导言区添加如下代码:

\usepackage[colorlinks,bookmarksopen,bookmarksnumbered,citecolor=green, linkcolor=red, urlcolor=blue]{hyperref}

citecolor为参考文献颜色,linkcolor为图表和公式引用的颜色,urlcolor为超链接颜色。各颜色可根据偏好或要求自行更改。

显示效果如下:

优惠劵

NSJim

关注

关注

864

点赞

6362

收藏

觉得还不错?

一键收藏

打赏

知道了

36

评论

LaTeX详细教程+技巧总结

LaTeX技巧总结,包含LaTeX工具,LaTeX模板,LaTeX技巧,LaTeX基础,文章架构,字体、大小和颜色,链接,列表,图片,表格,数学公式,算法(伪代码),代码块,论文写作,等等。

复制链接

扫一扫

专栏目录

36 条评论

您还未登录,请先

登录

后发表或查看评论

详细的Latex语法总结

08-03

该资源里面涵盖了几乎所有的Latex语法,随用随查,让你的论文写作不再头疼。使用Latex对数学公式进行排版,可以极大地提高论文整体的美观度,让你的论文更加出彩,更加夺人眼球。本资源适用于任何年龄阶段,任何可能需要写文章的工作,如果你正在使用Typora,需要书写公式不妨试试Latex语法,书写起来并不复杂。学习Latex可能只需要一天的时间,但却可以收获到很多。

【latex】参考文献排版前移,在最前面引用\usepackage{url}

目前专注于AIGC大模型、网络安全领域的前沿视角,每周持续更新 。同时,我也在探索并编写适合新手的科研指南,定期分享我的发现和想法。

01-17

2963

文件中第120行对应的条目,并检查是否有任何特殊字符或数学表达式没有被正确地包含在数学模式中。如果是URL中的下划线,通常URL不需要放在数学模式中,因此您应该使用。例如,如果您有一个URL或其他字段中的下划线,并且没有被正确地处理,它将触发这个错误。可能是引用中包含了应该在数学模式中的字符,比如希腊字母或数学运算符,但没有被正确地包围在数学模式中。文件的第120行遇到了需要处于数学模式中的字符或表达式,但没有被正确地包围在数学模式定界符(最后真是url的问题,学习到了申申解决问题的逻辑,感觉好丝滑。

LaTex 入门

cocoonyang的专栏

01-22

32万+

LaTex简介

TeX 是由Donald Knuth创造的基于底层编程语言的电子排版系统[1](TEX是Honeywell公司在1980年为其Text Executive文本处理系统注册的商标,它与 TeX是两回事)。TeX能够对文档的排版进行非常精细的操作,可以生成十分精美的文档。TeX系统生成的是DVI(Device Independent)文件。

LaTex是由Leslie Lampo...

LaTeX详细安装教程|LaTeX 基础知识|LaTeX 常用语法|LaTeX 快速入门

群智能算法开发

05-18

4228

LaTeX 是一种专业的排版系统,主要用于科技文献、学术论文、书籍等的排版。与传统的文字处理软件相比,LaTeX 可以更好地管理大型文字项目,并提供了丰富的数学公式和符号支持。本篇博客将介绍 LaTeX 的基础知识、常用语法以及安装教程。

论文写作利器---LaTeX教程(入门篇)(更新中)

brave_stone的博客

04-01

13万+

一、LaTeX简介

结合维基百科及LaTeX官网可知:

LaTeX(/ˈlɑːtɛx/,常被读作/ˈlɑːtɛk/或/ˈleɪtɛk/) 是一种基于TeX的高品质排版系统,由美国计算机科学家莱斯利·兰伯特在20世纪80年代初期开发,非常适用于生成高印刷质量的科技和数学、物理文档,尤其擅长于复杂表格和数学公式的排版。LaTeX是科学文献交流和出版的事实标准。

简单来说,相比于Word排版时需要设...

Latex入门简明教程

weixin_41628708的博客

07-13

7636

使用对象:Latex入门初学者

博客内容概述:

Latex作为撰写论文的工具,深受广大科研工作者的喜爱,本文为个人的Latex入门总结,特此记录。

Latex:入门教程

热门推荐

皮皮blog

01-16

32万+

http://blog.csdn.net/pipisorry/article/details/54571521总的来说,LaTex是一套排版系统,与word那种所见即所得对排版方式不太,用LaTex排版更像是写程序一样,将想要的排版效果用指令写出来,再通过LaTex编译成文档。简单来说,你只要按照要求撰写tex文件,就能够通过LaTex生成排版好的pdf文件。有些人可能听到写程序就头大了,其实使用...

LaTex零基础入门教程(含附件:安装包+LaTex文本编译软件+SCI期刊LaTex投稿图文流程)

一只小码农

05-26

1万+

LaTex是一种基于ΤΕΧ的排版系统,使用LaTex最大的好处就是“只需要写内容就可以,至于内容排版就不是我们的事”。LaTex的使用可以大大提高我们科研论文写作的工作效率。平时写文章一般使用最多的排版工具是Word,使用Word一般先写好内容,之后参考模板调整格式,相比较我们的LaTex就大大省事的多。

Word工具

LaTex

1、编写内容

1、编写内容

2、参考模板...

LaTex教程学习笔记

孙笑川258的博客

05-28

618

表示换行的命令,并没有产生新的段落,所以没有缩进。罗马字体、无衬线字体、打印机字体;(直立、斜体、伪斜体、小型大写)表示换行的命令,产生新的段落,表示换行的命令,产生新的段落。可以清理编译过程文件;格式的引用,注意需要。

Latex入门教程

weixin_62416090的博客

09-07

1167

Latex(Lay-Tech)是一种高级排版工具,用于创作高质量的文章文档。我们现在常见的科研论文、书籍、文献等大多使用Latex来进行排版。

Latex详细教程

03-01

这个是Latex的教程,讲的比较详细,需要的朋友可以下载看看

latex入门教程.zip

最新发布

01-28

latex入门教程.ziplatex入门教程.ziplatex入门教程.zip

LaTeX新手教程

12-27

包含LaTeX软件的安装和使用,加入目录,换行,数学公式,插入图片,表格,宏包,模板等LateX基础使用教程。

LaTeX下载安装+入门手册

06-06

LaTeX 下载安装 + 入门手册 具有基本的说明手册,Teslive安装包,latex的详细文档介绍!!

Latex Latex教程

05-13

Latex教程

latex使用教程

12-01

很多latex中常用的基础用法都有介绍,使用latex排版的童鞋们可以领走了,当作一本参考书。

LaTeX视频教程 从入门到精通 LaTeX视频 latex软件 latex模板

03-11

LaTeX视频教程 从入门到精通 LaTeX视频 latex软件 latex模板 学完本套教程可以熟练的使用LaTex进入公式排版工作。 课程目录: 【重点课程】01.Latex基础视频教程 9课 【重点课程】02.Latex公式排版系统视频教程 ...

数模国赛LaTeX教程源码

11-10

数模国赛LaTeX教程源码

ipad latex

12-31

iPad上可以使用Mathpix Snip来识别手写公式并生成LaTeX公式。以下是使用Mathpix Snip的步骤:

1. 在iPad上安装Mathpix Snip应用程序。

2. 打开Notes应用程序,在其中撰写手写公式。

3. 在Notes中完成撰写后,使用Mathpix Snip进行截图。

4. Mathpix Snip会自动识别截图中的手写公式,并将其转换为LaTeX公式。

5. 您可以将生成的LaTeX公式复制到笔记或其他应用程序中进行保存和使用。

另外,您还可以结合使用OneNote和Sidecar来在iPad上使用LaTeX。以下是使用OneNote和Sidecar的步骤:

1. 在iPad上安装OneNote应用程序。

2. 在OneNote中创建一个新的笔记本,并在其中撰写手写公式。

3. 将iPad连接到Mac电脑,并启用Sidecar功能。

4. 在Mac电脑上打开LaTeX编辑器,例如TeXstudio或Overleaf。

5. 在Sidecar中将OneNote窗口拖动到Mac电脑的屏幕上。

6. 在OneNote中完成撰写后,您可以直接在Mac电脑上使用LaTeX编辑器将手写公式转换为LaTeX公式。

这些方法可以帮助您在iPad上使用LaTeX来处理手写公式。希望对您有所帮助!

“相关推荐”对你有帮助么?

非常没帮助

没帮助

一般

有帮助

非常有帮助

提交

NSJim

CSDN认证博客专家

CSDN认证企业博客

码龄7年

暂无认证

222

原创

1万+

周排名

2791

总排名

249万+

访问

等级

7713

积分

1422

粉丝

2728

获赞

485

评论

1万+

收藏

私信

关注

热门文章

搜索引擎推荐(可以代替谷歌的搜索引擎)

338446

LaTeX数学公式-详细教程

190149

摩尔斯电码(摩斯电码)

169328

LaTeX详细教程+技巧总结

160846

MMD-MikuMikuDance简易教程(包含软件、资源下载、MME特效中文说明、等等)

83339

分类专栏

Computer

65篇

Hardware

21篇

Phone

20篇

Academic

Paper

5篇

LaTeX

6篇

Project

Git

2篇

Readme

2篇

DesignPattern

1篇

Software

91篇

Office

4篇

Search

2篇

Keyboard Shortcut

2篇

AI

1篇

NLP

1篇

CV

Code

5篇

C/C++

2篇

Java

1篇

Python

16篇

Unity

5篇

Linux

10篇

Database

7篇

Debug

1篇

Skill

50篇

Abstract

1篇

Other

2篇

最新评论

Adobe正版服务弹窗 - 解决方案

Byroning:

设置防火墙禁止Adobe相关服务联网,试试

Adobe Acrobat Reader界面改版 - 解决方案

huanglei478n:

十分感谢,差点难受死;另外我用的macbook,路径是:视图>禁用新的acrobat reader

MMD-MikuMikuDance简易教程(包含软件、资源下载、MME特效中文说明、等等)

Ariana527:

我了个都瞧我发现了啥,出走半生归来仍是mmd,绷不住了。

VS(Visual Studio)更改文件编码

鼠神保佑:

我也不行,我是从这个站复制的代码带中文,过几天一看变菱形了,默认就是UTF-8

Edge在IE模式下加载网页 - Edge设置IE兼容性

巩子天:

IE模式有什么用吗

最新文章

安装OneNote for Win10 | Win10/Win11

GNU nano使用方法

VS Code代码补全失效 - 解决方案

2024年9篇

2023年112篇

2022年41篇

2021年17篇

2020年21篇

2019年27篇

目录

目录

分类专栏

Computer

65篇

Hardware

21篇

Phone

20篇

Academic

Paper

5篇

LaTeX

6篇

Project

Git

2篇

Readme

2篇

DesignPattern

1篇

Software

91篇

Office

4篇

Search

2篇

Keyboard Shortcut

2篇

AI

1篇

NLP

1篇

CV

Code

5篇

C/C++

2篇

Java

1篇

Python

16篇

Unity

5篇

Linux

10篇

Database

7篇

Debug

1篇

Skill

50篇

Abstract

1篇

Other

2篇

目录

评论 36

被折叠的  条评论

为什么被折叠?

到【灌水乐园】发言

查看更多评论

添加红包

祝福语

请填写红包祝福语或标题

红包数量

红包个数最小为10个

红包总金额

红包金额最低5元

余额支付

当前余额3.43元

前往充值 >

需支付:10.00元

取消

确定

下一步

知道了

成就一亿技术人!

领取后你会自动成为博主和红包主的粉丝

规则

hope_wisdom 发出的红包

打赏作者

NSJim

你的鼓励将是我创作的最大动力

¥1

¥2

¥4

¥6

¥10

¥20

扫码支付:¥1

获取中

扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付元

使用余额支付

点击重新获取

扫码支付

钱包余额

0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。 2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值

30分钟上手 LaTeX - 知乎

30分钟上手 LaTeX - 知乎首发于LaTeX 新手教程切换模式写文章登录/注册30分钟上手 LaTeXXovee​电子科技大学 软件工程硕士原 文:Learn LaTeX in 30 minutes 译 者:Xovee 翻译时间:2020年5月5日本指南的主要内容是介绍 \LaTeX 的基本使用。你不需要事先掌握关于 \LaTeX 的任何知识,在你学习完本文后,你将会创建你的第一个 \LaTeX 文档,并且掌握关于 \LaTeX 的一些基础的用法。 PS:如果您还没有注册过 Overleaf,希望您能通过我的分享链接进行注册:https://www.overleaf.com?r=969b656f&rm=d&rs=b。什么是 \LaTeX \LaTeX (发音类似于 LAY-tek 或者 LAH-tek,中文的话类似于雷坦克) 是一个创建专业文档的工具。它基于 WYSIWYM (就是这个奇怪的名字)理念,也就是说,你只需要专注于文档的内容,让计算机来处理文档的格式。与 Microsoft Word 或者 LibreOffice Writer 不同, \LaTeX 用户只需要输入纯文字而不需要关心文档的格式。为什么学习 \LaTeX 因为 \LaTeX 在世界各地出版的各类科学文献、书籍中得到了广泛的使用。它不仅可以创建出有着漂亮排版的文档,还可以让用户非常方便的处理排版中非常复杂的一些问题,例如输入数学公式、创建表格、引用、参考文献,以及全文统一的格式。而且, \LaTeX 有着数不清的开源库,它可以做到的事情可以说是有无限可能。这些开源库允许用户用 \LaTeX 做许多事情,例如添加脚注、绘制纲要、创建表格,等等。人们使用 \LaTeX 的一个重要的原因是,它将文档的内容和格式分开。这意味着当你完成了文档的内容创作之后,你可以轻易地修改文档的排版和格式。类似的,你可以创建一种可以让许多文档都使用的格式。这样,许多学术期刊可以创建适用于它们论文的模版。这些模版已经定义好了排版和格式,你只需要添加论文的内容,即可创建出统一风格的论文文档。事实上,你可以在网上找到数不清的模版,包括简历和幻灯片。编辑你的第一个 \LaTeX 文档第一步:创建一个新的 \LaTeX 项目。你可以在你自己的计算机上创建一个新的 .tex 文件,或者你可以在 Overleaf 上创建一个新的项目。让我们首先试一个简单的例子:\documentclass{article}

\begin{document}

First document. This is a simple example, with no

extra parameters or packages included.

\end{document}你可以看到, \LaTeX 已经帮你处理了一些排版任务:对段落的第一行进行了缩进。让我们看看代码中的每一个部分都起了什么作用。在 Overleaf 中打开一个例子 代码中的第一行声明了文档的类型,也称为 类。类控制着文档的所有样式。不同类型的文档需要定义不同类型的类,例如,简历和学术论文所需要的类是不一样的。在这个例子中,文档的类是article,它在 \LaTeX 中是最简单也是最常用的类。其他文档类型还有book、report等。在定义了文档的类型之后,你开始输入文档的内容,它包含在\begin{document}和\end{document}这两个标签之间。这又被称为文档的 正文。你可以在这里开始输入和修改文档的内容。为了在 PDF 中看到这些输入的效果,你需要编译这个文档。在 Overleaf 中,你只需要点击 Recompile 即可。(你还可以将你的项目设定为在编辑时自动重编译:点击 'Recompile' 按钮旁边的小箭头,然后将 'Auto Compile' 设定为 'On'。)如果你在使用基础的文字编辑器,例如 gedit、emacs、vim、sublime、notepad 等,你需要手动地编译文档。首先在你的计算机的命令行中运行 pdflatex 指令。这里有着更多的信息。如果你使用一个特定的 LaTeX 编辑器,例如 TeXmaker 或者 TeXworks,点击 Recompile 按钮即可。查阅这些程序的文档,如果你对过程还不太清楚的话。现在你已经学习了如何给你的文档添加内容,下一步是给文档添加一个标题,为了做到这一点,我们必须简单地介绍一下 序言(preamble)。文档的序言在上一个例子中,文字是在指令\begin{document}之后输入的。而在这个指令之前 .tex 文件中的所有内容被称为序言(preamble)。在序言中,你可以定义文档的类型,你所使用的语言,你想引入的包,以及许多其他的模块。下面展示了一个普通文档的序言:\documentclass[12pt, letterpaper]{article}

\usepackage[utf8]{inputenc}下面介绍每一行的作用:\documentclass[12pt, letterpaper]{article} 像之前说的那样,这行命令定义了文档的类型。它通常还有一些额外的参数,定义在方括号之中。这些参数必须用逗号来分割。在这个例子中,这些额外的参数设定了文档的字体大小(12pt),和文档的大小(letterpaper)。当然,你可以设定其他类型的字体大小(例如9pt、10pt、11pt),如果没有指定这个参数,那么文档的字体大小将设定为默认的10pt。对于文档的大小来说,常用的选项包括 letterpaper、a4paper、legalpaper 等;页的大小和边距中详细介绍了这些参数。\usepackage[utf8]{inputenc} 这行命令定义了文档的编码形式。你可以简单地忽略它,或者设定为其他的值,当然,utf-8 是比较推荐的选项。除非你真的需要另外一种编码方式,或者你不确定该用哪种编码方式,在序言中添加这一行。添加标题、作者和日期为了在文档中添加标题、作者以及日期,你需要在序言中添加如下三行命令(不要在文档的正文中添加)。这些命令是:\title{First document} 这是标题。\author{Hubert Farnsworth} 这里你定义文档的作者,以及,你可以添加下面一行可选的命令:\thanks{funded by the Overleaf team} 这行命令可以在作者的名字之后添加,也就是在作者指令的花括号之内。它会添加一个上标和一个脚注。当你需要在文档中致谢机构的时候,这个命令很有用。\date{February 2014} 你可以手动地输入日期,或者使用\today指令,它可以将日期自动地设定为你编译文档时的日期。在添加了这些指令之后,你的序言看起来是这个样子:\documentclass[12pt, letterpaper, twoside]{article}

\usepackage[utf8]{inputenc}

\title{First document}

\author{Hubert Farnsworth \thanks{funded by the Overleaf team}}

\date{February 2017}现在你已经定义了文档的标题、作者以及日期,你可以使用\maketitle指令来让这些命令生效。这个命令应该出现文档的正文里。\begin{document}

\maketitle

We have now added a title, author and date to our first \LaTeX{} document!

\end{document}在 Overleaf 中打开这个例子。 输入注释在你写代码的时候,添加一些注释是非常有用的。注释是一种不会出现在文档最终输出之中的文字,它不会对文档造成任何影响。注释对你组织文档、添加笔记、或者调试代码有着很大的帮助。在 \LaTeX 中添加注释非常简单,你只需要在行的最前面添加一个 % 符号:\begin{document}

\maketitle

We have now added a title, author and date to our first \LaTeX{} document!

% This line here is a comment. It will not be printed in the document.

\end{document}在 Overleaf 中打开这个例子。 粗体、斜体、下划线我们现在来学习一些基础的文字格式指令。 粗体:在 \LaTeX 中,粗体文字定义在 \textbf{...} 命令中。 斜体:在 \LaTeX 中,斜体文字定义在 \textit{...} 命令中。 下划线:在 \LaTeX 中,下划线文字定义在 \underline{...} 命令中。下面是一些例子:Some of the \textbf{greatest}

discoveries in \underline{science}

were made by \textbf{\textit{accident}}. 另外一个非常有用的指令是强调\emph{...}。它真正的作用取决于它所在的环境——在正常文字中,强调文字是斜体的,但是如果使用在斜体文字之中,它又会变为正常字体,下面是一个例子:Some of the greatest \emph{discoveries}

in science

were made by accident.

\textit{Some of the greatest \emph{discoveries}

in science

were made by accident.}

\textbf{Some of the greatest \emph{discoveries}

in science

were made by accident.} 需要注意的是,有些包,例如Beamer,会改变\emph指令的行为。在 Overleaf 中打开这个例子。添加图片我们现在来看如何在 \LaTeX 文档中添加图片。在 Overleaf 中,你首先需要上传图片。下面是添加图片的一个例子:\documentclass{article}

\usepackage{graphicx}

\graphicspath{ {images/} }

\begin{document}

The universe is immense and it seems to be homogeneous,

in a large scale, everywhere we look at.

\includegraphics{universe}

There's a picture of a galaxy above

\end{document}在 Overleaf 中打开这个例子。\LaTeX 本身不能管理图片,所以你需要导入一个包。包可以被用来改变 \LaTeX 文档默认的外观,或者添加更多特定的功能。在这个例子中,你需要在文档中添加一个图片,所以你需要用到 graphicx 包。这个包引入了一个新的命令,\includegraphics{...} 和 \graphicspath{...}。为了使用 graphicx 包,在文档的序言中添加如下命令:\usepackage{graphicx}\graphicspath{ {images/} } 命令告诉 \LaTeX 当前目录下存储图片的文件夹的名字。\includegraphics{universe} 命令是实际上用来在文档中添加图片的命令。在这里 universe 是图片的文件名(没有文件名的后缀),所以 universe.PNG 就是 universe。文件名不能包含空格,或者多个点(.....)。注意:文件名的后缀是可以使用的,但是不推荐那么做。当文件名没有后缀时, \LaTeX 会搜索所有支持的文件格式。在上传文件的时候,推荐使用小写的文件名后缀。更多的信息请查看生成高清或低清的图片Captions、标签、引用你还可以给图片添加标题、标签,以及引用。请看下面的例子:\begin{figure}[h]

\centering

\includegraphics[width=0.25\textwidth]{mesh}

\caption{a nice plot}

\label{fig:mesh1}

\end{figure}

As you can see in the figure \ref{fig:mesh1}, the

function grows near 0. Also, in the page \pageref{fig:mesh1}

is the same example.在 Overleaf 中打开这个例子。在这个例子中有三个重要的指令:\caption{a nice plot}:显然,这个命令设定了图片的标题。如果你创建了多个图片,那么这个命令就应该在那里使用。你可以将其放在图片的上面,也可以放在图片的下面。\label{fig:mesh1}:如果你需要在文档中引用你所添加的图片,那么用这个指令给图片设定一个标签。这个标签会给图片们进行数字排列,使用下面的这个命令可以让你引用这些图片。\ref{fig:mesh1}:这个命令会生成图片所代表的数字。当你在 \LaTeX 文档中放置图片时,把命令放在一个 figure 环境中,从而使 \LaTeX 恰当地在文档中设定这个图片出现的位置。注意:如果你在你的本地计算机中使用了 captions 和引用,你需要编译你的文件两次来让引用正确地工作。在 Overleaf 中,你不需要这样做。在 \LaTeX 中创建列表在 \LaTeX 中创建列表是非常简单点。你可以使用不同的列表环境。环境是文档中特殊的章节,它们的表现方式各不相同。它们一般开始于\begin{...},结束于\end{...}。一般来说,列表可以分为两大类:有序列表和无序列表。它们有着不同的环境。无序列表无序列表由itemize环境生成。每一个列表项都开始于一个控制命令\item,例如:\begin{itemize}

\item The individual entries are indicated with a black dot, a so-called bullet.

\item The text in the entries may be of any length.

\end{itemize} 默认情况下,每一个列表项都由一个黑色的点开始,也被称为子弹。列表项中的文字一般没有长度限制。在 Overleaf 中打开这个例子。有序列表有序列表的语法与无序列表相同。我们使用enumerate环境来创建有序列表:\begin{enumerate}

\item This is the first entry in our list

\item The list numbers increase with each entry we add

\end{enumerate} 与无序列表类似,每一个列表项由\item来输入,这些列表项会自动地进行数字排序。这些数字从一开始计数。在 Overleaf 中打开这个例子。在 \LaTeX 中输入数学公式使用 \LaTeX 的一大好处就是它可以方便的输入和展示数学公式。 \LaTeX 支持两种公式输入方法:行内模式和展示模式。行内模式下的数学公式是文本中的一部分。展示模式下的公式则不属于文本的一部分,它们会独立地进行展示。下面是一些行内公式的例子:One of the main advantages of LATEX is the ease at which mathematical expressions can be written. LATEX allows two writing modes for mathematical expressions: the inline mode and the display mode. The first one is used to write formulas that are part of a text. The second one is used to write expressions that are not part of a text or paragraph, and are therefore put on separate lines. Let's see an example of the inline mode:In physics, the mass-energy equivalence is stated

by the equation $E=mc^2$, discovered in 1905 by Albert Einstein. 为了使用行内公式,你可以选用以下三种定义符之一: \(...\) $...$ \begin{math}...\end{math}它们的功能都是一样的,到底使用哪种定义符则取决于使用者的喜好了。展示模式 下的公式则有两种:有公式编号的,以及没有公式编号的。The mass-energy equivalence is described by the famous equation

\[ E=mc^2 \]

discovered in 1905 by Albert Einstein.

In natural units ($c = 1$), the formula expresses the identity

\begin{equation}

E=m

\end{equation} 为了在展示模式中输入公式,你可以使用如下几种定义符: \[...\] \begin{displaymath} ... \end{displaymath} \begin{equation} ... \end{equation}$$ ... $$定义符是不推荐大家使用的,因为它有时候会造成不一致的间距,或者在某些数学包中不能正常工作。重要提示:equation*环境是由一个外部包提供的,请参考amsmath。在 Overleaf 中打开这个例子。许多数学模式命令要求引入amsmath包,所以在书写数学公式的时候,请记住引入这个包。下面的例子展示了一些基础的数学命令用法:Subscripts in math mode are written as $a_b$ and superscripts are written as $a^b$. These can be combined an nested to write expressions such as

\[ T^{i_1 i_2 \dots i_p}_{j_1 j_2 \dots j_q} = T(x^{i_1},\dots,x^{i_p},e_{j_1},\dots,e_{j_q}) \]

We write integrals using $\int$ and fractions using $\frac{a}{b}$. Limits are placed on integrals using superscripts and subscripts:

\[ \int_0^1 \frac{dx}{e^x} = \frac{e-1}{e} \]

Lower case Greek letters are written as $\omega$ $\delta$ etc. while upper case Greek letters are written as $\Omega$ $\Delta$.

Mathematical operators are prefixed with a backslash as $\sin(\beta)$, $\cos(\alpha)$, $\log(x)$ etc.在 Overleaf 中打开这个例子。\LaTeX 中有着数不清的支持输入数学公式的功能和外部包。你可以阅读我们提供的一些其他文章:数学表达上标和下标括号分数和二项表达式对齐公式操作符数学模式中的间隔积分、和,以及极限数学模式中的展示风格希腊字母表和数学符号表数学字体基础排版我们现在来看看如何写摘要,以及如何将一个 \LaTeX 文档分为不同的章节和段落。摘要在学术论文中,使用摘要是常见的做法。在 \LaTeX 中有一个专门的 abstract 环境。这个环境使用一个不同于正文的特殊格式。\begin{document}

\begin{abstract}

This is a simple paragraph at the beginning of the

document. A brief introduction about the main subject.

\end{abstract}

\end{document}在 Overleaf 中打开这个例子。段落\begin{document}

\begin{abstract}

This is a simple paragraph at the beginning of the

document. A brief introduction about the main subject.

\end{abstract}

Now that we have written our abstract, we can begin writing our first paragraph.

This line will start a second Paragraph.

\end{document}在 Overleaf 中打开这个例子。在写文档的时候,如果你需要开始一个新的段落,你必须输入Enter键两次(来插入一个空白行)。需要注意的是, \LaTeX 会自动给段落首行进行缩进。如果你想在直接从下一行中输入内容,而不是创建一个新的段落,那么你可以使用 \\ 命令(两个反斜杠)或者 \newline 命令。使用这两个命令的时候要注意,它们不应当被用来模拟段落之间的大段空白,这样做会扰乱 \LaTeX 的排版算法。推荐的做法是使用双空行来创建新的段落,然后在序言中使用\usepackage{parskip}包。你可以在这篇文章中找到更多的信息。章节组织文档的命令依赖于文档的类型,最简单的组织方法就是使用章节。\chapter{First Chapter}

\section{Introduction}

This is the first section.

Lorem ipsum dolor sit amet, consectetuer adipiscing

elit. Etiam lobortisfacilisis sem. Nullam nec mi et

neque pharetra sollicitudin. Praesent imperdietmi nec ante.

Donec ullamcorper, felis non sodales...

\section{Second Section}

Lorem ipsum dolor sit amet, consectetuer adipiscing elit.

Etiam lobortis facilisissem. Nullam nec mi et neque pharetra

sollicitudin. Praesent imperdiet mi necante...

\subsection{First Subsection}

Praesent imperdietmi nec ante. Donec ullamcorper, felis non sodales...

\section*{Unnumbered Section}

Lorem ipsum dolor sit amet, consectetuer adipiscing elit.

Etiam lobortis facilisissem在 Overleaf 中打开这个例子。\section{}命令标记着一个新节的开始,花括号之中的文字设定了节的标题。节会自动地用数字排序,你也可以在指令中使用*来创建没有数字排序的节。除此之外,还有更多的节的命令:\subsection{}、\subsubseciton{}等等。它们之间的等级如下所示:等级|命令 ---|--- -1| \part{part} 0| \chapter{chapter} 1| \section{section} 2| \subsection{subsection} 3| \subsubsection{subsubsection} 4| \paragraph{paragraph} 5| \subparagraph{subparagraph}需要注意的是:\part和\chapter只在report和book类型的文档中可用。更多的信息请参考这篇文章。创建表格创建一个简单的表格请看下面的例子:\begin{center}

\begin{tabular}{ c c c }

cell1 & cell2 & cell3 \\

cell4 & cell5 & cell6 \\

cell7 & cell8 & cell9

\end{tabular}

\end{center}tabular环境是 \LaTeX 中默认创建表格的环境。你必须给它指定一个参数,在这个例子中是{c c c}。这个参数告诉 \LaTeX 这个表格有着三个列,每个列中的文字都是居中对齐的。你还可以使用r或者l来向右或者向左对齐。对齐符号&用来分割不同的单元格。每一行中&的数目必须比列数少一个。\\命令用来切换到表格的下一行。我们使用center环境来放置表格,使其在页面中居中显示。在 Overleaf 中打开这个例子。添加边框你还可以在tabular环境中给每个列或行添加边框。\begin{center}

\begin{tabular}{ |c|c|c| }

\hline

cell1 & cell2 & cell3 \\

cell4 & cell5 & cell6 \\

cell7 & cell8 & cell9 \\

\hline

\end{tabular}

\end{center}你可以使用水平线指令\hline和垂直线指令|来给表格添加边框。 - { |c|c|c| }:这个命令定义了三个列,它们由垂直线分割开来。 - \hline:这个命令会在表格中插入一个水平线。在上面的例子中,我们给表格的开始和结束添加了水平线。你可以使用任意多的水平线。下面是一个例子:\begin{center}

\begin{tabular}{||c c c c||}

\hline

Col1 & Col2 & Col2 & Col3 \\ [0.5ex]

\hline\hline

1 & 6 & 87837 & 787 \\

\hline

2 & 7 & 78 & 5415 \\

\hline

3 & 545 & 778 & 7507 \\

\hline

4 & 545 & 18744 & 7560 \\

\hline

5 & 88 & 788 & 6344 \\ [1ex]

\hline

\end{tabular}

\end{center} 在 \LaTeX 中创建表格有时候会比较麻烦,你可以使用一个方便的在线工具来创建表格:TablesGenerator.com。其中 File > Paste table data 选项允许你从表格应用中复制和粘贴数据。在 Overleaf 中打开这个例子。表题、标签,以及引用与图片相同,你可以给表格添加标题、标签、引用。唯一不同的地方是图片中你使用figure环境,表格使用table环境。Table \ref{table:data} is an example of referenced \LaTeX{} elements.

\begin{table}[h!]

\centering

\begin{tabular}{||c c c c||}

\hline

Col1 & Col2 & Col2 & Col3 \\ [0.5ex]

\hline\hline

1 & 6 & 87837 & 787 \\

2 & 7 & 78 & 5415 \\

3 & 545 & 778 & 7507 \\

4 & 545 & 18744 & 7560 \\

5 & 88 & 788 & 6344 \\ [1ex]

\hline

\end{tabular}

\caption{Table to test captions and labels}

\label{table:data}

\end{table}在 Overleaf 中打开这个例子。注意:如果你在本地计算机上使用表题和引用,你需要对文档进行两次编译来使其正常工作。在 Overleaf 则不需要这样做。添加目录创建文档的目录是非常直接的,使用\tableofcontents命令就好了。\documentclass{article}

\usepackage[utf8]{inputenc}

\title{Sections and Chapters}

\author{Gubert Farnsworth}

\date{ }

\begin{document}

\maketitle

\tableofcontents

\section{Introduction}

This is the first section.

Lorem ipsum dolor sit amet, consectetuer adipiscing

elit. Etiam lobortisfacilisis sem. Nullam nec mi et

neque pharetra sollicitudin. Praesent imperdietmi nec ante.

Donec ullamcorper, felis non sodales...

\addcontentsline{toc}{section}{Unnumbered Section}

\section*{Unnumbered Section}

Lorem ipsum dolor sit amet, consectetuer adipiscing elit.

Etiam lobortis facilisissem. Nullam nec mi et neque pharetra

sollicitudin. Praesent imperdiet mi necante...

\section{Second Section}

Lorem ipsum dolor sit amet, consectetuer adipiscing elit.

Etiam lobortis facilisissem. Nullam nec mi et neque pharetra

sollicitudin. Praesent imperdiet mi necante...

\end{document} 章节会自动地出现在目录中。如果你想手动地管理目录,例如你想添加一个未编好的章节,使用\addcontentsline命令。在 Overleaf 中打开这个例子。下载文档你可以在左上角的菜单中点击 PDF 来下载文档。或者在 PDF 预览框的上面点击 Download PDF 来快速下载文档。 发布于 2020-05-09 09:11LaTeXTeXLaTeX 排版与设计​赞同 152​​3 条评论​分享​喜欢​收藏​申请转载​文章被以下专栏收录LaTeX 新手教程本专栏介绍有关 LaTeX 的各种

截至目前 LaTeX 入门最好资料 - 知乎

截至目前 LaTeX 入门最好资料 - 知乎首发于LaTeX科技排版切换模式写文章登录/注册截至目前 LaTeX 入门最好资料我是科研小秘书计算机研发LaTeX 是一种“非所见即所得”的排版系统,用户需要先写好代码,保存为 .tex 文件,通过编译得到所需的 pdf 文件,例如以下代码:\documentclass{article}

\begin{document}

‘‘Hello world!’’ from \LaTeX.

\end{document}

代码写好之后就需要进行编译,和我们日常编程一样,编译之后得到排版的结果 PDF。编译过程还有区分,如下图,对于新手来说很迷茫:下面是我们梳理帮助大家入门的好资料,让大家全面入门,这些资料都是免费的。好看的入门书这些书都是经过十几年沉淀下来,非常适合初学者的入门书,选择标准就是整体不要太长,防止大家学习的时候有挫败感,语言比较通俗易懂,内容容易读懂,还有一个就是知识比较新,跟得上 LaTeX 最新发展。lshort-zh-cn 文档,2022年,这个文档译名是:一份(不太)简短的 LaTeX2e 介绍或 112 分钟了解 LaTeX2e,最新版 139 页。本书是绝好的中文入门文档,新版本的制作非常用心,也是诸多大神一起参与制作的,贴合中文习惯。需要说明的是这些章节是循序渐进的,建议刚刚熟悉 LaTeX 的读者按顺序阅读。一定要认真阅读例子的源代码,它们贯穿全篇手册,包含了很多的信息。LaTeX Notes 雷太赫排版系统简介, 包太雷, 2021。 其源代码在这里,这是非常容易读下去的中文文档,语言比较生动活泼,作者把排版印刷相关历史都进行了梳理,非常丰富的整理,这些部分可以略过去,主体内容差不多 150 页左右,推荐大家从这一篇文献开启你的 LaTeX 学习生活。简单粗暴 LaTeX,2019年 LaTeX-cn.pdf,代码 这是真正出版了的书稿,本手册的稿件已经交由中国工信出版集团、人民邮电出版社完成出版,这本电子书只有不到一百页,非常短小精悍。上面的教程都是自带其文档的完整代码的,有兴趣的用户可以看看其源代码,学习可以更上一层楼。纸质书如果你有余力可以购买刘海洋的《LaTeX 入门》纸质版,也可以看看他的视频讲座:https://www.bilibili.com/video/BV1s7411U7Pr中文讲义不少用户喜欢读提纲挈领的讲义,不太习惯看一本电子书,那么下面的几个材料非常适合大家。华东师范大学的讲义可以说是经历了十几年的沉淀了,最新的是 2018 年,绝对是值得读读学习的资料,讲义读起来比较提纲挈领结合电子书,入门肯定可以加速。潘建瑜老师的 LaTeX 课程讲义地址:https://math.ecnu.edu.cn/~jypan/Latex/index.html吕荐瑞老师的 LaTeX 讲稿,2018年,制作也是非常用心的,可以观瞻观瞻。PDF 讲义 learn-latex.pdf清华大学每年都举办的 LaTeX 讲座也非常不错,2022 年,在这里:https://github.com/tuna/thulib-latex-talk 这里有汪彧之的讲解版本:https://www.bilibili.com/video/BV1sf4y1q7HK 可以看看。视频教程如上的这些资料入门足够了,希望大家的入门更简单,更加轻松,我们这里还有大量的视频来指导大家。https://space.bilibili.com/209746320当你看完这些资料,你肯定是达人了,下面划重点了。关注我们公众号,回复:入门合集 获取下载链接,一键获取全部学习资料。发布于 2022-11-21 22:48・IP 属地浙江LaTeXLaTeX 排版与设计LaTeX入门(书籍)​赞同 221​​2 条评论​分享​喜欢​收藏​申请转载​文章被以下专栏收录LaTeX科技排版LaTeX文章发布,推广LaTeX技术技

LaTeX使用指南:从入门到精通 - 少数派

LaTeX使用指南:从入门到精通 - 少数派

PRIMEMatrix栏目Pi Store更多 无需申请,自由写作 任何用户都可使用写作功能。成功发布 3 篇符合基本规则的内容,可成为正式作者。了解更多退出登录反馈PRIMEMatrix栏目Pi Store更多 LaTeX使用指南:从入门到精通主作者关注Spike112少数派作者少数派作者 不定期分享效率工具评测与生产力方法。 Spike112关注Spike112少数派作者少数派作者 不定期分享效率工具评测与生产力方法。 联合作者关注Spike112少数派作者少数派作者 不定期分享效率工具评测与生产力方法。 Spike112关注Spike112少数派作者少数派作者 不定期分享效率工具评测与生产力方法。 2023 年 01 月 07 日 作为编辑和排版神器,使用 LaTeX 成为许多专业人士的必备技能。然而,LaTeX 的使用门槛比较高。为此,下面介绍和分享一些 LaTeX 优质资源,帮助用户快速从入门到精通。LaTeX 学习资源常用 LaTex 代码·百宝箱一站式 LaTex 资源库。包括入门攻略、常用公式和定理、表格代码、算法代码、算法代码、绘图代码、章节命令、字体设置、脚注代码、页眉页脚、目录设计、版面设置、文本排版、代码排版、工具下载和安装。学习和使用 LaTex 所需要的工具、资源、教程均有详细整理。传送门:https://flowus.cn/latex/share/66110e84-b24a-4cd5-b8a7-2ba2afb35a30通用 LaTeX 数学公式语法手册传送门:http://www.uinio.com/Math/LaTex/​LaTeX 入门 - 数学公式传送门:https://www.cnblogs.com/veager/articles/15874130.html​西北农林科技大学公开课:LaTeX学习传送门:https://open.163.com/newview/movie/courseintro?newurl=NHKF1R5RB​如何优雅的编辑数学公式?LaTeX公式入门传送门:https://www.bilibili.com/video/BV14g4y1q7pb/​LaTeX 编辑器推荐​Overleaf特点易于使用,支持模版;支持协作;支持文档历史;离线使用,支持 Dropbox 和 GitHub 同步;传送门:https://cn.overleaf.com/​Tex Maker特点免费的、现代的、跨平台的 LaTeX 编辑器,集成了使用 LaTeX 开发文档所需的许多工具。易于使用和配置,体验优雅;社区活跃,维护稳定。自从 2003 年至今。强大的编辑器:具有 unicode 支持、拼写检查、自动补全完成、代码折叠等功能;集成 PDF 阅读器,具有 synctex 支持和连续查看模式;传送门:https://www.xm1math.net/texmaker/​TeXstudio特点强大的编辑性能。比如,内置丰富的数学符号,支持表格格式,强大的图像处理能力。预览方便。内置结构视图,支持代码折叠、高级语法高亮、拼写检查、错误和警告提示。设置简单。提供多种版本的安装包;自动检测 MikTeX、TeX Live、Ghostscript 和 Standardlatex.浏览方便。内置 PDF 阅读器、支持公式和代码段的实时更新及预览、支持图像等内容的提示预览。高度定制化。内置支持各种 LaTeX 编译器、索引、参考书目和词汇表工具。自动检测运行状态。传送门:https://www.texstudio.org/​Lyx特点使用简单,开箱即用;所见即所得;丰富的公式支持;免费、跨平台;传送门:https://www.lyx.org/​TeXLive特点开源免费;全平台;传送门:https://www.tug.org/texlive/​Miktex特点开源、免费、跨平台;传送门:https://miktex.org/​TeXworks特点开源、免费、跨平台、支持 PDF 阅读、使用方便。传送门 https://tug.org/texworks/ FlowUsFlowUs 并不是专门的 LaTeX 编辑器,而是一款新型在线协作文档——块编辑器+多维表格。FlowUs 支持 LaTeX 数学公式。​工作流:基于 FlowUs 丰富的块编辑器能力,和强大的多维表格组织能力,用户可以先在 FlowUs 中进行信息收集、内容整理和组织、构思创作等知识管理工作流。最后,再在 LaTeX 编辑器中进行排版,生成所需要分享和发布的最终版本。全文思维导图​相关文献工作流的祛魅:从工具、阅读到写作高效输入,从微信剪藏开始:支持微信剪藏和内容自动整理的解决方案RSS 入门指南:如何将「RSS阅读」与笔记软件进行整合?我的信息管理方案如何在 FlowUs、Notion 等笔记软件中实现「标签 Tags」功能?从思考辅助到内容组织:基于思维导图的另类使用如何在支持多维表格的笔记软件中进行文件管理?内容创作者如何高效发布创作内容?FlowUs 息流·深度评测——一款知识管理和在线协作平台组件世界 WidgetStore :一个丰富、强大的嵌入式小组件库作为与自我对话的媒介:盘点支持打开即写、快速输入的效率工具盘点那些具有特色的笔记软件盘点那些具有特色的写作软件盘点那些具有特色的电子白板软件盘点国内外好用的网盘软件/云存储服务Notion 优质资源汇总59 分钟就上手 HeptabaseHeptabase:面向未来的知识操作系统建立你的知识图谱:在可视化卡片笔记氢图中思考和记录86扫码分享 #知识管理

8 等 8 人为本文章充电 扫码分享

举报本文章

举报 Spike112少数派作者

不定期分享效率工具评测与生产力方法。

关注

全部评论(6)

请在登录后评论...

更多

推荐阅读

App 内打开 请绑定手机号码取消 前往绑定 关注公众号 sspaime 下载 App 联系我们 商务合作 关于我们 用户协议 常见问题 © 2013-2024 少数派 | 粤ICP备09128966号-4 | 粤B2-20211534© 2013-2024 少数派粤ICP备09128966号-4 | 粤B2-20211534 确定

Learn LaTeX in 30 minutes - Overleaf, 在线LaTeX编辑器

n LaTeX in 30 minutes - Overleaf, 在线LaTeX编辑器跳到内容功能 & 优势功能商业用途为大学提供为出版社提供为教学提供模板套餐 & 价格帮助为什么 LaTeX?文档联系我们注册登录没有搜索到结果Learn LaTeX in 30 minutesThis introductory tutorial does not assume any prior experience of LaTeX but, hopefully, by the time you are finished, you will not only have written your first LaTeX document but also acquired sufficient knowledge and confidence to take the next steps toward LaTeX proficiency.

Contents

1 What is LaTeX?

2 Why learn LaTeX?

3 Writing your first piece of LaTeX

4 The preamble of a document

5 Including title, author and date information

6 Adding comments

7 Bold, italics and underlining

8 Adding images

9 Captions, labels and references

10 Creating lists in LaTeX

10.1 Unordered lists

10.2 Ordered lists

11 Adding math to LaTeX

11.1 Inline math mode

11.2 Display math mode

11.3 More complete examples

12 Basic document structure

12.1 Abstracts

12.2 Paragraphs and new lines

12.3 Chapters and sections

13 Creating tables

13.1 Creating a basic table in LaTeX

13.2 Adding borders

13.3 Captions, labels and references

14 Adding a Table of Contents

15 Downloading your finished document

16 Finding and using LaTeX packages

16.1 Loading packages

16.2 Finding information about packages: CTAN

16.3 Packages available on Overleaf: Introducing TeX Live

What is LaTeX?

LaTeX (pronounced “LAY-tek” or “LAH-tek”) is a tool for typesetting professional-looking documents. However, LaTeX’s mode of operation is quite different to many other document-production applications you may have used, such as Microsoft Word or LibreOffice Writer: those “WYSIWYG” tools provide users with an interactive page into which they type and edit their text and apply various forms of styling. LaTeX works very differently: instead, your document is a plain text file interspersed with LaTeX commands used to express the desired (typeset) results. To produce a visible, typeset document, your LaTeX file is processed by a piece of software called a TeX engine which uses the commands embedded in your text file to guide and control the typesetting process, converting the LaTeX commands and document text into a professionally typeset PDF file. This means you only need to focus on the content of your document and the computer, via LaTeX commands and the TeX engine, will take care of the visual appearance (formatting).

Why learn LaTeX?

Various arguments can be proposed for, or against, learning to use LaTeX instead of other document-authoring applications; but, ultimately, it is a personal choice based on preferences, affinities, and documentation requirements.

Arguments in favour of LaTeX include:

support for typesetting extremely complex mathematics, tables and technical content for the physical sciences;

facilities for footnotes, cross-referencing and management of bibliographies;

ease of producing complicated, or tedious, document elements such as indexes, glossaries, table of contents, lists of figures;

being highly customizable for bespoke document production due to its intrinsic programmability and extensibility through thousands of free add-on packages.

Overall, LaTeX provides users with a great deal of control over the production of documents which are typeset to extremely high standards. Of course, there are types of documents or publications where LaTeX doesn’t shine, including many “free form” page designs typically found in magazine-type publications.

One important benefit of LaTeX is the separation of document content from document style: once you have written the content of your document, its appearance can be changed with ease. Similarly, you can create a LaTeX file which defines the layout/style of a particular document type and that file can be used as a template to standardise authorship/production of additional documents of that type; for example, this allows scientific publishers to create article templates, in LaTeX, which authors use to write papers for submission to journals. Overleaf has a gallery containing thousands of templates, covering an enormous range of document types—everything from scientific articles, reports and books to CVs and presentations. Because these templates define the layout and style of the document, authors need only to open them in Overleaf—creating a new project—and commence writing to add their content.

Writing your first piece of LaTeX

The first step is to create a new LaTeX project. You can do this on your own computer by creating a new .tex file; alternatively, you can start a new project in Overleaf.

Let’s start with the simplest working example, which can be opened directly in Overleaf:

\documentclass{article}

\begin{document}

First document. This is a simple example, with no

extra parameters or packages included.

\end{document}

 Open this example in Overleaf.

This example produces the following output:

You can see that LaTeX has automatically indented the first line of the paragraph, taking care of that formatting for you. Let’s have a closer look at what each part of our code does.

The first line of code, \documentclass{article}, declares the document type known as its class, which controls the overall appearance of the document. Different types of documents require different classes; i.e., a CV/resume will require a different class than a scientific paper which might use the standard LaTeX article class. Other types of documents you may be working on may require different classes such as book or report. To get some idea of the many LaTeX class types available, visit the relevant page on CTAN (Comprehensive TeX Archive Network).

Having set the document class, our content, known as the body of the document, is written between the \begin{document} and \end{document} tags. After opening the example above, you can make changes to the text and, when finished, view the resulting typeset PDF by recompiling the document. To do this in Overleaf, simply hit Recompile, as demonstrated in this brief video clip:

Any Overleaf project can be configured to recompile automatically each time it is edited: click the small arrow next to the Recompile button and set Auto Compile to On, as shown in the following screengrab:

Having seen how to add content to our document, the next step is to give it a title. To do this, we must talk briefly about the preamble.

The preamble of a document

The screengrab above shows Overleaf storing a LaTeX document as a file called main.tex: the .tex file extension is, by convention, used when naming files containing your document’s LaTeX code.

The previous example showed how document content was entered after the \begin{document} command; however, everything in your .tex file appearing before that point is called the preamble, which acts as the document’s “setup” section. Within the preamble you define the document class (type) together with specifics such as languages to be used when writing the document; loading packages you would like to use (more on this later), and it is where you’d apply other types of configuration.

A minimal document preamble might look like this:

\documentclass[12pt, letterpaper]{article}

\usepackage{graphicx}

where \documentclass[12pt, letterpaper]{article} defines the overall class (type) of document. Additional parameters, which must be separated by commas, are included in square brackets ([...]) and used to configure this instance of the article class; i.e., settings we wish to use for this particular article-class-based document.

In this example, the two parameters do the following:

12pt sets the font size

letterpaper sets the paper size

Of course other font sizes, 9pt, 11pt, 12pt, can be used, but if none is specified, the default size is 10pt. As for the paper size, other possible values are a4paper and legalpaper. For further information see the article about page size and margins.

The preamble line

\usepackage{graphicx}

is an example of loading an external package (here, graphicx) to extend LaTeX’s capabilities, enabling it to import external graphics files. LaTeX packages are discussed in the section Finding and using LaTeX packages.

Including title, author and date information

Adding a title, author and date to our document requires three more lines in the preamble (not the main body of the document). Those lines are:

\title{My first LaTeX document}: the document title

\author{Hubert Farnsworth}: here you write the name of the author(s) and, optionally, the \thanks command within the curly braces:

\thanks{Funded by the Overleaf team.}: can be added after the name of the author, inside the braces of the author command. It will add a superscript and a footnote with the text inside the braces. Useful if you need to thank an institution in your article.

\date{August 2022}: you can enter the date manually or use the command \today to typeset the current date every time the document is compiled

With these lines added, your preamble should look something like this:

\documentclass[12pt, letterpaper]{article}

\title{My first LaTeX document}

\author{Hubert Farnsworth\thanks{Funded by the Overleaf team.}}

\date{August 2022}

To typeset the title, author and date use the \maketitle command within the body of the document:

\begin{document}

\maketitle

We have now added a title, author and date to our first \LaTeX{} document!

\end{document}

The preamble and body can now be combined to produce a complete document which can be opened in Overleaf:

\documentclass[12pt, letterpaper]{article}

\title{My first LaTeX document}

\author{Hubert Farnsworth\thanks{Funded by the Overleaf team.}}

\date{August 2022}

\begin{document}

\maketitle

We have now added a title, author and date to our first \LaTeX{} document!

\end{document}

 Open this example in Overleaf.

This example produces the following output:

Adding comments

LaTeX is a form of “program code”, but one which specializes in document typesetting; consequently, as with code written in any other programming language, it can be very useful to include comments within your document. A LaTeX comment is a section of text that will not be typeset or affect the document in any way—often used to add “to do” notes; include explanatory notes; provide in-line explanations of tricky macros or comment-out lines/sections of LaTeX code when debugging.

To make a comment in LaTeX, simply write a % symbol at the beginning of the line, as shown in the following code which uses the example above:

\documentclass[12pt, letterpaper]{article}

\title{My first LaTeX document}

\author{Hubert Farnsworth\thanks{Funded by the Overleaf team.}}

\date{August 2022}

\begin{document}

\maketitle

We have now added a title, author and date to our first \LaTeX{} document!

% This line here is a comment. It will not be typeset in the document.

\end{document}

 Open this example in Overleaf.

This example produces output that is identical to the previous LaTeX code which did not contain the comment.

Bold, italics and underlining

Next, we will now look at some text formatting commands:

Bold: bold text in LaTeX is typeset using the \textbf{...} command.

Italics: italicised text is produced using the \textit{...} command.

Underline: to underline text use the \underline{...} command.

The next example demonstrates these commands:

Some of the \textbf{greatest}

discoveries in \underline{science}

were made by \textbf{\textit{accident}}.

 Open this example in Overleaf.

This example produces the following output:

Another very useful command is \emph{argument}, whose effect on its argument depends on the context. Inside normal text, the emphasized text is italicized, but this behaviour is reversed if used inside an italicized text—see the next example:

Some of the greatest \emph{discoveries} in science

were made by accident.

\textit{Some of the greatest \emph{discoveries}

in science were made by accident.}

\textbf{Some of the greatest \emph{discoveries}

in science were made by accident.}

 Open this \emph example in Overleaf.

This example produces the following output:

Note: some packages, such as Beamer, change the behaviour of the \emph command.

Adding images

In this section we will look at how to add images to a LaTeX document. Overleaf supports three ways to insert images:

Use the Insert Figure button(), located on the editor toolbar, to insert an image into Visual Editor or Code Editor.

Copy and paste an image into Visual Editor or Code Editor.

Use Code Editor to write LaTeX code that inserts a graphic.

Options 1 and 2 automatically generate the LaTeX code required to insert images, but here we introduce option 3—note that you will need to upload those images to your Overleaf project.

The following example demonstrates how to include a picture:

\documentclass{article}

\usepackage{graphicx} %LaTeX package to import graphics

\graphicspath{{images/}} %configuring the graphicx package

\begin{document}

The universe is immense and it seems to be homogeneous,

on a large scale, everywhere we look.

% The \includegraphcs command is

% provided (implemented) by the

% graphicx package

\includegraphics{universe}

There's a picture of a galaxy above.

\end{document}

 Open this image example in Overleaf.

This example produces the following output:

Importing graphics into a LaTeX document needs an add-on package which provides the commands and features required to include external graphics files. The above example loads the graphicx package which, among many other commands, provides \includegraphics{...} to import graphics and \graphicspath{...} to advise LaTeX where the graphics are located.

To use the graphicx package, include the following line in your Overleaf document preamble:

\usepackage{graphicx}

In our example the command \graphicspath{{images/}} informs LaTeX that images are kept in a folder named images, which is contained in the current directory:

The \includegraphics{universe} command does the actual work of inserting the image in the document. Here, universe is the name of the image file but without its extension.

Note:

Although the full file name, including its extension, is allowed in the \includegraphics command, it’s considered best practice to omit the file extension because it will prompt LaTeX to search for all the supported formats.

Generally, the graphic’s file name should not contain white spaces or multiple dots; it is also recommended to use lowercase letters for the file extension when uploading image files to Overleaf.

More information on LaTeX packages can be found at the end of this tutorial in the section Finding and using LaTeX packages.

Captions, labels and references

Images can be captioned, labelled and referenced by means of the figure environment, as shown below:

\documentclass{article}

\usepackage{graphicx}

\graphicspath{{images/}}

\begin{document}

\begin{figure}[h]

\centering

\includegraphics[width=0.75\textwidth]{mesh}

\caption{A nice plot.}

\label{fig:mesh1}

\end{figure}

As you can see in figure \ref{fig:mesh1}, the function grows near the origin. This example is on page \pageref{fig:mesh1}.

\end{document}

 Open this image example in Overleaf.

This example produces the following output:

There are several noteworthy commands in the example:

\includegraphics[width=0.75\textwidth]{mesh}: This form of \includegraphics instructs LaTeX to set the figure’s width to 75% of the text width—whose value is stored in the \textwidth command.

\caption{A nice plot.}: As its name suggests, this command sets the figure caption which can be placed above or below the figure. If you create a list of figures this caption will be used in that list.

\label{fig:mesh1}: To reference this image within your document you give it a label using the \label command. The label is used to generate a number for the image and, combined with the next command, will allow you to reference it.

\ref{fig:mesh1}: This code will be substituted by the number corresponding to the referenced figure.

Images incorporated in a LaTeX document should be placed inside a figure environment, or similar, so that LaTeX can automatically position the image at a suitable location in your document.

Further guidance is contained in the following Overleaf help articles:

Positioning of Figures

Inserting Images

Creating lists in LaTeX

You can create different types of list using environments, which are used to encapsulate the LaTeX code required to implement a specific typesetting feature. An environment starts with \begin{environment-name} and ends with \end{environment-name} where environment-name might be figure, tabular or one of the list types: itemize for unordered lists or enumerate for ordered lists.

Unordered lists

Unordered lists are produced by the itemize environment. Each list entry must be preceded by the \item command, as shown below:

\documentclass{article}

\begin{document}

\begin{itemize}

\item The individual entries are indicated with a black dot, a so-called bullet.

\item The text in the entries may be of any length.

\end{itemize}

\end{document}

 Open this example in Overleaf.

This example produces the following output:

You can also open this  larger Overleaf project

which demonstrates various types of LaTeX list.

Ordered lists

Ordered lists use the same syntax as unordered lists but are created using the enumerate environment:

\documentclass{article}

\begin{document}

\begin{enumerate}

\item This is the first entry in our list.

\item The list numbers increase with each entry we add.

\end{enumerate}

\end{document}

 Open this example in Overleaf.

This example produces the following output:

As with unordered lists, each entry must be preceded by the \item command which, here, automatically generates the numeric ordered-list label value, starting at 1.

For further information you can open this  larger Overleaf project

which demonstrates various types of LaTeX list or visit our dedicated help article on LaTeX lists, which provides many more examples and shows how to create customized lists.

Adding math to LaTeX

One of the main advantages of LaTeX is the ease with which mathematical expressions can be written. LaTeX provides two writing modes for typesetting mathematics:

inline math mode used for writing formulas that are part of a paragraph

display math mode used to write expressions that are not part of a text or paragraph and are typeset on separate lines

Inline math mode

Let’s see an example of inline math mode:

\documentclass[12pt, letterpaper]{article}

\begin{document}

In physics, the mass-energy equivalence is stated

by the equation $E=mc^2$, discovered in 1905 by Albert Einstein.

\end{document}

 Open this example in Overleaf.

This example produces the following output:

To typeset inline-mode math you can use one of these delimiter pairs: \( ... \), $ ... $ or \begin{math} ... \end{math}, as demonstrated in the following example:

\documentclass[12pt, letterpaper]{article}

\begin{document}

\begin{math}

E=mc^2

\end{math} is typeset in a paragraph using inline math mode---as is $E=mc^2$, and so too is \(E=mc^2\).

\end{document}

 Open this example in Overleaf.

This example produces the following output:

Display math mode

Equations typeset in display mode can be numbered or unnumbered, as in the following example:

\documentclass[12pt, letterpaper]{article}

\begin{document}

The mass-energy equivalence is described by the famous equation

\[ E=mc^2 \] discovered in 1905 by Albert Einstein.

In natural units ($c = 1$), the formula expresses the identity

\begin{equation}

E=m

\end{equation}

\end{document}

 Open this example in Overleaf.

This example produces the following output:

To typeset display-mode math you can use one of these delimiter pairs: \[ ... \], \begin{displaymath} ... \end{displaymath} or \begin{equation} ... \end{equation}. Historically, typesetting display-mode math required use of $$ characters delimiters, as in $$ ... display math here ...$$, but this method is no longer recommended: use LaTeX’s delimiters \[ ... \] instead.

More complete examples

The following examples demonstrate a range of mathematical content typeset using LaTeX.

\documentclass{article}

\begin{document}

Subscripts in math mode are written as $a_b$ and superscripts are written as $a^b$. These can be combined and nested to write expressions such as

\[ T^{i_1 i_2 \dots i_p}_{j_1 j_2 \dots j_q} = T(x^{i_1},\dots,x^{i_p},e_{j_1},\dots,e_{j_q}) \]

We write integrals using $\int$ and fractions using $\frac{a}{b}$. Limits are placed on integrals using superscripts and subscripts:

\[ \int_0^1 \frac{dx}{e^x} = \frac{e-1}{e} \]

Lower case Greek letters are written as $\omega$ $\delta$ etc. while upper case Greek letters are written as $\Omega$ $\Delta$.

Mathematical operators are prefixed with a backslash as $\sin(\beta)$, $\cos(\alpha)$, $\log(x)$ etc.

\end{document}

 Open this example in Overleaf.

This example produces the following output:

The next example uses the equation* environment which is provided by the amsmath package, so we need to add the following line to our document preamble:

\usepackage{amsmath}% For the equation* environment

For further information on using amsmath see our help article.

\documentclass{article}

\usepackage{amsmath}% For the equation* environment

\begin{document}

\section{First example}

The well-known Pythagorean theorem \(x^2 + y^2 = z^2\) was proved to be invalid for other exponents, meaning the next equation has no integer solutions for \(n>2\):

\[ x^n + y^n = z^n \]

\section{Second example}

This is a simple math expression \(\sqrt{x^2+1}\) inside text.

And this is also the same:

\begin{math}

\sqrt{x^2+1}

\end{math}

but by using another command.

This is a simple math expression without numbering

\[\sqrt{x^2+1}\]

separated from text.

This is also the same:

\begin{displaymath}

\sqrt{x^2+1}

\end{displaymath}

\ldots and this:

\begin{equation*}

\sqrt{x^2+1}

\end{equation*}

\end{document}

 Open this example in Overleaf.

This example produces the following output:

The possibilities with math in LaTeX are endless so be sure to visit our help pages for advice and examples on specific topics:

Mathematical expressions

Subscripts and superscripts

Brackets and Parentheses

Fractions and Binomials

Aligning Equations

Operators

Spacing in math mode

Integrals, sums and limits

Display style in math mode

List of Greek letters and math symbols

Mathematical fonts

Basic document structure

Next, we explore abstracts and how to partition a LaTeX document into different chapters, sections and paragraphs.

Abstracts

Scientific articles usually provide an abstract which is a brief overview/summary of their core topics, or arguments. The next example demonstrates typesetting an abstract using LaTeX’s abstract environment:

\documentclass{article}

\begin{document}

\begin{abstract}

This is a simple paragraph at the beginning of the

document. A brief introduction about the main subject.

\end{abstract}

\end{document}

 Open this example in Overleaf.

This example produces the following output:

Paragraphs and new lines

With the abstract in place, we can begin writing our first paragraph. The next example demonstrates:

how a new paragraph is created by pressing the "enter" key twice, ending the current line and inserting a subsequent blank line;

how to start a new line without starting a new paragraph by inserting a manual line break using the \\ command, which is a double backslash; alternatively, use the \newline command.

The third paragraph in this example demonstrates use of the commands \\ and \newline:

\documentclass{article}

\begin{document}

\begin{abstract}

This is a simple paragraph at the beginning of the

document. A brief introduction about the main subject.

\end{abstract}

After our abstract we can begin the first paragraph, then press ``enter'' twice to start the second one.

This line will start a second paragraph.

I will start the third paragraph and then add \\ a manual line break which causes this text to start on a new line but remains part of the same paragraph. Alternatively, I can use the \verb|\newline|\newline command to start a new line, which is also part of the same paragraph.

\end{document}

 Open this example in Overleaf.

This example produces the following output:

Note how LaTeX automatically indents paragraphs—except immediately after document headings such as section and subsection—as we will see.

New users are advised that multiple \\ or \newlines should not used to “simulate” paragraphs with larger spacing between them because this can interfere with LaTeX’s typesetting algorithms. The recommended method is to continue using blank lines for creating new paragraphs, without any \\, and load the parskip package by adding \usepackage{parskip} to the preamble.

Further information on paragraphs can be found in the following articles:

Paragraphs and new lines

How to change paragraph spacing in LaTeX

LaTeX Error: There's no line here to end provides additional advice and guidance on using \\.

Chapters and sections

Longer documents, irrespective of authoring software, are usually partitioned into parts, chapters, sections, subsections and so forth. LaTeX also provides document-structuring commands but the available commands, and their implementations (what they do), can depend on the document class being used. By way of example, documents created using the book class can be split into parts, chapters, sections, subsections and so forth but the letter class does not provide (support) any commands to do that.

This next example demonstrates commands used to structure a document based on the book class:

\documentclass{book}

\begin{document}

\chapter{First Chapter}

\section{Introduction}

This is the first section.

Lorem ipsum dolor sit amet, consectetuer adipiscing

elit. Etiam lobortisfacilisis sem. Nullam nec mi et

neque pharetra sollicitudin. Praesent imperdietmi nec ante.

Donec ullamcorper, felis non sodales...

\section{Second Section}

Lorem ipsum dolor sit amet, consectetuer adipiscing elit.

Etiam lobortis facilisissem. Nullam nec mi et neque pharetra

sollicitudin. Praesent imperdiet mi necante...

\subsection{First Subsection}

Praesent imperdietmi nec ante. Donec ullamcorper, felis non sodales...

\section*{Unnumbered Section}

Lorem ipsum dolor sit amet, consectetuer adipiscing elit.

Etiam lobortis facilisissem...

\end{document}

 Open this example in Overleaf.

This example produces the following output:

The names of sectioning commands are mostly self-explanatory; for example, \chapter{First Chapter} creates a new chapter titled First Chapter, \section{Introduction} produces a section titled Introduction, and so forth. Sections can be further divided into \subsection{...} and even \subsubsection{...}. The numbering of sections, subsections etc. is automatic but can be disabled by using the so-called starred version of the appropriate command which has an asterisk (*) at the end, such as \section*{...} and \subsection*{...}.

Collectively, LaTeX document classes provide the following sectioning commands, with specific classes each supporting a relevant subset:

\part{part}

\chapter{chapter}

\section{section}

\subsection{subsection}

\subsubsection{subsubsection}

\paragraph{paragraph}

\subparagraph{subparagraph}

In particular, the \part and \chapter commands are only available in the report and book document classes.

Visit the Overleaf article article about sections and chapters for further information about document-structure commands.

Creating tables

The following examples show how to create tables in LaTeX, including the addition of lines (rules) and captions.

Creating a basic table in LaTeX

We start with an example showing how to typeset a basic table:

\begin{center}

\begin{tabular}{c c c}

cell1 & cell2 & cell3 \\

cell4 & cell5 & cell6 \\

cell7 & cell8 & cell9

\end{tabular}

\end{center}

 Open this example in Overleaf.

This example produces the following output:

The tabular environment is the default LaTeX method to create tables. You must specify a parameter to this environment, in this case {c c c} which advises LaTeX that there will be three columns and the text inside each one must be centred. You can also use r to right-align the text and l to left-align it. The alignment symbol & is used to demarcate individual table cells within a table row. To end a table row use the new line command \\. Our table is contained within a center environment to make it centred within the text width of the page.

Adding borders

The tabular environment supports horizontal and vertical lines (rules) as part of the table:

to add horizontal rules, above and below rows, use the \hline command

to add vertical rules, between columns, use the vertical line parameter |

In this example the argument is {|c|c|c|} which declares three (centred) columns each separated by a vertical line (rule); in addition, we use \hline to place a horizontal rule above the first row and below the final row:

\begin{center}

\begin{tabular}{|c|c|c|}

\hline

cell1 & cell2 & cell3 \\

cell4 & cell5 & cell6 \\

cell7 & cell8 & cell9 \\

\hline

\end{tabular}

\end{center}

 Open this example in Overleaf.

This example produces the following output:

Here is a further example:

\begin{center}

\begin{tabular}{||c c c c||}

\hline

Col1 & Col2 & Col2 & Col3 \\ [0.5ex]

\hline\hline

1 & 6 & 87837 & 787 \\

\hline

2 & 7 & 78 & 5415 \\

\hline

3 & 545 & 778 & 7507 \\

\hline

4 & 545 & 18744 & 7560 \\

\hline

5 & 88 & 788 & 6344 \\ [1ex]

\hline

\end{tabular}

\end{center}

 Open this example in Overleaf.

This example produces the following output:

Tip!

Creating tables in LaTeX can be time-consuming so you may want to use the TablesGenerator.com online tool to export LaTeX code for tabulars.

Captions, labels and references

You can caption and reference tables in much the same way as images. The only difference is that instead of the figure environment, you use the table environment.

Table \ref{table:data} shows how to add a table caption and reference a table.

\begin{table}[h!]

\centering

\begin{tabular}{||c c c c||}

\hline

Col1 & Col2 & Col2 & Col3 \\ [0.5ex]

\hline\hline

1 & 6 & 87837 & 787 \\

2 & 7 & 78 & 5415 \\

3 & 545 & 778 & 7507 \\

4 & 545 & 18744 & 7560 \\

5 & 88 & 788 & 6344 \\ [1ex]

\hline

\end{tabular}

\caption{Table to test captions and labels.}

\label{table:data}

\end{table}

 Open this example in Overleaf.

This example produces the following output:

Adding a Table of Contents

Creating a table of contents is straightforward because the command \tableofcontents does almost all the work for you:

\documentclass{article}

\title{Sections and Chapters}

\author{Gubert Farnsworth}

\date{August 2022}

\begin{document}

\maketitle

\tableofcontents

\section{Introduction}

This is the first section.

Lorem ipsum dolor sit amet, consectetuer adipiscing

elit. Etiam lobortisfacilisis sem. Nullam nec mi et

neque pharetra sollicitudin. Praesent imperdietmi nec ante.

Donec ullamcorper, felis non sodales...

\section*{Unnumbered Section}

\addcontentsline{toc}{section}{Unnumbered Section}

Lorem ipsum dolor sit amet, consectetuer adipiscing elit.

Etiam lobortis facilisissem. Nullam nec mi et neque pharetra

sollicitudin. Praesent imperdiet mi necante...

\section{Second Section}

Lorem ipsum dolor sit amet, consectetuer adipiscing elit.

Etiam lobortis facilisissem. Nullam nec mi et neque pharetra

sollicitudin. Praesent imperdiet mi necante...

\end{document}

 Open this example in Overleaf.

This example produces the following output:

Sections, subsections and chapters are automatically included in the table of contents. To manually add entries, such as an unnumbered section, use the command \addcontentsline as shown in the example.

Downloading your finished document

The following brief video clip shows how to download your project’s source code or the typeset PDF file:

More information can be found in the Overleaf help article Exporting your work from Overleaf.

Finding and using LaTeX packages

LaTeX not only delivers significant typesetting capabilities but also provides a framework for extensibility through the use of add-on packages. Rather than attempting to provide commands and features that “try to do everything”, LaTeX is designed to be extensible, allowing users to load external bodies of code (packages) that provide more specialist typesetting capabilities or extend LaTeX’s built-in features—such as typesetting tables. As observed in the section Adding images, the graphicx package extends LaTeX by providing commands to import graphics files and was loaded (in the preamble) by writing

\usepackage{graphicx}

Loading packages

As noted above, packages are loaded in the document preamble via the \usepackage command but because (many) LaTeX packages provide a set of options, which can be used to configure their behaviour, the \usepackage command often looks like this:

\usepackage[options]{somepackage}

The square brackets “[...]” inform LaTeX which set of options should be applied when it loads somepackage. Within the set of options requested by the user, individual options, or settings, are typically separated by a comma; for example, the geometry package provides many options to configure page layout in LaTeX, so a typical use of geometry might look like this:

\usepackage[total={6.5in,8.75in},

top=1.2in, left=0.9in, includefoot]{geometry}

The geometry package is one example of a package written and contributed by members of the global LaTeX community and made available, for free, to anyone who wants to use it.

If a LaTeX package does not provide any options, or the user wants to use the default values of a package’s options, it would be loaded like this:

\usepackage{somepackage}

When you write \usepackage[...]{somepackage} LaTeX looks for a corresponding file called somepackage.sty, which it needs to load and process—to make the package commands available and execute any other code provided by that package. If LaTeX cannot find somepackage.sty it will terminate with an error, as demonstrated in the following Overleaf example:

\documentclass[12pt, letterpaper]{article}

\usepackage{somepackage}% a NON-EXISTENT package

\begin{document}

This will fail!

\end{document}

 Open this error-generating example on Overleaf

This example produces the following output:

Finding information about packages: CTAN

Packages are distributed through the Comprehensive TeX Archive Network, usually referred to as CTAN, which, at the time of writing, hosts 6287 packages from 2881 contributors. CTAN describes itself as

... a set of Internet sites around the world that offer TEX-related material for download.

You can browse CTAN to look for useful packages; for example:

by topic

alphabetically (useful if you know the package name)

You can also use the search facility (at the top of the page).

Packages available on Overleaf: Introducing TeX Live

Once per year a (large) subset of packages hosted on CTAN, plus LaTeX-related fonts and other software, is collated and distributed as a system called TeX Live, which can be used to install your own (local) LaTeX setup. In fact, Overleaf’s servers also use TeX Live and are updated when a new version of TeX Live is released. Overleaf’s TeX Live updates are not immediate but take place a few months post-release, giving us time to perform compatibility tests of the new TeX Live version with the thousands of templates contained in our gallery. For example, here is our TeX Live 2022 upgrade announcement.

Although TeX Live contains a (large) subset of CTAN packages it is possible to find an interesting package, such as igo for typesetting Go diagrams, which is hosted on CTAN but not included in (distributed by) TeX Live and thus unavailable on Overleaf. Some packages hosted on CTAN are not part of TeX Live due to a variety of reasons: perhaps a package is obsolete, has licensing problems, is extremely new (recently uploaded) or has platform dependencies, such as working on Windows but not Linux.

New packages, and updates to existing ones, are uploaded to CTAN all year round but updates to TeX Live are distributed annually; consequently, packages contained in the current version of TeX Live will not be as up-to-date as those hosted on CTAN. Because Overleaf’s servers use TeX Live it is possible that packages installed on our servers—i.e., ones available to our users—might not be the very latest versions available on CTAN but, generally, this is unlikely to be problematic.

Documentation Home

Learn LaTeX in 30 minutes

Overleaf guides

Creating a document in Overleaf

Uploading a project

Copying a project

Creating a project from a template

Using the Overleaf project menu

Including images in Overleaf

Exporting your work from Overleaf

Working offline in Overleaf

Using Track Changes in Overleaf

Using bibliographies in Overleaf

Sharing your work with others

Using the History feature

Debugging Compilation timeout errors

How-to guides

Guide to Overleaf’s premium features

LaTeX Basics

Creating your first LaTeX document

Choosing a LaTeX Compiler

Paragraphs and new lines

Bold, italics and underlining

Lists

Errors

Mathematics

Mathematical expressions

Subscripts and superscripts

Brackets and Parentheses

Matrices

Fractions and Binomials

Aligning equations

Operators

Spacing in math mode

Integrals, sums and limits

Display style in math mode

List of Greek letters and math symbols

Mathematical fonts

Using the Symbol Palette in Overleaf

Figures and tables

Inserting Images

Tables

Positioning Images and Tables

Lists of Tables and Figures

Drawing Diagrams Directly in LaTeX

TikZ package

References and Citations

Bibliography management with bibtex

Bibliography management with natbib

Bibliography management with biblatex

Bibtex bibliography styles

Natbib bibliography styles

Natbib citation styles

Biblatex bibliography styles

Biblatex citation styles

Languages

Multilingual typesetting on Overleaf using polyglossia and fontspec

Multilingual typesetting on Overleaf using babel and fontspec

International language support

Quotations and quotation marks

Arabic

Chinese

French

German

Greek

Italian

Japanese

Korean

Portuguese

Russian

Spanish

Document structure

Sections and chapters

Table of contents

Cross referencing sections, equations and floats

Indices

Glossaries

Nomenclatures

Management in a large project

Multi-file LaTeX projects

Hyperlinks

Formatting

Lengths in LaTeX

Headers and footers

Page numbering

Paragraph formatting

Line breaks and blank spaces

Text alignment

Page size and margins

Single sided and double sided documents

Multiple columns

Counters

Code listing

Code Highlighting with minted

Using colours in LaTeX

Footnotes

Margin notes

Fonts

Font sizes, families, and styles

Font typefaces

Supporting modern fonts with XƎLaTeX

Presentations

Beamer

Powerdot

Posters

Commands

Commands

Environments

Field specific

Theorems and proofs

Chemistry formulae

Feynman diagrams

Molecular orbital diagrams

Chess notation

Knitting patterns

CircuiTikz package

Pgfplots package

Typesetting exams in LaTeX

Knitr

Attribute Value Matrices

Class files

Understanding packages and class files

List of packages and class files

Writing your own package

Writing your own class

Advanced TeX/LaTeX

In-depth technical articles on TeX/LaTeX

关于关于我们我们的价值观工作与职业新闻 & 奖项博客学习30分钟学会 LaTeX模板在线教程教程如何插入图片如何创建表格套餐 & 价格高级功能为个人 & 团队提供为企业提供为大学提供为学生提供加入我们成为Overleaf顾问让我们知道您的想法帮助为什么 LaTeX?文档 联系我们 网站状态 © 2024 Overleaf隐私和条款合规性

简体中文语言EnglishČeštinaEspañolPortuguêsFrançaisDeutschSvenskaTürkçeItaliano简体中文NorskРусскийDansk한국어日本語Overleaf 在 TwitterOverleaf 在 FacebookOverleaf 在 LinkedInWe only use cookies for essential purposes and to improve your experience on our site. You can find out more in our cookie policy.Essential cookies onlyAccept all cookies×联系我们主题您检查过我们的 知识库 了吗?电子邮件受影响的项目URL (选填)信息联系我们发送中…请求已发送,我们的团队将审核并通过电子邮件

如何从零开始,入门 LaTeX? - 知乎

如何从零开始,入门 LaTeX? - 知乎首页知乎知学堂发现等你来答​切换模式登录/注册LaTeXTeXXeTeXCTeXTeX Live如何从零开始,入门 LaTeX?一开始知道latex是从一个大佬学长那儿听到的,但是后来发现有好多以tex结尾的排版软件或者系统,例如:latex、tex、ctex、xetex、sh…显示全部 ​关注者1,926被浏览3,062,303关注问题​写回答​邀请回答​好问题 106​4 条评论​分享​87 个回答默认排序知乎用户​1. 卸载 CTeX 套装,安装 TeX Live。原因及教程见:TeX Live 下载及安装说明2. 看完:一份其实很短的 LaTeX 入门文档,你迷惑的「CTeX 和 LaTeX 都是啥」在倒数第二节有答案。3. 看完:LaTeX_Docs_2014.zip 或者 刘海洋的《LaTeX 入门》。编辑于 2020-02-19 12:13​赞同 2347​​90 条评论​分享​收藏​喜欢收起​磁悬浮青蛙呱呱呱学习和创造​ 关注有些号称速查的手册有几十页,甚至100多页,我觉得不能称为”速“。于是我就写了份6页的,覆盖面足够广,也能为你使用搜索引擎提供一个大致的方向。该手册的Latex源码也附在了后面,发现有错误,或者有什么特别重要的技巧想补充,欢迎向我反馈。我也会不定期地对本手册进行更新。PDF文件和Tex文件下载地址:链接: https://pan.baidu.com/s/1OxcNN08xP-7NsRLRkeBq6A?pwd=xc3c 提取码: xc3c \documentclass{article}

\usepackage{geometry}

\geometry{a4paper,left=1cm,right=1cm,top=1.5cm,bottom=1.2cm}

\usepackage{ctex}

\usepackage{amsmath}

\usepackage{yhmath}

\usepackage{amssymb}

\usepackage{extarrows}

\usepackage{enumerate}

\usepackage{makecell} % 表格内换行

\usepackage{paralist}

\usepackage{fancyhdr}

\usepackage{datetime}

\usepackage{graphicx}

\usepackage{wrapfig}

\usepackage{fontspec}

\usepackage{bm} % 同时黑体斜体

\usepackage{listings} % 插入代码

\usepackage[all]{xy}

\usepackage{esint}

\usepackage{bigints}

\usepackage{mathrsfs}

\usepackage{tcolorbox}

\usepackage{ulem}

\usepackage{tikz}

\usepackage{fontawesome5}

\usepackage{multitoc} %双栏

\usepackage[hang,flushmargin,perpage]{footmisc}

%\setcounter{tocdepth}{1} % 设置目录深度

\columnseprule 1pt

%\columnsep 12pt

\special{dvipdfmx:config z 0}

\setCJKmainfont[BoldFont=SourceHanSansCN-Bold]{SourceHanSerifCN-Regular}

\setCJKmainfont[BoldFont=OPPOSans-B]{SourceHanSerifCN-Regular}

\newCJKfontfamily\KaiTifont{gkai00mp.ttf}

\newcommand{\q}{\quad}

\newcommand*{\mycircled}[1]{\lower.7ex\hbox{\tikz\draw (0pt, 0pt)%

circle (.4em) node {\makebox[0.5em][c]{\small #1}};}}

\renewcommand{\today}{\number\year-\number\month-\number\day}

\newcommand\parallelogram

{\mathord{\text{

\tikz[baseline]

\draw (0em, .1ex) -- ++(0.8em, 0ex)

-- ++(0.2em, 1.2ex) -- ++(-0.8em, 0ex)

-- cycle;} } }

\newcommand{\myfootnote}[1]{

\renewcommand{\thefootnote}{}

\footnotetext{\scriptsize#1}

\renewcommand{\thefootnote}{\arabic{footnote}}

% \renewcommand{\thefootnote}{\ding{\numexpr171+\value{footnote}}}

}

\usepackage{draftwatermark, everypage}

\SetWatermarkText{磁悬浮青蛙,水印}

\SetWatermarkLightness{0}

\SetWatermarkAngle{80}

\SetWatermarkColor{gray}

\SetWatermarkScale{0.06}%设置水印的显示大小

\lstset

{

language=[LaTeX]TeX,

backgroundcolor = \color{gray!20},

% breaklines=true,

% basicstyle=\tt\small,

basicstyle=\tt\normalsize,

% keywordstyle=\color{blue},

% identifierstyle=\color{magenta},

aboveskip=0pt,

belowskip=0pt,

}

\pagestyle{fancy}

\rhead{右页眉}

\lhead{左页眉}

\chead{中页眉}

\rfoot{右页脚}

\lfoot{左页脚,修订日期\today}

\cfoot{中页脚,第\thepage 页}

\allowdisplaybreaks

\begin{document}

\begin{center}

{\Large \textbf{\LaTeX 简明速查手册} }

\end{center}

%\tableofcontents

\begin{multicols}{2}

\begin{enumerate}

\item \LaTeX 中的\verb|\usepackage{amsmath}|类似于C语言的\\ \verb|#include|

和Python的\verb|import numpy|,\\ 常用\verb|usepackage|如下:

\begin{lstlisting}

amsmath,amssymb,bm,ctex,datetime,

diagbox,enumerate,esint,extarrows,

fancyhdr,fontspec,geometry,graphicx,

listings,longtable,makecell,multicol,

tabularx,tcolorbox,tikz,xcolor

\end{lstlisting}

其中\verb|ctex|包用于提供中文显示。

\item \textbf{上标}\q \verb|^|\quad \textbf{下标}\q \verb|_| \\

$ A_b^c $\q \verb|A_b^c| \q\q\q\q

$ A_{bc}^{def} $\q \verb|A_{bc}^{def}| \\

如果上下标的字母不止一个,则需要加大括号。\\

组合数$ \binom{n}{2} $:\verb|\binom{n}{2}|或\verb|{n\choose 2}|

\item \textbf{分数与根号}:\\

高度自适应的分数(在行内较矮,行间较高):\verb|\frac{}{}|\\

强制较高的分数$ \dfrac{\pi^2}{6} $:\verb|\dfrac{\pi^2}{6}| \\

强制较矮的分数$ \tfrac{\pi^2}{6} $:\verb|\tfrac{\pi^2}{6}| \\

$ \sqrt{5} $\q \verb|\sqrt{5}| \q\q\q\q

$ \sqrt[3]{5} $\q \verb|\sqrt[3]{5}|

\item \textbf{运算符}

\vspace{-5mm}

\begin{multicols}{2}

$ + $\q \verb|+| \\

$ \oplus $\q \verb|\oplus|\\

$ \times $\q \verb|\times| \\

$ \otimes $\q \verb|\otimes| \\

$ \div $\q \verb|\div| \\

$ \neq $\q \verb|\neq| \\

$ \leq $\q \verb|\leq| \\

$ \leqslant $\q \verb|\leqslant| {\footnotesize 需\verb|{amssymb}|} \\

$ \geq $\q \verb|\geq| \\

$ \geqslant $\q \verb|\geqslant| {\footnotesize 需\verb|{amssymb}|} \\

$ \equiv $\q \verb|\equiv| \\

$ \sim $\q \verb|\sim| \\

$ \approx $\q \verb|\approx| \\

$ \cong $\q \verb|\cong| \\

$ \pm $\q \verb|\pm| \\

$ \mp $\q \verb|\mp| \\

$ \in $\q \verb|\in| \\

$ \cap $\q \verb|\cap,\bigcap| \\

$ \cup $\q \verb|\cup,\bigcup| \\

$ \wedge $\q \verb|\wedge,\bigwedge| \\

$ \vee $\q \verb|\vee,\bigvee| \\

$ \subset $\q \verb|\subset| \\

$ \supset $\q \verb|\supset| \\

$ \subseteq $\q \verb|\subseteq| \\

$ \supseteq $\q \verb|\supseteq| \\

$ \int $\q \verb|\int| \\

$ \iint $\q \verb|\iint| \\

$ \iiint $\q \verb|\iiint| \\

$ \iiiint $\q \verb|\iiiint| \\

$ \oint $\q \verb|\oint|

\end{multicols}

\vspace{-5mm}

$ \varoiint $\q \verb|\varoiint| 需\verb|{esint}| \\

$ \ointctrclockwise $\q \verb|\ointctrclockwise| 需\verb|{esint}| \\

$ \varointclockwise $\q \verb|\varointclockwise| 需\verb|{esint}| \\

(“需\verb|{esint}|”是指需要\verb|\usepackage{esint}|) \\

修改不等号的样式:

\begin{lstlisting}

\renewcommand\leq\leqslant

\renewcommand\geq\geqslant

\end{lstlisting}

特殊符号(转义)显示:

\vspace{-5mm}

\begin{multicols}{2}

$ \$ $\q \verb|\$| \\

$ \# $\q \verb|\#| \\

$ \% $\q \verb|\%| \\

$ \{ $\q \verb|\{| \\

$ \} $\q \verb|\}| \\

$ \& $\q \verb|\&| \\

$ \^{} $\q \verb|\^{}| \\

$ \_{} $\q \verb|\_{}| \\

$ \~{} $\q \verb|\~{}|或\verb|\sim|

\end{multicols}

\vspace{-5mm}

\textbackslash \q \verb|$\backslash$| 或 \verb|\textbackslash| \\

还有一个统一的方法,就是将特殊符号置于\verb|\verb|| |的两条竖线之内。

\item \textbf{其它符号与形状}:

\vspace{-5mm}

\begin{multicols}{2}

$ \cdot $\q \verb|\cdot| \\

$ \cdots $\q \verb|\cdots| \\

$ \vdots $\q \verb|\vdots| \\

$ \ddots $\q \verb|\ddots| \\

$ \odot $\q \verb|\odot| \\

$ \hbar $\q \verb|\hbar| \\

$ \infty $\q \verb|\infty| \\

$ \partial $\q \verb|\partial| \\

$ \varnothing $\q \verb|\varnothing| \\

$ \Delta $\q \verb|\Delta| \\

$ \square $\q \verb|\square|,\verb|\Box| \\

$ \circ $\q \verb|\circ| \\

$ \angle $\q \verb|\angle| \\

$ \parallelogram $\q \verb|\parallelogram|

\end{multicols}

\vspace{-5mm}

(要先输入下方代码,\verb|\parallelogram|命令才能生效)。

\begin{lstlisting}

\usepackage{tikz}

\newcommand\parallelogram

{\mathord{\text{

\tikz[baseline]

\draw (0em, .1ex) -- ++(0.8em, 0ex)

-- ++(0.2em, 1.2ex) -- ++(-0.8em, 0ex)

-- cycle;} } }

\end{lstlisting}

\item \textbf{极限}、\textbf{连加}、\textbf{连乘}、\textbf{积分}:\\

$ \lim_{n\to\infty} $\q \verb|\lim_{n\to\infty}| \\

$ \varlimsup_{n\to\infty} $\q \verb|\varlimsup_{n\to\infty}| \\

$ \varliminf_{n\to\infty} $\q \verb|\varliminf_{n\to\infty}| \\

$ \sum_{n=1}^{\infty} $\q\q \verb|\sum_{n=1}^{\infty}| \\

$ \prod_{n=1}^{\infty} $\q\q \verb|\prod_{n=1}^{\infty}| \\

$ \int_{0}^{+\infty} $\q\q\q \verb|\int_{0}^{+\infty}| \\

以上代码在行内公式中效果如上,而在行间公式中的效果如下:

\begin{gather*}

\lim_{n\to\infty},\q \sum_{n=1}^{\infty},\q

\prod_{n=1}^{\infty},\q \int_{0}^{+\infty}

\end{gather*}

如果要在行内显示跟行间一样的效果,则加上\verb|\limits|或

\verb|{\displaystyle}|,如下:

\begin{lstlisting}

\lim\limits_{n\to\infty}

\sum\limits_{n=1}^{\infty}

\prod\limits_{n=1}^{\infty}

{ \displaystyle \int_{0}^{+\infty} }

\end{lstlisting}

使用\verb|\displaystyle|比较麻烦,

虽然

\begin{lstlisting}

\usepackage{bigints}

\end{lstlisting}

后可以用命令

\begin{lstlisting}

\bigintssss,\bigintsss,\bigintss,

\bigints, \bigint

\end{lstlisting}

获得不同大小的积分号(而无需\verb|\displaystyle|),

但这个系列的积分号太粗了,不美观。\\

比如\verb|\bigintss|:$ \bigintss_{0}^{+\infty} \sin(x^2){\rm d}x

=\dfrac{\sqrt{2\pi}}{4} $.\\

\\

\textbf{多重极限}:\\

$ \lim\limits_{x\to x_0 \atop y\to y_0} $\q

\verb|\lim\limits_{x\to x_0 \atop y\to y_0}| \\

$ \lim\limits_{\substack{w\to w_0\\ x\to x_0\\ y\to y_0\\ z\to z_0}} $

\begin{lstlisting}

\lim\limits_{\substack{w\to w_0\\

x\to x_0\\ y\to y_0\\ z\to z_0}}

\end{lstlisting}

\item \textbf{括号}:

\begin{lstlisting}

\left( \right), \left[ \right]

\left\{ \right\}, \left| \right|

\big,\bigg,\bigl,\bigr,\biggl,\biggr

\Big,\Bigg,\Bigl,\Bigr,\Biggl,\Biggr

\end{lstlisting}

直接使用(),[],\{\},括号的高度不会随着括号中的内容高度而变化,

比如$ (\dfrac{3}{4})^2,[\dfrac{\pi^2}{6}],\{\dfrac{\pi^4}{90}\} $.

使用\verb|\left( \right)|,则能让括号随内容增高而变高,

比如$ \left(\dfrac{\pi^2}{6}\right)^2 $. \\

使用\verb|\bigg( \bigg)|,\verb|\Bigg( \Bigg)|之类的,不同的命令代表不同尺寸的括号,而与括号中的内容无关。使用\verb|\left \right|时,内部不能出现换行符\verb|\\|,

若需要较高的括号,就要改用\verb|\bigg( \bigg)|等。\\

如果只需要显示单侧的括号(最常见的情形是只显示左大括号),现以左侧为例,\verb|\right|不能省略,必须与\verb|\left|配对出现,配对方法是要把右括号改成小数点,即输入\verb|\right.|,比如$ \left\{\dfrac{\pi^2}{6}\right. $的代码是

\verb|\left\{\dfrac{\pi^2}{6}\right.| \\

而\verb|\big|系列的括号可以直接省去一侧,无需配对出现。

$ \left\| \dfrac{a}{b} \right\| $\q

\verb|\left\||\verb|\dfrac{a}{b}\right\|| \\

$ \left\langle \dfrac{a}{b} \right\rangle $\q

\verb|\left\langle\dfrac{a}{b}\right\rangle| \\

$ \left\lfloor \dfrac{a}{b} \right\rfloor $\q

\verb|\left\lfloor\dfrac{a}{b}\right\rfloor| \\

$ \left\lceil \dfrac{a}{b} \right\rceil $\q

\verb|\left\lceil \dfrac{a}{b}\right\rceil |

\item 行内公式$ a^2+b^2=c^2 $使用\verb|$ a^2+b^2=c^2 $|即可。\\

行间公式可用语法很多,比如\verb|\[ \], $$ $$|,

这两种环境只能输入单行公式,换行符\verb|\\|在其中无效。

行间公式还可以用

\verb|\begin{xx} \end{xx}|之类,其中\verb|xx|可以是

\begin{lstlisting}

align(*),alignat(*),flalign(*)

equation(*), gather(*),multline(*)

\end{lstlisting}

带*的环境不给公式编号,不带*的环境自动给公式编号,

使用\verb|\notag|或\verb|\nonumber|可隐藏任意一行公式的编号。

\verb|equation(*)|也只能输入单行公式,换行符\verb|\\|在其中无效,

但在其中嵌入\verb|split|环境后就能输入多行公式了,

好处是多行公式只有一个编号。

\begin{lstlisting}

\begin{equation} \label{aaa1}

\begin{split}

&\ x^4+2x^3+11x^2+18x+18 \\

=&\ (x^2+2x+2)(x^2+9) \\

=&\ (x^2+x+3)^2+(2x+3)^2

\end{split}

\end{equation}

\end{lstlisting}

\begin{equation} \label{aaa1}

\boxed{

\begin{split}

&\ x^4+2x^3+11x^2+18x+18 \\

=&\ (x^2+2x+2)(x^2+9) \\

=&\ (x^2+x+3)^2+(2x+3)^2

\end{split} }

\end{equation}

用\verb|\label{aaa1}|给公式加标签,然后用\verb|\ref{aaa1}|引用公式(的编号),

\verb|\pageref{aaa1}|引用公式所在的页码。\\

\\

\verb|alignat|和\verb|align|环境区别如下(不明显,\verb|align|整体稍微宽一点):

\begin{lstlisting}

\begin{alignat*}{3}

2x+3 &= 5678y-8765z &+ 20 \\

4x &= y+z &+ 11112222

\end{alignat*}

\end{lstlisting}

\tcbset{notitle,before={\noindent},after={\noindent},

colback=white,top={1mm},bottom={1mm},}

\begin{tcolorbox}

\vspace{-5mm}

\begin{alignat*}{3}

2x+3 &= 5678y-8765z &+ 20 \\

4x &= y+z &+ 11112222

\end{alignat*}

\end{tcolorbox}

\begin{lstlisting}

\begin{align*}

2x+3 &= 5678y-8765z &+ 20 \\

5x &= y+z &+ 33334444

\end{align*}

\end{lstlisting}

\begin{tcolorbox}

\vspace{-3mm}

\begin{align*}

\begin{aligned}

2x+3 &= 5678y-8765z &+ 20 \\

5x &= y+z &+ 33334444

\end{aligned}

\end{align*}

\end{tcolorbox}

\verb|gather(*)|环境中不能出现对齐符号\verb|&|,否则报错。

此环境下所有行的公式全部居中对齐。

\begin{lstlisting}

\begin{gather*}

2x+3 = 5678y-8765z + 20 \\

6x = y+z + 55556666

\end{gather*}

\end{lstlisting}

\begin{gather*}

\boxed{

\begin{gathered}

2x+3 = 5678y-8765z + 20 \\

6x = y+z + 55556666

\end{gathered} }

\end{gather*}

\verb|cases|环境对于带左大括号的情形特别有用,比如分段函数、方程联立等,

\begin{lstlisting}

\begin{align*}

\begin{cases}

2x+3y=7 \\

3x+5y=8

\end{cases}

\end{align*}

\end{lstlisting}

\begin{align*}

\boxed{

\begin{cases}

2x+3y=7 \\

3x+5y=8

\end{cases} }

\end{align*}

虽然用

\begin{lstlisting}

\begin{align*}

\left\{

\begin{aligned}

& 2x+3y=7 \\

& 3x+5y=8

\end{aligned}

\right.

\end{align*}

\end{lstlisting}

也能实现同样效果,但显然是\verb|cases|更方便。\\

\verb|multline(*)|环境第一行左对齐,中间的行居中对齐,最后一行右对齐,用得较少。

\begin{lstlisting}

\begin{multline}

1-line \\

2-line \\

3-line \\

4-line

\end{multline}

\end{lstlisting}

\begin{tcolorbox}

\vspace{-5mm}

\begin{multline}

1-line \\

2-line \\

3-line \\

4-line

\end{multline}

\end{tcolorbox}

公式环境中要加汉字,则必须置于\verb|\text{}|之内。\\

实现文本居中对齐使用\verb|center|环境

\begin{lstlisting}

\begin{center}

\end{center}

\end{lstlisting}

以上给公式外围加边框用的是:

\begin{lstlisting}

\begin{align*}

\boxed{

\begin{aligned}

······

\end{aligned}

}

\end{align*}

\end{lstlisting}

\begin{lstlisting}

\usepackage{tcolorbox}

\tcbset{before={\noindent},

after={\noindent},colback=white}

\begin{tcolorbox}

\vspace{-5mm}

\begin{align*}

······

\end{align*}

\end{tcolorbox}

\end{lstlisting}

想让公式编号带上“章”序号或“节”序号,可使用

\begin{lstlisting}

\numberwithin{equation}{chapter}

\numberwithin{equation}{section}

\end{lstlisting}

\item \textbf{矩阵和行列式}:\\

$ \begin{pmatrix}

a_{11} & a_{12} \\

a_{21} & a_{22} \\

\end{pmatrix} $

\begin{lstlisting}

\begin{pmatrix}

a_{11} & a_{12} \\

a_{21} & a_{22} \\

\end{pmatrix}

\end{lstlisting}

$ \begin{bmatrix}

a_{11} & a_{12} \\

a_{21} & a_{22} \\

\end{bmatrix} $ 用\, \verb|bmatrix|,\

$ \begin{vmatrix}

a_{11} & a_{12} \\

a_{21} & a_{22} \\

\end{vmatrix} $ 用\, \verb|vmatrix| \\

不带括号和竖线用\verb|matrix|,大括号用\verb|Bmatrix|,\\

双竖线用\verb|Vmatrix|.\\

三种省略号:

$ \cdots $\ \verb|\cdots|,\ \

$ \vdots $\ \verb|\vdots|,\ \

$ \ddots $\ \verb|\ddots|

\item \textbf{函数}:

\begin{lstlisting}

\arg,\exp, \inf,\sup, \max,\min

\sin,\sinh,\arcsin,\cos,\cosh,\arccos

\tan,\tanh,\arctan

\log,\ln,\lg, \deg,\det,\dim

\end{lstlisting}

%\vspace{-3mm}

这些函数只能在公式环境中使用,而且字体是正体,

如果不在前面加$ \backslash $,直接输入$ sin,cos,log $,

字体就是斜体。

\item 公式中,某些特殊含义的字母需要用正体而非斜体,比如自然对数底数e,虚数单位i和微分符号d,有两种方法,分别是

\verb|{\rm e}|和\verb|\mathrm{e}|,比如

\begin{lstlisting}

{\rm e}^{{\rm i}\theta}=

\cos\theta+{\rm i}\sin\theta \\

\int_0^{+\infty}\frac{x}{\mathrm{e}^x

-1}\mathrm{d}x=\frac{\pi^2}{6}

\end{lstlisting}

\vspace{-5mm}

\begin{gather*}

{\rm e}^{{\rm i}\theta}=\cos\theta+{\rm i}\sin\theta \\

\int_{0}^{+\infty}\dfrac{x}{\mathrm{e}^x

-1}\mathrm{d}x=\dfrac{\pi^2}{6}

\end{gather*}

公式环境下e、i、dx都不用正体的效果是:$ e,i,dx $.

\item 自定义新的命令:\verb|\newcommand{}{}|,

效果类似于C语言的宏替换\verb|#define|.

比如嫌\verb|\quad|太麻烦,可以先\verb|\newcommand{\q}{\quad}|,

然后就能用\verb|\q|代替\verb|\quad|.

在\verb|\newcommand{\im}{{\rm i}}|之后,就能用\verb|\im|实现

正体的虚数单位$ {\rm i} $.因为\verb|\i|已经在某个包中定义过了,

所以也可以用\verb|\renewcommand{\i}{{\rm i}}|覆盖掉\verb|\i|的定义。

对e和d可类似处理,提高输入效率。

\item \textbf{希腊字母}:

\vspace{2mm} \\

\begin{tabular}{|l|l|l|l|l|l|}

\hline

$ \alpha $ & \verb|\alpha| & $ \beta $ & \verb|\beta| & $ \gamma $ & \verb|\gamma| \\ \hline

$ \delta $ & \verb|\delta| & $ \epsilon $ & \verb|\epsilon| & $ \varepsilon $ & \verb|\varepsilon| \\ \hline

$ \zeta $ & \verb|\zeta| & $ \eta $ & \verb|\eta| & $ \theta $ & \verb|\theta| \\ \hline

$ \lambda$ & \verb|\lambda|& $ \mu $ & \verb|\mu| & $ \nu $ & \verb|\nu| \\ \hline

$ \xi $ & \verb|\xi| & $ \pi $ & \verb|\pi| & $ \rho $ & \verb|\rho| \\ \hline

$ \sigma $ & \verb|\sigma| & $ \tau $ & \verb|\tau| & $ \phi $ & \verb|\phi| \\ \hline

$ \varphi$ & \verb|\varphi|& $ \psi $ & \verb|\psi| & $ \omega $ & \verb|\omega| \\ \hline

\end{tabular}

\vspace{2mm} \\

以下字母存在大写形式(省略了一些带\verb|\var|前缀的),只需把首字母大写即可。

\begin{lstlisting}

\Gamma,\Delta,\Theta,\Lambda,\Xi,\O,

\Pi,\Sigma,\Upsilon,\Phi,\Psi,\Omega

\end{lstlisting}

\item 字母上下加符号:

\begin{multicols}{2}

$ \overline{a} $\q \verb|\overline{a}| \\

$ \underline{a} $\q \verb|\underline{a}| \\

$ \overbrace{a} $\q \verb|\overbrace{a}| \\

$ \underbrace{a} $\q \verb|\underbrace{a}| \\

$ \overleftarrow{a} $\q \verb|\overleftarrow{a}| \\

$ \overrightarrow{a} $\q \verb|\overrightarrow{a}| \\

$ \stackrel{b}{a} $\q \verb|\stackrel{b}{a}| \\

$ \overset{b}{a} $\q \verb|\overset{b}{a}| \\

$ \underset{b}{a} $\q \verb|\underset{b}{a}| \\

$ \acute{a} $\q \verb|\acute{a}| \\

$ \grave{a} $\q \verb|\grave{a}| \\

$ \tilde{a} $\q \verb|\tilde{a}| \\

$ \widetilde{abc} $\q \verb|\widetilde{abc}| \\

$ \bar{a} $\q \verb|\bar{a}| \\

$ \vec{a} $\q \verb|\vec{a}| \\

$ \hat{a} $\q \verb|\hat{a}| \\

$ \widehat{abc} $\q \verb|\widehat{abc}| \\

$ \check{a} $\q \verb|\check{a}| \\

$ \breve{a} $\q \verb|\breve{a}| \\

$ \dot{a} $\q \verb|\dot{a}| \\

$ \ddot{a} $\q \verb|\ddot{a}| \\

$ \dddot{a} $\q \verb|\dddot{a}|

\end{multicols}

\item \textbf{中文加下划线}:(需\verb|\usepackage{ulem}|)

\vspace{-5mm}

\begin{multicols}{2}

\uline{单下划线}\q \verb|\uline{}| \\

\uuline{双下划线}\q \verb|\uuline{}| \\

\uwave{波浪线}\q\q \verb|\uwave{}| \\

\sout{删除线}\q\q \verb|\sout{}| \\

\dashuline{虚下划线}\q \verb|\dashuline{}| \\

\dotuline{点下划线}\q \verb|\dotuline{}|

\end{multicols}

\item \textbf{箭头}:

\vspace{-5mm}

\begin{multicols}{2}

$ \to $\q \verb|\to| \\

$ \rightarrow $\q \verb|\rightarrow| \\

$ \Rightarrow $\q \verb|\Rightarrow| \\

$ \longrightarrow $\q \verb|\longrightarrow| \\

$ \leftarrow $\q \verb|\leftarrow| \\

$ \Leftarrow $\q \verb|\Leftarrow| \\

$ \uparrow $\q \verb|\uparrow| \\

$ \downarrow $\q \verb|\downarrow|

\end{multicols}

\vspace{-5mm}

$ \xrightarrow[a,b]{c,d} $\q \verb|\xrightarrow[a,b]{c,d}| \\

$ \xlongequal[140^{\circ}{\rm C}]{\text{稀硫酸}} $\q

(\verb|\xlongequal|需\verb|\usepackage{extarrows}|) \\

\verb|\xlongequal[140^{\circ}{\rm C}]{\text{稀硫酸}}|

\item \textbf{插入表格}:

\begin{lstlisting}

\begin{tabular}{|c|c|}

\hline

& \\

\hline

& \\

\hline

\end{tabular}

\end{lstlisting}

表格内换行:

\begin{lstlisting}

\usepackage{makecell}

\makecell[l]{第一行 \\ 第二行 \\ ···}

\end{lstlisting}

合并单元格则使用\verb|\multicolumn|和\verb|\multirow|.\\

跨页的长表格使用\verb|\begin{longtable}···|. \\

表格行距控制:\verb|\renewcommand{\arraystretch}{1.5}|

\item \textbf{插入图片}:

\begin{lstlisting}

\usepackage{graphicx}

\begin{figure}

\centering

\includegraphics[width=

0.3\linewidth]{图片名}

\caption{图片标题}

\label{xxx1}

\end{figure}

\end{lstlisting}

位置控制:\verb|h t b p ! H| \\

四种宽度:\\

\verb|\linewidth|\q\q 当前行的宽度 \\

\verb|\columnwidth|\q 当前分栏的宽度 \\

\verb|\textwidth|\q\q\ 整个页面版芯的宽度 \\

\verb|\paperwidth|\q\q 整个页面纸张的宽度

\item \textbf{添加页眉页脚}:

\begin{lstlisting}

\usepackage{fancyhdr}

\pagestyle{fancy}

\lhead{左页眉}

\chead{中页眉}

\rhead{右页眉}

\lfoot{左页脚,修订日期\today}

\cfoot{中页脚,第\thepage 页}

\rfoot{右页脚}

\end{lstlisting}

\item \textbf{添加水印}:\\

使用\verb|{xwatermark}|包会遇到报错\\

“\verb|Extra \endgroup. \begin{document}|”;\\

\verb|{background}|第一页水印的颜色比后面的页更深,第二页水印内容也有异常;

\verb|{watermark}|(2004)和\verb|{draftmark}|(2009)太旧,均无法使用。\\

下面给出\verb|{draftwatermark}|用法示例,但这个包有时会出现水印文字

重叠到一起的问题(本文档编译时经常遇到这个问题,但不是100\% 出现)。

\begin{lstlisting}

\usepackage{draftwatermark}

\usepackage{everypage}

\SetWatermarkText{磁悬浮青蛙,水印}

\SetWatermarkLightness{0}

\SetWatermarkAngle{80}

\SetWatermarkColor{gray}

\SetWatermarkScale{0.07}

\end{lstlisting}

\item 添加带编号\textbf{脚注}\footnote{这是用

$\backslash$footnote\{\}添加的带编号脚注。}:

\verb|\footnote{}|. \\

无编号脚注:(自定义了\verb|\myfootnote|命令)\myfootnote{这是用

$\backslash$myfootnote\{\}添加的无编号脚注。}

\begin{lstlisting}

\newcommand{\myfootnote}[1]{

\renewcommand{\thefootnote}{}

\footnotetext{\scriptsize#1}

\renewcommand{\thefootnote}{

\arabic{footnote}} }

\end{lstlisting}

把脚注编号改为带圈数字:

\begin{lstlisting}

\renewcommand{\thefootnote}{

\ding{\numexpr171+\value{footnote}}}

\newcommand{\myfootnote}[1]{

\renewcommand{\thefootnote}{}

\footnotetext{\scriptsize#1}

\renewcommand{\thefootnote}{

\ding{\numexpr171+\value{footnote}}}}

\end{lstlisting}

\item \textbf{允许公式跨页}:\verb|\allowdisplaybreaks|

\item \textbf{新增空白页}:

\begin{lstlisting}

\newpage, \clearpage, \cleardoublepage

\end{lstlisting}

\item \textbf{日期}:\verb|\today|

\item \textbf{目录}:\verb|\tableofcontents| \\

设置目录深度:\verb|\setcounter{tocdepth}{3}| \\

设置在几级目录前标记序号:\\

\verb|\setcounter{secnumdepth}{4}|

\item \textbf{字体大小}控制:

\begin{lstlisting}

\tiny, \scriptsize, \footnotesize

\small, \normalsize

\large, \Large, \LARGE

\huge, \Huge

\end{lstlisting}

文本行距控制:\verb|\linespread{1.3}|(必须放在\\

\verb|\begin{document}|之前)

\item \textbf{粗体}:\verb|\textbf{}|,使用时如果恰好换行,

在tex源码中让\verb|\textbf{}|处于新一行,则编译后的粗体前面会多一个空格,

解决方案就是不要恰好在\verb|\textbf{}|前面换行。

斜体命令\verb|\textit{}|只对英文有效,对中文无效。

对英文同时斜体和粗体则需\verb|\usepackage{bm}|,

$ \bm{AB} $:\verb|$\bm{AB}$| \\

用以下命令修改字体,需\verb|\usepackage{fontspec}|\\

设置英文字体:\verb|\setmainfont{Microsoft YaHei}|\\

设置C(中文)、J(日文)、K(韩文)的字体:

\begin{lstlisting}

\setCJKmainfont[BoldFont=OPPOSans-B]{

SourceHanSerifCN-Regular}

\end{lstlisting}

\textcolor{red}{设置}\textcolor{green}{文本}\textcolor{gray}{颜色}\textcolor{orange}{(textcolor)}:

\begin{lstlisting}

\textcolor{red}{设置}···

\end{lstlisting}

\item 部分\ \verb|\part{}| \hspace{2cm} 章\ \ \ \ \verb|\chapter{}| \\

节\ \ \ \ \verb|\section{}| \hspace{1.45cm} 小节\ \verb|\subsection{}|

\item \textbf{带编号列表}:

\begin{lstlisting}

\usepackage{enumerate}

\begin{enumerate}[(1)]

\item

\item

\end{enumerate}

\end{lstlisting}

\textbf{不带编号列表}:

\begin{lstlisting}

\begin{itemize}

\item

\item

\end{itemize}

\end{lstlisting}

\item 常用\textbf{长度单位}:毫米(mm),厘米(cm),点(pt),ex,em

\item \textbf{交换图}:

\begin{displaymath}

\xymatrix{ V \ar[r]^{\bm{\varphi}}

\ar[d]_{\bm{\eta}_1} & U\ar[d]^{\bm{\eta}_2} \\

{\mathbb{K}_n} \ar[r]^{\bm{\varphi}_A} & {\mathbb{K}_m} }

\end{displaymath}

\begin{lstlisting}

\usepackage[all]{xy}

\begin{displaymath}

\xymatrix{

V \ar[r]^{\bm{\varphi}}

\ar[d]_{\bm{\eta}_1}

& U\ar[d]^{\bm{\eta}_2} \\

{\mathbb{K}_n} \ar[r]^{\bm{\varphi}_A}

& {\mathbb{K}_m} }

\end{displaymath}

\end{lstlisting}

\item \textbf{空格与空白}:

\vspace{-5mm}

\begin{multicols}{2}

负空格\q \verb|\!| \\

窄空格\q \verb|\,| \\

中等空格\q \verb|\:| \\

宽空格\q \verb|\;| \\

词间空格\q \verb|\ | \\

四倍空格\q \verb|\quad| \\

八倍空格\q \verb|\qquad|

\end{multicols}

\vspace{-5mm}

注意,“词间空格”的斜杠后有一个看不见的空格。\\

取消首行缩进:\verb|\noindent| \\

水平空白\q \verb|\hspace{|$ \pm $\verb|2cm}| \\

垂直空白\q \verb|\vspace{|$ \pm $\verb|2cm}| \\

缩小行间公式与上下文之间的空白(必须放在\\

\verb|\begin{document}|之前):

\begin{lstlisting}

\AtBeginDocument{

\addtolength{\abovedisplayskip}{-2ex}

\addtolength{

\abovedisplayshortskip}{-2ex}

\addtolength{\belowdisplayskip}{-2ex}

\addtolength{

\belowdisplayshortskip}{-2ex} }

\end{lstlisting}

\item \textbf{设置页边距}:

\begin{lstlisting}

\usepackage{geometry}

\geometry{a4paper,left=1cm,right=1cm,

top=1.5cm,bottom=1.5cm}

\end{lstlisting}

\item 英文字母几种变体效果如下:\\

\verb|\mathcal{}|(只能用于大写字母,对小写无效)

\begin{gather*}

\boxed{\mathcal{ABCDEFGHIJKLMNOPQRSTUVWXYZ}}

\end{gather*}

\verb|\mathscr{}|(只能用于大写字母,需\verb|{mathrsfs}|)

\begin{gather*}

\boxed{ \begin{gathered}

\mathscr{ABCDEFGHIJKLM}\\

\mathscr{NOPQRSTUVWXYZ}

\end{gathered} }

\end{gather*}

\verb|\mathbb{}|(只能用于大写字母,需\verb|{amssymb}|)

\begin{gather*}

\boxed{ \begin{gathered}

\mathbb{ABCDEFGHIJKLMNOPQRSTUVWXYZ}

\end{gathered} }

\end{gather*}

\verb|\mathfrak{}|(同时适用于大小写,需\verb|{amssymb}|)

\begin{gather*}

\boxed{ \begin{gathered}

\mathfrak{ABCDEFGHIJKLMNOPQRSTUVWXYZ}\\

\mathfrak{abcdefghijklmnopqrstuvwxyz}

\end{gathered} }

\end{gather*}

\item 自定义带圈数字命令\verb|\mycircled{}|:

\begin{lstlisting}

\newcommand*{\mycircled}[1]{\lower.7ex

\hbox{\tikz\draw (0pt, 0pt)

circle (.4em) node {

\makebox[0.5em][c]{\small #1}};} }

\end{lstlisting}

\item 防止ff,fi,ffi,fl变成连体(Ligature):\\

方法一:\\

\verb|f{}f,f{}i,f{}f{}i,f{}l|,效果:f{}f, f{}i, f{}f{}i, f{}l \\

方法二:\\

\verb|f{f},f{i},f{f}i, f{l}|,效果:f{f}, f{i}, f{f}i, f{l}

\item 本手册使用了多栏环境

\begin{lstlisting}

\usepackage{multicol}

\begin{multicols}{2}

\end{multicols}

\end{lstlisting}

以及带编号列表环境\verb|enumerate|,用

\begin{lstlisting}

\columnseprule 1pt

\end{lstlisting}

显示中央分隔竖线并控制线宽。用

\begin{lstlisting}

\columnsep 20pt

\end{lstlisting}

控制两栏之间的间隔。显示\LaTeX 代码使用了两种方法,

较短的代码使用了\verb|\verb| | |,大片的代码使用了

\begin{lstlisting}

\usepackage{listings}

\lstset

{ language=[LaTeX]TeX,

backgroundcolor=\color{gray!20},

basicstyle=\tt\normalsize,

aboveskip=0pt,

belowskip=0pt, }

\end{lstlisting}

\vspace{-2mm}

\begin{tcolorbox}[arc={0mm},colback={gray!20},boxrule={0pt},left={0pt}]

\verb|\begin{lstlisting}| \\

\\

\verb|\end{lstlisting}|

\end{tcolorbox}

除了\verb|lstlisting|,也可以使用 \\

\begin{tcolorbox}[arc={0mm},colback={gray!20},boxrule={0pt},left={0pt}]

\verb|\begin{verbatim}| \\

\\

\verb|\end{verbatim}|

\end{tcolorbox}

\item 以下三个网站可以在线写作以及编译\LaTeX :

\begin{lstlisting}

https://www.texpage.com/

https://www.slager.cn/

https://cn.overleaf.com/

\end{lstlisting}

以下网站可以识别手写\LaTeX 符号,并提供可能的\LaTeX 代码。

\lstset

{ language=[LaTeX]TeX,

backgroundcolor = \color{gray!20},

basicstyle=\tt\small,

aboveskip=1pt,

belowskip=1pt, }

\begin{lstlisting}

http://detexify.kirelabs.org/classify.html

\end{lstlisting}

\end{enumerate}

\end{multicols}

\end{document}编辑于 2022-05-03 12:10​赞同 1063​​26 条评论​分享​收藏​喜欢

LaTeX 入门 - OI Wiki

X 入门 - OI Wiki 跳转至 OI Wiki LaTeX 入门 正在初始化搜索引擎 OI-wiki/OI-wiki 简介 比赛相关 工具软件 语言基础 算法基础 搜索 动态规划 字符串 数学 数据结构 图论 计算几何 杂项 专题 关于 Hulu OI Wiki OI-wiki/OI-wiki 简介 简介 Getting Started 关于本项目 如何参与 OI Wiki 不是什么 格式手册 数学符号表 F.A.Q. 用 Docker 部署 OI Wiki 镜像站列表 致谢 比赛相关 比赛相关 比赛相关简介 赛事 赛事 OI 赛事与赛制 ICPC/CCPC 赛事与赛制 题型 题型 题型概述 交互题 学习路线 学习资源 技巧 技巧 读入、输出优化 分段打表 常见错误 常见技巧 出题 工具软件 工具软件 工具软件简介 代码编辑工具 代码编辑工具 Vim Emacs VS Code Atom Eclipse Notepad++ Kate Dev-C++ CLion Geany Xcode GUIDE Sublime Text CP Editor 评测工具 评测工具 评测工具简介 Arbiter Cena CCR Plus Lemon 命令行 编译器 WSL (Windows 10) Special Judge Testlib Testlib Testlib 简介 通用 Generator Validator Interactor Checker Polygon OJ 工具 LaTeX 入门 LaTeX 入门 目录 介绍 什么是 LaTeX 在开始之前 一些概念 环境配置 文档结构 基本要素 处理问题 添加文档标题 章节 创建标签 生成目录(TOC) 文字处理 中文字体支持 字体效果 彩色字体 字体大小 段落缩进 列表 注释和空格 特殊字符 表格 实践 图表 实践 公式 插入公式 数学符号 上标和下标 分数 根号 求和与积分 希腊字母 实践 参考文献 介绍 BibTeX 文件类型 插入文献列表 参考文献标注 引用格式 数字标号引用 作者日期引用 其他引用格式 实践 更多阅读 Git 语言基础 语言基础 语言基础简介 C++ 基础 C++ 基础 Hello, World! C++ 语法基础 变量 运算 流程控制语句 流程控制语句 分支 循环 高级数据类型 高级数据类型 数组 结构体 联合体 指针 函数 文件操作 C++ 标准库 C++ 标准库 C++ 标准库简介 STL 容器 STL 容器 STL 容器简介 迭代器 序列式容器 关联式容器 无序关联式容器 容器适配器 STL 算法 bitset string pair C++ 进阶 C++ 进阶 类 命名空间 值类别 重载运算符 引用 常值 新版 C++ 特性 Lambda 表达式 pb_ds pb_ds pb_ds 简介 堆 平衡树 编译优化 C++ 与其他常用语言的区别 Pascal 转 C++ 急救 Python 速成 Java 速成 Java 进阶 算法基础 算法基础 算法基础简介 复杂度 枚举 模拟 递归 & 分治 贪心 排序 排序 排序简介 选择排序 冒泡排序 插入排序 计数排序 基数排序 快速排序 归并排序 堆排序 桶排序 希尔排序 锦标赛排序 tim排序 排序相关 STL 排序应用 前缀和 & 差分 二分 倍增 构造 搜索 搜索 搜索部分简介 DFS(搜索) BFS(搜索) 双向搜索 启发式搜索 A* 迭代加深搜索 IDA* 回溯法 Dancing Links Alpha-Beta 剪枝 优化 动态规划 动态规划 动态规划部分简介 动态规划基础 记忆化搜索 背包 DP 区间 DP DAG 上的 DP 树形 DP 状压 DP 数位 DP 插头 DP 计数 DP 动态 DP 概率 DP DP 优化 DP 优化 单调队列/单调栈优化 斜率优化 四边形不等式优化 状态设计优化 其它 DP 方法 字符串 字符串 字符串部分简介 字符串基础 标准库 字符串匹配 字符串哈希 字典树 (Trie) 前缀函数与 KMP 算法 Boyer–Moore 算法 Z 函数(扩展 KMP) 自动机 AC 自动机 后缀数组 (SA) 后缀数组 (SA) 后缀数组简介 最优原地后缀排序算法 后缀自动机 (SAM) 后缀平衡树 广义后缀自动机 后缀树 Manacher 回文树 序列自动机 最小表示法 Lyndon 分解 Main–Lorentz 算法 数学 数学 数学部分简介 符号 进位制 位运算 二进制集合操作 平衡三进制 高精度计算 快速幂 置换和排列 弧度制与坐标系 复数 数论 数论 数论基础 素数 最大公约数 数论分块 欧拉函数 筛法 Meissel–Lehmer 算法 分解质因数 裴蜀定理 类欧几里德算法 欧拉定理 & 费马小定理 乘法逆元 线性同余方程 中国剩余定理 升幂引理 威尔逊定理 卢卡斯定理 同余方程 二次剩余 原根 离散对数 剩余 莫比乌斯反演 杜教筛 Powerful Number 筛 Min_25 筛 洲阁筛 连分数 Stern–Brocot 树与 Farey 序列 二次域 循环连分数 Pell 方程 多项式与生成函数 多项式与生成函数 多项式与生成函数简介 代数基本定理 快速傅里叶变换 快速数论变换 快速沃尔什变换 Chirp Z 变换 多项式牛顿迭代 多项式多点求值|快速插值 多项式初等函数 常系数齐次线性递推 多项式平移|连续点值平移 符号化方法 普通生成函数 指数生成函数 狄利克雷生成函数 组合数学 组合数学 排列组合 抽屉原理 容斥原理 康托展开 斐波那契数列 错位排列 卡特兰数 斯特林数 贝尔数 伯努利数 Entringer Number Eulerian Number 分拆数 范德蒙德卷积 图论计数 线性代数 线性代数 线性代数简介 向量 内积和外积 矩阵 初等变换 行列式 线性空间 线性基 线性映射 特征多项式 对角化 Jordan标准型 线性规划 线性规划 线性规划简介 单纯形算法 群论 群论 群论简介 置换群 概率论 概率论 基本概念 条件概率与独立性 随机变量 随机变量的数字特征 概率不等式 博弈论 博弈论 博弈论简介 公平组合游戏 非公平组合游戏 反常游戏 数值算法 数值算法 插值 数值积分 高斯消元 牛顿迭代法 傅里叶-莫茨金消元法 序理论 杨氏矩阵 Schreier–Sims 算法 Berlekamp–Massey 算法 数据结构 数据结构 数据结构部分简介 栈 队列 链表 哈希表 并查集 并查集 并查集 并查集复杂度 堆 堆 堆简介 二叉堆 配对堆 左偏树 块状数据结构 块状数据结构 分块思想 块状数组 块状链表 树分块 Sqrt Tree 单调栈 单调队列 ST 表 树状数组 线段树 李超线段树 区间最值操作 & 区间历史最值 划分树 二叉搜索树 & 平衡树 二叉搜索树 & 平衡树 二叉搜索树 & 平衡树 Treap Splay 树 WBLT Size Balanced Tree AVL 树 B 树 B+ 树 替罪羊树 Leafy Tree 笛卡尔树 红黑树 左偏红黑树 AA 树 2-3 树 2-3-4 树 跳表 可持久化数据结构 可持久化数据结构 可持久化数据结构简介 可持久化线段树 可持久化块状数组 可持久化平衡树 可持久化字典树 可持久化可并堆 树套树 树套树 线段树套线段树 平衡树套线段树 线段树套平衡树 树状数组套权值线段树 分块套树状数组 K-D Tree 动态树 动态树 Link Cut Tree 全局平衡二叉树 Euler Tour Tree Top Tree 析合树 PQ 树 手指树 霍夫曼树 图论 图论 图论部分简介 图论相关概念 图的存储 DFS(图论) BFS(图论) 树上问题 树上问题 树基础 树的直径 最近公共祖先 树的重心 树链剖分 树上启发式合并 虚树 树分治 动态树分治 AHU 算法 树哈希 树上随机游走 矩阵树定理 有向无环图 拓扑排序 最小生成树 斯坦纳树 最小树形图 最小直径生成树 最短路 拆点 差分约束 k 短路 同余最短路 连通性相关 连通性相关 强连通分量 双连通分量 割点和桥 圆方树 点/边连通度 环计数问题 2-SAT 欧拉图 哈密顿图 二分图 最小环 平面图 图的着色 网络流 网络流 网络流简介 最大流 最小割 费用流 上下界网络流 Stoer–Wagner 算法 图的匹配 图的匹配 图匹配 增广路 二分图最大匹配 二分图最大权匹配 一般图最大匹配 一般图最大权匹配 Prüfer 序列 LGV 引理 弦图 最大团搜索算法 支配树 图上随机游走 计算几何 计算几何 计算几何部分简介 二维计算几何基础 三维计算几何基础 距离 Pick 定理 三角剖分 凸包 扫描线 旋转卡壳 半平面交 平面最近点对 随机增量法 反演变换 计算几何杂项 杂项 杂项 杂项简介 离散化 双指针 离线算法 离线算法 离线算法简介 CDQ 分治 整体二分 莫队算法 莫队算法 莫队算法简介 普通莫队算法 带修改莫队 树上莫队 回滚莫队 二维莫队 莫队二次离线 莫队配合 bitset 分数规划 随机化 随机化 随机函数 随机化技巧 爬山算法 模拟退火 悬线法 计算理论基础 字节顺序 约瑟夫问题 格雷码 表达式求值 在一台机器上规划任务 主元素问题 Garsia–Wachs 算法 15-puzzle Kahan 求和 珂朵莉树/颜色段均摊 专题 专题 RMQ 并查集应用 括号序列 线段树与离线询问 关于 Hulu 关于 Hulu 关于 Hulu 目录 介绍 什么是 LaTeX 在开始之前 一些概念 环境配置 文档结构 基本要素 处理问题 添加文档标题 章节 创建标签 生成目录(TOC) 文字处理 中文字体支持 字体效果 彩色字体 字体大小 段落缩进 列表 注释和空格 特殊字符 表格 实践 图表 实践 公式 插入公式 数学符号 上标和下标 分数 根号 求和与积分 希腊字母 实践 参考文献 介绍 BibTeX 文件类型 插入文献列表 参考文献标注 引用格式 数字标号引用 作者日期引用 其他引用格式 实践 更多阅读 LaTeX 入门介绍什么是 LaTeXLaTeX(读作/ˈlɑːtɛx/或/ˈleɪtɛx/)是一个让你的文档看起来更专业的排版系统,而不是文字处理器。它尤其适合处理篇幅较长、结构严谨的文档,并且十分擅长处理公式表达。它是免费的软件,对大多数操作系统都适用。LaTeX 基于 TeX(Donald Knuth 在 1978 年为数字化排版设计的排版系统)。TeX 是一种电脑能够处理的低级语言,但大多数人发现它很难使用。LaTeX 正是为了让它变得更加易用而设计的。目前 LaTeX 的版本是 LaTeX 2e。如果你习惯于使用微软的 Office Word 处理文档,那么你会觉得 LaTeX 的工作方式让你很不习惯。Word 是典型的「所见即所得」的编辑器,你可以在编排文档的时侯查看到最终的排版效果。但使用 LaTeX 时你并不能方便地查看最终效果,这使得你专注于内容而不是外观的调整。一个 LaTeX 文档是一个以 .tex 结尾的文本文件,可以使用任意的文本编辑器编辑,比如 Notepad,但对于大多数人而言,使用一个合适的 LaTeX 编辑器会使得编辑的过程容易很多。在编辑的过程中你可以标记文档的结构。完成后你可以进行编译——这意味着将它转化为另一种格式的文档。它支持多种格式,但最常用的是 PDF 文档格式。在开始之前下面列出在本文中使用到的记号:希望你实施的操作会被打上一个箭头 ;你输入的字符会被装进代码块中;菜单命令与按钮的名称会被标记为 粗体。一些概念如果需要编写 LaTeX 文档,你需要安装一个「发行版」,常用的发行版有 TeX Live、MikTeX 和适用于 macOS 用户的 MacTeX(实际上是 TeX Live 的 macOS 版本),至于 CTeX 则现在不推荐使用。TeX Live 和 MacTeX 带有几乎所有的 LaTeX 宏包;而 MikTeX 只带有少量必须的宏包,其他宏包将在需要时安装。TeX Live 和 MikTeX 都带有 TeXworks 编辑器,你也可以安装功能更多的 TeXstudio 编辑器,或者自行配置 Visual Studio Code 或 Notepad++ 等编辑器。下文所使用的编辑器是运行在 Windows 7 上的 TeXworks。大部分发行版都带有多个引擎,如 pdfTeX 和 XeTeX。对于中文用户,推荐使用 XeTeX 以获得 Unicode 支持。TeX 有多种格式,如 Plain TeX 和 LaTeX。现在一般使用 LaTeX 格式。所以,你需要使用与你所使用的格式打包在一起的引擎。如对于 pdfTeX,你需要使用 pdfLaTeX,对于 XeTeX 则是 XeLaTeX。扩展阅读:TeX 引擎、格式、发行版之介绍。环境配置对于 Windows 用户,你需要下载 TeX Live 或 MikTeX。国内用户可以使用 清华大学 TUNA 镜像站,请点击页面右侧的「获取下载链接」按钮,并选择「应用软件」标签下的「TeX 排版系统」即可下载 TeX Live 或 MikTeX 的安装包,其中 TeX Live 的安装包是一个 ISO 文件,需要挂载后以管理员权限执行 install-tl-advanced.bat。对于 macOS 用户,清华大学 TUNA 镜像站同样提供 MacTeX 和 macOS 版 MikTeX 的下载。对于 Linux 用户,如果使用 TeX Live,则同样下载 ISO 文件,执行 install-tl 脚本;如果使用 MikTeX,则按照 官方文档 进行安装。文档结构基本要素 打开 TeXworks。一个新的文档会被自动打开。 进入 Format 菜单,选择 Line Numbers。行号并不是要素,但它可以帮助你比较代码与屏幕信息,找到错误。 进入 Format 菜单,选择 Syntax Coloring,然后选择 LaTeX。语法色彩会高亮代码,使得代码更加易读。 输入以下文字:1

2

3

4

5

6

7\documentclass[a4paper,12pt]{article}

\begin{document}

A sentence of text.

\end{document}

\documentclass 命令必须出现在每个 LaTeX 文档的开头。花括号内的文本指定了文档的类型。article 文档类型适合较短的文章,比如期刊文章和短篇报告。其他文档类型包括 report(适用于更长的多章节的文档,比如博士生论文),proc(会议论文集),book 和 beamer。方括号内的文本指定了一些选项——示例中它设置纸张大小为 A4,主要文字大小为 12pt。\begin{document} 和 \end{document} 命令将你的文本内容包裹起来。任何在 \begin{documnet} 之前的文本都被视为前导命令,会影响整个文档。任何在 \end{document} 之后的文本都会被忽视。空行不是必要的,但它可以让长的文档更易读。 按下 Save 按扭; 在 Libraries>Documents 中新建一个名为 LaTeX course 文件夹; 将你的文档命名为 Doc1 并将其保存为 TeX document 放在这个文件夹中。将不同的 LaTeX 文档放在不同的目录下,在编译的时候组合多个文件是一个很好的想法。 确保 typeset 菜单设置为了 xeLaTeX。 点击 Typeset 按扭。这时你的源文件会被转换为 PDF 文档,这需要花费一定的时间。在编译结束后,TeXworks 的 PDF 查看器会打开并预览生成的文件。PDF 文件会被自动地保存在与 TeX 文档相同的目录下。处理问题如果在你的文档中存在错误,TeXworks 无法创建 PDF 文档时,Typeset 按扭会变成一个红叉,并且底部的终端输出会保持展开。这时: 点击 Abort typesetting 按扭。 阅读终端输出的内容,最后一行可能会给出行号表示出现错误的位置。 找到文档中对应的行并修复错误。 再次点击 Typeset 按扭尝试编译源文件。添加文档标题\maketitle 命令可以给文档创建标题。你需要指定文档的标题。如果没有指定日期,就会使用现在的时间,作者是可选的。 在 \begin{document} 和 命令后紧跟着输入以下文本:1

2

3

4\title{My First Document}

\author{My Name}

\date{\today}

\maketitle

你的文档现在长成了这样: 1

2

3

4

5

6

7

8

9

10

11

12\documentclass[a4paper,12pt]{article}

\begin{document}

\title{My First Document}

\author{My Name}

\date{\today}

\maketitle

A sentence of text.

\end{document}

点击 Typeset 按扭,核对生成的 PDF 文档。要点笔记:\today 是插入当前时间的命令。你也可以输入一个不同的时间,比如 \date{November 2013}。article 文档的正文会紧跟着标题之后在同一页上排版。report 会将标题置为单独的一页。章节如果需要的话,你可能想将你的文档分为章(Chatpers)、节(Sections)和小节(Subsections)。下列分节命令适用于 article 类型的文档:\section{...}\subsection{...}\subsubsection{...}\paragraph{...}\subparagraph{...}花括号内的文本表示章节的标题。对于 report 和 book 类型的文档我们还支持 \chapter{...} 的命令。 将 "A sentence of text." 替换为以下文本: 1

2

3

4

5

6

7

8

9

10

11

12

13\section{Introduction}

This is the introduction.

\section{Methods}

\subsection{Stage 1}

The first part of the methods.

\subsection{Stage 2}

The second part of the methods.

\section{Results}

Here are my results.

你的文档会变成 1

2

3

4

5

6

7

8

9

10

11

12

13

14

15

16

17

18

19

20

21

22

23

24\documentclass[a4paper,12pt]{article}

\begin{document}

\title{My First Document}

\author{My Name}

\date{\today}

\maketitle

\section{Introduction}

This is the introduction.

\section{Methods}

\subsection{Stage 1}

The first part of the methods.

\subsection{Stage 2}

The second part of the methods.

\section{Results}

Here are my results.

\end{document}

点击 Typeset 按扭,核对 PDF 文档。应该是长这样的:创建标签你可以对任意章节命令创建标签,这样他们可以在文档的其他部分被引用。使用 \label{labelname} 对章节创建标签。然后输入 \ref{labelname} 或者 \pageref{labelname} 来引用对应的章节。 在 \subsection{Stage 1} 下面另起一行,输入 \label{sec1}。 在 Results 章节输入 Referring to section \ref{sec1} on page \pageref{sec1}。你的文档会变成这样: 1

2

3

4

5

6

7

8

9

10

11

12

13

14

15

16

17

18

19

20

21

22

23

24

25\documentclass[a4paper,12pt]{article}

\begin{document}

\title{My First Document}

\author{My Name}

\date{\today}

\maketitle

\section{Introduction}

This is the introduction.

\section{Methods}

\subsection{Stage 1}

\label{sec1}

The first part of the methods.

\subsection{Stage 2}

The second part of the methods.

\section{Results}

Here are my results. Referring to section \ref{sec1} on page \pageref{sec1}

\end{document}

编译并检查 PDF 文档(你可能需要连续编译两次):生成目录(TOC)如果你使用分节命令,那么可以容易地生成一个目录。使用 \tableofcontents 在文档中创建目录。通常我们会在标题的后面建立目录。你可能也想也想更改页码为罗马数字(i,ii,iii)。这会确保文档的正文从第 1 页开始。页码可以使用 \pagenumbering{...} 在阿拉伯数字和罗马数字见切换。 在 \maketitle 之后输入以下内容:1

2

3

4\pagenumbering{roman}

\tableofcontents

\newpage

\pagenumbering{arabic}

\newpage 命令会另起一个页面,这样我们就可以看到 \pagenumbering 命令带来的影响了。你的文档的前 14 行长这样: 1

2

3

4

5

6

7

8

9

10

11

12

13\documentclass[a4paper,12pt]{article}

\begin{document}

\title{My First Document}

\author{My Name}

\date{\today}

\maketitle

\pagenumbering{roman}

\tableofcontents

\newpage

\pagenumbering{arabic}

编译并核对文档(可能需要多次编译,下文不赘述)。文档的第一页长这样:第二页:文字处理中文字体支持阅读本文学习 LaTeX 的人,首要学会的自然是 LaTeX 的中文字体支持。事实上,让 LaTeX 支持中文字体有许多方法。在此我们仅给出最 简洁 的解决方案:使用 CTeX 宏包。只需要在文档的前导命令部分添加:1\usepackage[UTF8]{ctex}

就可以了。在编译文档的时侯使用 xelatex 命令,因为它是支持中文字体的。字体效果LaTeX 有多种不同的字体效果,在此列举一部分:1

2

3

4

5

6

7

8\textit{words in italics}

\textsl{words slanted}

\textsc{words in smallcaps}

\textbf{words in bold}

\texttt{words in teletype}

\textsf{sans serif words}

\textrm{roman words}

\underline{underlined words}

效果如下: 在你的文档中添加更多的文本并尝试各种字体效果。彩色字体为了让你的文档支持彩色字体,你需要使用包(package)。你可以引用很多包来增强 LaTeX 的排版效果。包引用的命令放置在文档的前导命令的位置(即放在 \begin{document} 命令之前)。使用 \usepackage[options]{package} 来引用包。其中 package 是包的名称,而 options 是指定包的特征的一些参数。使用 \usepackage{color} 后,我们可以调用常见的颜色:使用彩色字体的代码为1{\color{colorname}text}

其中 colorname 是你想要的颜色的名字,text 是你的彩色文本内容。注意到示例效果中的黄色与白色是有文字背景色的,这个我们同样可以使用 Color 包中的 \colorbox 命令来达到。用法如下:1\colorbox{colorname}{text}

在 \begin{document} 前输入 \usepackage{color}。 在文档内容中输入 {\color{red}fire}。 编译并核对 PDF 文档内容。单词 fire 应该是红色的。你也可以添加一些参数来调用更多的颜色,甚至自定义你需要的颜色。但这部分超出了本书的内容。如果想要获取更多关于彩色文本的内容请阅读 LaTeX Wikibook 的 Colors 章节。字体大小接下来我们列举一些 LaTeX 的字体大小设定命令:1

2

3

4

5

6

7

8

9normal size words

{\tiny tiny words}

{\scriptsize scriptsize words}

{\footnotesize footnotesize words}

{\small small words}

{\large large words}

{\Large Large words}

{\LARGE LARGE words}

{\huge huge words}

效果如下: 尝试为你的文本调整字体大小。段落缩进LaTeX 默认每个章节第一段首行顶格,之后的段落首行缩进。如果想要段落顶格,在要顶格的段落前加 \noindent 命令即可。如果希望全局所有段落都顶格,在文档的某一位置使用 \setlength{\parindent}{0pt} 命令,之后的所有段落都会顶格。列表LaTeX 支持两种类型的列表:有序列表(enumerate)和无序列表(itemize)。列表中的元素定义为 \item。列表可以有子列表。 输入下面的内容来生成一个有序列表套无序列表:1

2

3

4

5

6

7

8

9\begin{enumerate}

\item First thing

\item Second thing

\begin{itemize}

\item A sub-thing

\item Another sub-thing

\end{itemize}

\item Third thing

\end{enumerate}

编译并核对 PDF 文档。列表长这样:可以使用方括号参数来修改无序列表头的标志。例如,\item[-] 会使用一个杠作为标志,你甚至可以使用一个单词,比如 \item[One]。下面的代码:1

2

3

4

5

6

7

8

9\begin{itemize}

\item[-] First thing

\item[+] Second thing

\begin{itemize}

\item[Fish] A sub-thing

\item[Plants] Another sub-thing

\end{itemize}

\item[Q] Third thing

\end{itemize}

生成的效果为注释和空格我们使用 % 创建一个单行注释,在这个字符之后的该行上的内容都会被忽略,直到下一行开始。下面的代码:1

2

3

4It is a truth universally acknowledged% Note comic irony

in the very first sentence

, that a single man in possession of a good fortune, must

be in want of a wife.

生成的结果为多个连续空格在 LaTeX 中被视为一个空格。多个连续空行被视为一个空行。空行的主要功能是开始一个新的段落。通常来说,LaTeX 忽略空行和其他空白字符,两个反斜杠(\\)可以被用来换行。 尝试在你的文档中添加注释和空行。如果你想要在你的文档中添加空格,你可以使用 \vaspace{...} 的命令。这样可以添加竖着的空格,高度可以指定。如 \vspace{12pt} 会产生一个空格,高度等于 12pt 的文字的高度。特殊字符下列字符在 LaTeX 中属于特殊字符:1# $ % ^ & _ { } ~ \

为了使用这些字符,我们需要在他们前面添加反斜杠进行转义:1\# \$ \% \^{} \& \_ \{ \} \~{}

注意在使用 ^ 和 ~ 字符的时侯需要在后面紧跟一对闭合的花括号,否则他们就会被解释为字母的上标,就像 \^ e 会变成 。上面的代码生成的效果如下:注意,反斜杠不能通过反斜杠转义(不然就变成了换行了),使用 \textbackslash 命令代替。 输入代码来在你的文档中生成下面内容:询问专家或者查看本页面的 源代码 获取帮助。表格表格(tabular)命令用于排版表格。LaTeX 默认表格是没有横向和竖向的分割线的——如果你需要,你得手动设定。LaTeX 会根据内容自动设置表格的宽度。下面的代码可以创一个表格:1\begin{tabular}{...}

省略号会由定义表格的列的代码替换:l 表示一个左对齐的列;r 表示一个右对齐的列;c 表示一个向中对齐的列;| 表示一个列的竖线;例如,{lll} 会生成一个三列的表格,并且保存向左对齐,没有显式的竖线;{|l|l|r|} 会生成一个三列表格,前两列左对齐,最后一列右对齐,并且相邻两列之间有显式的竖线。表格的数据在 \begin{tabular} 后输入:& 用于分割列;\\ 用于换行;\hline 表示插入一个贯穿所有列的横着的分割线;\cline{1-2} 会在第一列和第二列插入一个横着的分割线。最后使用 \end{tabular} 结束表格。举一些例子: 1

2

3

4

5

6

7

8

9

10

11

12

13

14

15

16

17

18

19

20

21

22

23\begin{tabular}{|l|l|}

Apples & Green \\

Strawberries & Red \\

Orange & Orange\\

\end{tabular}

\begin{tabular}{rc}

Apples & Green\\

\hline

Strawberries & Red \\

\cline{1-1}

Oranges & Orange \\

\end{tabular}

\begin{tabular}{|r|l|}

\hline

8 & here's \\

\cline{2-2}

86 & stuff\\

\hline \hline

2008 & now \\

\hline

\end{tabular}

效果如下:实践尝试画出下列表格:图表本章介绍如何在 LaTeX 文档中插入图表。这里我们需要引入 graphicx 包。图片应当是 PDF,PNG,JPEG 或者 GIF 文件。下面的代码会插入一个名为 myimage 的图片:1

2

3

4

5

6\begin{figure}[h]

\centering

\includegraphics[width=1\textwidth]{myimage}

\caption{Here is my image}

\label{image-myimage}

\end{figure}

[h] 是位置参数,h 表示把图表近似地放置在这里(如果能放得下)。有其他的选项:t 表示放在在页面顶端;b 表示放在在页面的底端;p 表示另起一页放置图表。你也可以添加一个 ! 参数来强制放在参数指定的位置(尽管这样排版的效果可能不太好)。\centering 将图片放置在页面的中央。如果没有该命令会默认左对齐。使用它的效果是很好的,因为图表的标题也是居中对齐的。\includegraphics{...} 命令可以自动将图放置到你的文档中,图片文件应当与 TeX 文件放在同一目录下。[width=1\textwidth] 是一个可选的参数,它指定图片的宽度——与文本的宽度相同。宽度也可以以厘米为单位。你也可以使用 [scale=0.5] 将图片按比例缩小(示例相当于缩小一半)。\caption{...} 定义了图表的标题。如果使用了它,LaTeX 会给你的图表添加「Figure」开头的序号。你可以使用 \listoffigures 来生成一个图表的目录。\label{...} 创建了一个可以供你引用的标签。实践 在你文档的前导命令中添加 \usepackage{graphicx}。 找到一张图片,放置在你的 LaTeX course 文件夹下。 在你想要添加图片的地方输入以下内容:1

2

3

4

5\begin{figure}[h!]

\centering

\includegraphics[width=1\textwidth]{ImageFilename}

\caption{My test image}

\end{figure}

将 ImageFilename 替换为你的文件的名字(不包括后缀)。如果你的文件名有空格,就使用双引号包裹,比如 "screen 20"。 编译并核对文件。公式使用 LaTeX 的主要原因之一是它可以方便地排版公式。我们使用数学模式来排版公式。插入公式你可以使用一对 $ 来启用数学模式,这可以用于撰写行内数学公式。例如 $1+2=3$ 的生成效果是 。如果你想要行间的公式,可以使用 $$...$$(现在我们推荐使用 \[...\],因为前者可能产生不良间距)。例如,$$1+2=3$$ 的生产效果为如果是生成带标号的公式,可以使用 \begin{equation}...\end{equation}。例如:1

2

3\begin{equation}

1+2=3

\end{equation}

生成的效果为:数字 6 代表的是章节的编号,仅当你的文档有设置章节时才会出现,比如 report 类型的文档。使用 \begin{eqnarray}...\end{eqnarray} 来撰写一组带标号的公式。例如:1

2

3

4\begin{eqnarray}

a & = & b + c \\

& = & y - z

\end{eqnarray}

生成的效果为要撰写不标号的公式就在环境标志的后面添加 * 字符,如 {equation*},{eqnarray*}。Warning 可以发现,使用 eqnarray 时,会出现等号周围的空隙过大之类的问题。 可以使用 amsmath 宏包中的 align 环境: 1

2

3

4

5

6\usepackage{amsmath}

...

\begin{align}

a & = b + c \\

& = y - z

\end{align}

或在行间公式中使用 aligned 环境。它们的名字后面加上星号后,公式就不带标号了。 详见 更多阅读 中第一篇资料的「4.4 多行公式」。数学符号尽管一些基础的符号可以直接键入,但大多数特殊符号需要使用命令来显示。本书只是数学符号使用的入门教程,LaTeX Wikibook 的数学符号章节是另一个更好更完整的教程。如果想要了解更多关于数学符号的内容请移步。如果你想找到一个特定的符号,可以使用 Detexfiy,它可以识别手写字符。上标和下标上标(Powers)使用 ^ 来表示,比如 $n^2$ 生成的效果为 。下标(Indices)使用 _ 表示,比如 $2_a$ 生成的效果为 。如果上标或下标的内容包含多个字符,请使用花括号包裹起来。比如 $b_{a-2}$ 的效果为 。分数分数使用 \frac{numerator}{denominator} 命令插入。比如 $$\frac{a}{3}$$ 的生成效果为分数可以嵌套。比如 $$\frac{y}{\frac{3}{x}+b}$$ 的生成效果为根号我们使用 \sqrt{...} 命令插入根号。省略号的内容由被开根的内容替代。如果需要添加开根的次数,使用方括号括起来即可。例如 $$\sqrt{y^2}$$ 的生成效果为而 $$\sqrt[x]{y^2}$$ 的生成效果为求和与积分使用 \sum 和 \int 来插入求和式与积分式。对于两种符号,上限使用 ^ 来表示,而下限使用 _ 表示。$$\sum_{x=1}^5 y^z$$ 的生成效果为而 $$\int_a^b f(x)$$ 的生成效果为希腊字母我们可以使用反斜杠加希腊字母的名称来表示一个希腊字母。名称的首字母的大小写决定希腊字母的形态。例如$\alpha$=$\beta$=$\delta, \Delta$=$\pi, \Pi$=$\sigma, \Sigma$=$\phi, \Phi, \varphi$=$\psi, \Psi$=$\omega, \Omega$=实践 撰写代码来生成下列公式:如果需要帮助,可以查看本页面的 源代码。参考文献介绍LaTeX 可以轻松插入参考文献以及目录。本文会介绍如何使用另一个 BibTeX 文件来存储参考文献。BibTeX 文件类型BibTeX 文件包含了所有你想要在你文档中引用的文献。它的文件后缀名为 .bib。它的名字应设置为你的 TeX 文档的名字。.bib 文件是文本文件。你需要将你的参考文献按照下列格式输入:1

2

3

4

5

6

7

8

9@article{

Birdetal2001,

Author = {Bird, R. B. and Smith, E. A. and Bird, D. W.},

Title = {The hunting handicap: costly signaling in human foraging strategies},

Journal = {Behavioral Ecology and Sociobiology},

Volume = {50},

Pages = {9-19},

Year = {2001}

}

每一个参考文献先声名它的文献类型(reference type)。示例中使用的是 @article,其他的类型包括 @book,@incollection 用于引用一本书的中的章节,@inproceedings 用于引用会议论文。可以 在此 查看更多支持的类型。接下来的花括号内首先要列出一个引用键值(citation key)。必须保证你引用的文献的引用键值是不同的。你可以自定义键值串,不过使用第一作者名字加上年分会是一个表义清晰的选择。接下来的若干行包括文献的若干信息,格式如下:1Field name = {field contents},

你可以使用 LaTeX 命令来生成特殊的文字效果。比如意大利斜体可以使用 \emph{Rattus norvegicus}。对于需要大写的字母,请用花括号包裹起来。BibTeX 会自动把标题中除第一个字母外所有大写字母替换为小写。比如 Dispersal in the contemporary United States 的生成效果为 ,而 Dispersal in the contemporary {U}nited {S}tates 的生成效果为 。你可以手写 BibTeX 文件,也可以使用软件来生成。插入文献列表使用下列命令在文档当前位置插入文献列表:1

2\bibliographystyle{plain}

\bibliography{references}

参考文献写在 references.bib 里。参考文献标注使用 \cite{citationkey} 来在你想要引用文献的地方插入一个标注。如果你不希望在正文中插入一个引用标注,但仍想要在文献列表中显示这次引用,使用 \nocite{citationkey} 命令。想要在引用中插入页码信息,使用方括号:\cite[p. 215]{citationkay}。要引用多个文献,使用逗号分隔:\cite{citation01,citation02,citation03}。引用格式数字标号引用LaTeX 包含了多种行内数字标号引用的格式:Plain 方括号包裹数字的形式,如 。文献列表按照第一作者的字母表顺序排列。每一个作者的名字是全称。Abbrv 与 plain 是相同的,但作者的名字是缩写。Unsrt 与 plain 是相同的,但文献列表的排序按照在文中引用的先后顺序排列。Alpha 与 plain 一样,但引用的标注是作者的名字与年份组合在一起,不是数字,如 。作者日期引用如果你想使用作者日期的引用,使用 natbib 包。它使用 \citep{...} 命令来生成一个方括号标注,如 ,使用 \citet{...} 来生成一个标注,只把年份放到方括号里,如 。在此 查看它的更多用法。Natbib 包也有三种格式:plainnat,abbrvnat 和 unsrtnat,他们与 plain,abbrv 和 unsrt 的效果是一样的。其他引用格式如果你需要使用不同的格式,你需要在同一个文件夹下创建一个格式文件(.bst 文件),引用这个格式的时侯使用它的文件名调用 \bibliographystyle{...} 命令实现。实践 在同一文件夹下新建一个同名的 BibTeX 文件,用正确的格式输入参考文献的信息。 切换到 TeX 文档,并使用 \cite,\bibliographystyle 和 \bibliograph 命令来引用文献。 编译 TeX 文件。 切换到 BibTeX 文件,并编译(点击 Typeset 按扭) 切换到 TeX 文件并编译它 两次,然后核对 PDF 文档。更多阅读一份(不太)简短的 LATEX 2ε 介绍 https://github.com/CTeX-org/lshort-zh-cn/releases/download/v6.02/lshort-zh-cn.pdf 或 112 分钟了解 LaTeX 2ε.LaTeX Project http://www.latex-project.org/ Official website - has links to documentation, information about installing LATEX on your own computer, and information about where to look for help.LaTeX Wikibook http://en.wikibooks.org/wiki/LaTeX/ Comprehensive and clearly written, although still a work in progress. A downloadable PDF is also available.Comparison of TeX Editors on Wikipedia http://en.wikipedia.org/wiki/Comparison_of_TeX_editors Information to help you to choose which L A TEX editor to install on your own computer.TeX Live http://www.tug.org/texlive/"An easy way to get up and running with the TeX document production system". Available for Unix and Windows (links to MacTeX for MacOSX users). Includes the TeXworks editor.Workbook Source Files http://edin.ac/17EQPM1 Download the .tex file and other files needed to compile this workbook.本文译自 http://www.docs.is.ed.ac.uk/skills/documents/3722/3722-2014.pdf, 依据其他文献略有修改。本页面最近更新:2023/12/22 13:00:38,更新历史发现错误?想一起完善? 在 GitHub 上编辑此页!本页面贡献者:namasikanam, CCXXXI, Enter-tainer, fourdim, grejioh, Haohu Shen, jifbt, mgt, NachtgeistW, opsiff, ouuan, Shen-Linwood, sshwy, StudyingFather, Suyun514, Suyun514, TennousuAthena, Tiphereth-A, Xeonacid, xiangyanhao本页面的全部内容在 CC BY-SA 4.0 和 SATA 协议之条款下提供,附加条款亦可能应用Copyright © 2016 - 2024 OI Wiki Team Made with Material for MkDocs 最近更新:7ff011ae, 2024-03-

刘海洋 · LaTeX 不快速的入门 - 跟着大神学习最纯正的 LaTeX 知识_哔哩哔哩_bilibili

刘海洋 · LaTeX 不快速的入门 - 跟着大神学习最纯正的 LaTeX 知识_哔哩哔哩_bilibili 首页番剧直播游戏中心会员购漫画赛事投稿刘海洋 · LaTeX 不快速的入门 - 跟着大神学习最纯正的 LaTeX 知识

26.3万

1496

2020-03-24 22:04:39

未经作者授权,禁止转载504140991.7万1563刘海洋是《LaTeX 入门》的作者。本内容是刘海洋在北大的 LaTeX 讲座讲稿,应我们的邀请,录制了其讲座的内容,并更新了 beamer 内容,欢迎大家下载学习。 让大牛给我们指路,未来一片坦途。

讲稿的源代码在这里下载:https://www.latexstudio.net/index/details/index/mid/365.html知识野生技能协会视频教程LaTeX

LaTeX_工作室

发消息

微薄:LaTeX工作室 Q群:91940767 email: latexstudio@qq.com

关注 2.0万

最流畅的高清对局,最纯正的爽感枪战视频选集(1/4)自动连播LaTeX中文学习教程(用于论文或稿件排版,15集全)我肛肛好

21.6万

372

Word排版与LaTeX排版 || 排版过程简要对比 || 从Word到LaTeX学习经验 || 简介有福利szuzzh

4.2万

17

LaTeX上这门课就足够了00萌萌站起来00

5.1万

111

跟着我学习 TikZ 绘图 - Graphics in LaTeX with TikZ【英文】LaTeX_工作室

2512

8

Overleaf 具体投稿 一步一步教!!!以Springer Nature为例优姬梗

1.1万

27

【软件教学】复旦大学物理系博士生学长的经验分享—LaTeX教学(直播回放)爱要研之有理

3317

2

LaTeX中文教程 1-4 共8集Anna1918

12.6万

673

【豪底狄】我个人推荐的 LaTeX 撰写 IEEE 论文的过程豪底狄

2.0万

1

LaTex插图中绝对路径与相对路径详解xiaoxie5002

1.0万

2

【latex七分钟速成】七分钟学会如何用latex莽出一篇好论文深情但饭桶

4.4万

30

半小时学会Latex(非标题党)数学考研甲乙

3.0万

15

如何用latex模板和Overleaf写论文托儿所所长亚索

7734

7

LaTeX视频教程(基于CTEX中文套装+WinEdt)james-fang

6.3万

150

Latex入门教程龙伟旗

1.4万

16

LaTeX进阶 ---宏包编写格格污啊哈哈哈

3381

0

【LaTeX】半个小时学会使用 LaTeX 模板日有寸进

4.9万

36

LaTeX 从入门到够用(5)PPT Beamer 的使用六边形游乐场

4.3万

4

系统学Latex排版文档类和正文1杂事分享君

2545

2

Texstudio 八分钟快速上手Kai-Y-

4.3万

50

【小白向】LaTeX从入门到会写—(1)TeX的基础知识小风寒呐

4.6万

210

展开

小窗

客服

顶部

赛事库 课堂 2021

LaTeX中文学习教程(用于论文或稿件排版,15集全)_哔哩哔哩_bilibili

LaTeX中文学习教程(用于论文或稿件排版,15集全)_哔哩哔哩_bilibili 首页番剧直播游戏中心会员购漫画赛事投稿LaTeX中文学习教程(用于论文或稿件排版,15集全)

21.6万

372

2019-04-01 11:35:12

25929851.2万1293https://space.bilibili.com/7545573

LaTeX(LATEX,音译“拉泰赫”)是一种基于ΤΕΧ的排版系统,由美国计算机学家莱斯利·兰伯特(Leslie Lamport)在20世纪80年代初期开发,利用这种格式,即使使用者没有排版和程序设计的知识也可以充分发挥由TeX所提供的强大功能,能在几天,甚至几小时内生成很多具有书籍质量的印刷品。对于生成复杂表格和数学公式,这一点表现得尤为突出。因此它非常适用于生成高印刷质量的科技和数学类文档。知识校园学习学习教育课程视频教程公开课线上课堂

我肛肛好

发消息

不时更新生物技术,生物统计&生物信息,基础医学实验教程,包括搬运

关注 8.0万

最流畅的高清对局,最纯正的爽感枪战视频选集(1/15)自动连播【LaTeX入门教程】论文排版不是问题!所剩i

2.4万

18

西南大学数统院本科毕业论文Latex模板的使用乔木近旁的木棉

4706

1

毕业论文格式排版教程全流程演示天边的离人

14.3万

87

Latex写出漂亮的毕业论文-武汉理工大学神秘人_zZ

4.5万

70

[LaTeX]实时预览教程II-LaTeX公式编辑好用插件推荐(HyperSnips) 安装及配置Phy_Duck

1844

2

如何用latex模板和Overleaf写论文托儿所所长亚索

7734

7

系统学Latex之标题样式设置(重制版)杂事分享君

3826

1

上海师范大学研究生毕业论文 LaTeX 模板使用教程Andy123t

4263

2

系统学Latex之图片的插入和设置杂事分享君

1.5万

2

系统学Latex之页眉和页脚的设置杂事分享君

4872

2

啊?你还用word!赶紧来学神器LaTex吧!理科宅Hunt

4745

0

Word论文排版教程冰冷的希望123

51.7万

594

Latex详细教程小邓子分享官

8493

12

超简单的latex论文排版速成饭后人感动

2.3万

6

LaTeX 入门资料推荐与 LaTeX 模板分享Andy123t

3477

1

LaTeX使用教程算命胡半仙

2119

1

07-latex插入图片咖啡文化数学茶

5745

1

Latex数模论文排版实例杂事分享君

3866

3

overleaf(在线LaTeX编辑器)之导入模板棒棒的小曹

2793

0

15分钟搞定毕业论文排版承诺丶谎言

9.5万

13

展开

小窗

客服

顶部

赛事库 课堂 2021