当今做那些网站能致富各大搜索引擎入口
Latex on overleaf入门语法
- 前言
- 基本结构
- 序言
- 简单的格式化命令
- 添加注释:%
- 加粗、斜体、下划线
- 有序列表、无序列表
- 添加图片
- 图片的标题、标签和引用
- 添加表格
- 一个简单的表格
- 为表格添加边框
- 标题、标签、引用
- 数学表达式
- 基本的数学命令
- 基本格式
- 摘要
- 段落、新行
- 章节、分段
- 引用参考文献
前言
感谢参考文献:
Overleaf 指南:30 分钟 LaTeX 入门
基本结构
\documentclass{article} % 声明文档的类型为article\begin{document}
First document. This is a simple example, with no
extra parameters or packages included.
\end{document}
\documentclass{article}
:声明文档的类型为article。- begin前面:文档的序言。
- begin和end之间是文档的主体body。
序言
定义文档的字体大小,纸张大小,文档编码为utf-8。
\documentclass[12pt, letterpaper]{article}
\usepackage[utf8]{inputenc}
序言中还可以添加标题、作者和日期。在主体body中可以打印这些信息,使用\maketitle
。
\title{First document}
\author{Hubert Farnsworth \thanks{funded by the Overleaf team}}
\date{February 2017}
简单的格式化命令
添加注释:%
加粗、斜体、下划线
强调文本命令:展现的效果取决于上下文,斜体or普通文本。
加粗:\textbf{}
下划线:\underline{}
斜体:\textit{}强调文本:\emph{}
有序列表、无序列表
使用不同的环境 environment来创建不同形式的列表,环境以\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}
有序列表使用enumerate
环境。
\begin{enumerate}\item This is the first entry in our list\item The list numbers increase with each entry we add
\end{enumerate}
添加图片
\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}
- 添加图片需要使用包 package,在序言中添加
\usepackage{graphicx}
表示导入包,\graphicspath{{images/} }
表示图像所在的根目录为:当前目录下名为 images 的文件夹中。 \includegraphics {universe}
:在文档中引入图像。图像文件名不带扩展名,文件名不应该包括空格和多个点。
图片的标题、标签和引用
\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.
- 将图片放在 figure 环境中,才可以添加标题、标签和引用。具体命令为:
\begin{figure}[h]
和\end{figure}
。 \caption{}
:为图片设置标题。此命令可以放在图片的上方或下方。\label{fig:mesh1}
:为图片设置标签,标签可以为图片编号,方便后续在文章中引用该图片。\ref{fig:mesh1}
:编译后显示被引用图片的编号。
添加表格
一个简单的表格
创建表格的默认环境是tabular
,必须给该环境传递一个参数{c c c}
。该参数表示表格有 3列,每列文本均居中。除了c
,还有r
表示右对齐,l
表示左对齐。
&
表示分隔符,\\
表示转到表格的下一行。
\begin{center}
\begin{tabular}{ c c c }cell1 & cell2 & cell3 \\cell4 & cell5 & cell6 \\cell7 & cell8 & cell9
\end{tabular}
\end{center}
为表格添加边框
\begin{center}
\begin{tabular}{ |c|c|c| }\hlinecell1 & cell2 & cell3 \\cell4 & cell5 & cell6 \\cell7 & cell8 & cell9 \\\hline
\end{tabular}
\end{center}
\hline
:水平线命令,插入一条水平线。{ |c|c|c| }
:|
表示垂直线分隔。
标题、标签、引用
Table \ref{table:data} is an example of referenced \LaTeX{} elements.\begin{table}[h!]
\centering
\begin{tabular}{||c c c c||}\hlineCol1 & Col2 & Col2 & Col3 \\ [0.5ex]\hline\hline1 & 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}
\caption{}
:标题。\label{table:data}
:标签。\ref{table:data}
:引用。
数学表达式
数学表达式有两种模式:内联模式 inline,显示模式 display。
内联模式:公式是文本的一部分。以下3种定界符作用相同。
$...$
\(...\)
\begin{math}...\end{math}
显示模式:编号和非编号。
# 编号
\[... \]# 非编号
\begin{equation} ... \end{equation}
equation环境由外部包 amsmath提供。许多数学表达式都使用了这个包。
基本的数学命令
上标:$a^2$
下标:$H_2O$
积分:$\int$
分数:$\frac{a}{b}$
小写希腊字母:$\omega$ $\delta$
大写希腊字母:$\Omega$ $\Delta$
数学运算符的前缀为反斜杠:$\sin(x)$, $\cos(x)$, $\log(x)$
基本格式
摘要
摘要内容要在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}
段落、新行
开启新段落,需要输入两次 Enter键,以插入双空行。此时,Latex会为新段落自动缩进。
章节、分段
基本的标题级别如下所示,从上到下为从大到小的标题。在{}
内设置标题,标题的编号是自动的。也可以在命令中加*
来禁止编号。
\section{section}
\subsection{subsection}
\subsubsection{subsubsection}
\paragraph{paragraph}
\subparagraph{subparagraph}\section*{Unnumbered Section}
引用参考文献
参考博客:
overleaf Latex bibtex单篇及多篇参考文献引用设置
overleaf使用bib tex引用参考文献教程
祖传用法:
\usepackage{cite}
\def\BibTeX{{\rm B\kern-.05em{\sc i\kern-.025em b}\kern-.08emT\kern-.1667em\lower.7ex\hbox{E}\kern-.125emX}}\bibliographystyle{IEEEtran}
\bibliography{ref}引用命令: \cite{ref1}