LaTeX学习1:第一份文档

LaTeX 学习1:第一份文档

\documentclass{amsart}
\begin{document}
some content, and this is the body of your article
\end{document}

以上是最基本的LaTex语句,可以用来输出一份amsart格式的文档,在编辑语句的时候,经常会用到emphasize, and 将语句放在中间.也可以左对齐(flushleft),或者右对齐(flushright)

\emph{content is different with the words around}
\begin{center}
    content is in the center
\end{center}

\begin{flushleft}
content is left aligned
\end{flushleft}

\begin{flushright}
		content is right aligned
\end{flushright}

一些基本的打印字母的语句都是直接打印,这里介绍一下对应的英文。这些字母大多用于文本的编辑的标点,对于数学以及double quote则是不能直接用。double quote则是用两个apostrophes来表示。

+(pluse), =(equals), /(backslash), ( left parenthese, 
 [ square bracket],  ,comma, ; semicolon,  : colon, 
 .dot, ?question mark, ' single quote', "double quote", -hyphen
 'apostrophes
  a-z A-Z  0-9 + = * / ( ) [ ] 
  ,;. ? ! : ' ' -

!!!LaTeX本身断行是用的一个空白的行(blank paragraph),或者使用的\par来表示,文本如果没有这两个表示没有断行。文字间的空白(blank spaces)则是只认一个。对于interword space和intersentence space是不同的,可以使用+white space 来增加一个interword space, 也可以用tilde(~)来增加,但是tilde会将后面的文字放在放一个行中(tie, or nonbreakable space).

  %这是注释,同Matlab一样

给文章添上linenumber

\usepackage{lineno}
\linenumbers

一些特殊的符号,在LaTeX中,有一些符号有专门的语句,比如我们会用today来打印当下的日期,而不是自己手打,会有一些去别的。比如

\LaTeX, \today % LaTeX symbol and show the date of today

一些字体,比如bold face, emphize text, typewriter style text,这些是用于一个句子(当然也可以用于一个单词),我们把这种带有参数的命令叫做 command with argument.对于这种命令,当遇到一个non-alphabetic letter的时候,也就是不是a-z, A-Z,则认为command的名字完了,后面就是语句或者argument.

\textbf{bold face}, \emph{emphized text}, \texttt{typewrite style text}
% typewriter is triple t's.

hyphen(-)的用法,single hyphen用来截断超过句子长度的单词

 double hyphen(called en dash): -- for number range
 triple hyphen(called em dash):--- for punctuation mark

当一个句子太长(Line too wide)的时候,看起来很不协调,尤其是当自己需要排版(typeset)一本书的时候,看起来非常的乱,这时候我们需要使用hyphen去截断,或者重新构思句子。可以加一些可选的截断(optional hyphenation)

hamil\-tonian-reduced.

如何排版公式:LaTeX最主要的作用是用来排版科技文献的,其他还有写LectureNote 或者做representation的时候我们会用,当然在国外还会要求用LaTeX来写作业,这会有模板,我们之后会讲到。排版数学符号需要注意两点:第一,单个字母,比如空间的V,在LaTeX里面是需要用$ V$来表示的, 第二点就是公式的分类,第三个就是sin这种函数要用\sin,而不是自己手打。

1st: inline formula: in a sentence or a line, use  $content$
2nd: displayed math formula: in a single row or line
% for 2nd type: use \[ formula \] 或者\ begin{equation} \ end{equation}

!!!在displayed formula后面是没有blank line的
lim ⁡ , ∞ , → \lim, \infty,\to lim,,是极限(limit)里面常用的符号,分别使用(记得加dollar $)

\lim, \infty, \to

∑ k = 1 n , ∏ k = 1 n \sum_{k=1}^{n}, \prod_{k=1}^n k=1n,k=1n是和(sum), 乘积(product),其中_(underscore)是用来下标(subscript), ^(hat)是用来上标(superscript), 都是script。只有一个例外,就是一阶导数(first derivative)的时候,我们直接使用apostrophes。

\sum_{k=1}^{n},      \prod_{k=1}^n

在数学环境里面是没有space的,除了两种情况

 $\infty a$, % space that terminate the cmd
 \text{spaces here are not ignored}

对于分数(fraction), 由分子(numerator)以及分母(denominator)组成,比如
1 2 \frac{1}{2} 21,则用

\frac{1}{2}

基本的加(addition),减(subtraction),乘(multiplication),除(division),我们称之为arithmetic,直接写就可以了 a + b a+b a+b, a − b a-b ab, a ∗ b a*b ab, a / b a/b a/b,如果要使用叉乘(cross product), a × b a \times b a×b 读作a times b, − a -a a

$a+b$, $a-b$, $a*b$,$a/b$,$a \times b$, $-a$

二项式数(binomial coefficient), 比如 ( n k ) n \choose k (kn), 读作 n choose k,所以有两种方法,

1st: $\binom{n}{k}$
2nd: $n \choose k$

同余(congruence,有时候又翻译为合同,相似三角形的相似),有两种版本,一种由mod,另一种没有mod。举个例子
a ≡ b ( m o d θ ) a \equiv b \pmod \theta ab(modθ)
a ≡ b ( θ ) a \equiv b \pod \theta ab(θ)

$a \equiv b \pmod \theta$
$a \equiv b \pod \theta$

这里抽空介绍一下希腊字母(Greek letter), 在数学当中,有各种各样的字母,但是我们最常用的还是Greek letter,这里介绍一些最基本的Greek letter
唯一觉得要强调的就是\nu,和\iota,iota有时候会认为是线性算子(linear operator)里面的identity operator.
Delimiters: 就是放大的parentheses,大括号(curly braces), square bracket.

\[
  \left (   formula   \right)
\]

省略号(ellipses),有好几种,数学中的ellipses只有三个点,为low or on-the-line dots.
( x 1 , … , x n ) (x_1, \dots, x_n) (x1,,xn) 或者 x 1 + ⋯ + x n x_1 + \dots + x_n x1++xn。\dots有时候居中,有时候是low dots, 我们可以使用\cdots, \ldots.

$(x_1, \dots, x_n)$ ,  $x_1 + \dots + x_n$

积分(integral), !!!注意在被积函数(integrad)后面添加一个 ,举例: ∫ 0 π sin ⁡ x   d x = 2 \int_0^\pi \sin x \, dx=2 0πsinxdx=2

$\int_0^\pi \sin x \, dx=2$

Math Accent: 这个其实不多见,画circle有时候还有用,了解就好
a ˉ \bar{a} aˉ
a ~ \tilde{a} a~
a ⃗ \vec{a} a
a ^ \hat{a} a^

$\bar{a}$
$\tilde{a}$
$\vec{a}$
$\hat{a}$ 

在数学环境下画矩阵,矩阵的本质是一个table(没有delimiter),有时候用parentheses,有时候用竖线(vertical line)比如行列式(determinant),有时候用square bracket.三点:

  • 在数学环境([ ])或者\ begin{align} \ end{align}里面使用
  • 除却最后行,每一行都要由double backslash
  • 每一列(column)都要用&(ampersand)对齐
    1 2 3 4 5 6 \begin{matrix} 1 & 2 & 3\\ 4 & 5 & 6 \end{matrix} 142536
\[
 \begin{matrix}
   1 & 2 & 3\\
   4 & 5 & 6
\end{matrix}
\]

( 1 2 3 4 5 6 ) \begin{pmatrix} 1 & 2 & 3\\ 4 & 5 & 6 \end{pmatrix} (142536)

\[
 \begin{pmatrix}
   1 & 2 & 3\\
   4 & 5 & 6
\end{pmatrix}
\]

∣ 1 2 3 4 5 6 ∣ \begin{vmatrix} 1 & 2 & 3\\ 4 & 5 & 6 \end{vmatrix} 142536

\[
 \begin{vmatrix}
   1 & 2 & 3\\
   4 & 5 & 6
\end{vmatrix}
\]

[ 1 2 3 4 5 6 ] \begin{bmatrix} 1 & 2 & 3\\ 4 & 5 & 6 \end{bmatrix} [142536]

\[
 \begin{bmatrix}
   1 & 2 & 3\\
   4 & 5 & 6
\end{bmatrix}
\]

sin x 应该用 \sin x,因为我们称sin 为operator
根(root), 举一个例子 2 n \sqrt[n]{2} n2 或者 2 \sqrt{2} 2 ,这里的【n】叫做optional argument,可有可无的,没有的话通常是默认为最常见的情况。

$\sqrt[n]{2}$  $\sqrt{2}$

然后就是在数学环境里面写文字了,之前提及到在数学环境里面直接写文字,space是没有的,所以我们会用\quad 去增加一点空间。

\text{\quad content}

比如
a = b by assumption a=b \text{\quad by assumption} a=bby assumption

\[
   a=b \text{\quad by assumption}
\]

然后就是对于displayed formula的一些技巧了,一般来说,当我们需要引用等式(equation)的label的时候,我们不会单纯的使用\ [ \ ],我们会使用\ begin{equation}和\ end{equation},举个例:

\begin{eqaution} \label{E:firstIntegral}
 \int_0^\pi \sin x \, dx =2
\end{equation}

这里面的numbering是在整个article里面,而且是在公司的左边,如果写书的话,numbering within each section的话,我们可以在premeable里面加入

\numberwithin{equation}{section}

对于equation,我们还有asterisk version,就是不带标号的

\begin{equation*}
 formula
\end{equation*}

引用(reference)是写文章可以来说非常重要的部分,可以引用自己的公式,某一页,或者cite参考文献

see~(\ref{E:firstIntegral} on page~\pageref{E:firstIntegral} %or
see~(\eqref{E:firstIntegral} on page~\pageref{E:firstIntegral}
\cite{bibitemName}

Absolute referencing: 就是不引用numbering, 而是引用一个the name of this formula, 我们需要先给equation一个tag (name),然后引用tag

\begin{eqaution} 
 \int_0^\pi \sin x \, dx =2 \tag{Int}
\end{equation}

公式对齐(aligned formula),比如分段函数piecewise function, axiom,还有其他的一些情况,举例说明:注意除最后一行外都需要double slash,如果有label,则需要写在double slash之前

\begin{align}
r^{2} &=s^{2}+t^{2}\label{E:firstEquation}\\ 
2u+1 &=v+w^{\alpha} \label{E:secondEquation}
\end{align}

写一个超长的数学公式,需要使用align来分开,\notag可以去掉多余的numbering.如果都不用numbering,则使用asterisk version of align.

\begin{align}
h(x)   &= \int \left( \frac{f(x) + g(x)}{1+ f^{2}(x)}
+ \frac{1+ f(x)g(x)}{\sqrt{1 - \sin x}}
\right) \, dx\label{E:longInt}\\%\eqref{E:longInt}
       &= \int \frac{1 + f(x)}{1 + g(x) } \, dx
- 2 \tan^{-1}(x-2)\notag
\end{align}

annotated alignment,也就是有注释的对齐,一般就是对齐注释,当然顺便可以对齐公式

\begin{align}
	x &= x \wedge (y \vee z) 
	&&\text{(by distributivity)}\label{E:Align} \\
	  & =(x \wedge y) \vee(x \wedge z)
	 &&\text{(by condition (M)} \notag \\
	 &=y \vee z \notag
\end{align}

其中\wedge是 ∧ \wedge , \vee是 ∨ \vee .,接下来就是piecewise function,我们会使用不同的case,所以我们会使用到

\begin{case}

\end{case}
\[
	f(x)=
	\begin{cases}
		-x^{2}, 	&\text{if $x < 0$;}\\
		\alpha + x, &\text{if $0 \leq x \leq 1$;}\\
		x^{2}, 		&\text{otherwise.}
	\end{cases}
\

有几点注意:除却最后一个case,其他我们都要加上double slash, f ( x ) f(x) f(x)需要写在begin的前面,写矩阵也是这样的,而且矩阵的字母要用textbf格式
\quad 文章的结构(the anatomy of a document),文章需要有作者(author),有邮箱(email),地址(address包含自己所在的学校部门或者单位),有可能还需要写致谢(thanks),写脚注(footnote),写摘要(abstract),然后就是文章的主体(body),以及后面的参考文献(bibliography)了。
对于source file,则可以分为几个部分,premeable(everything from the first line to begin{document}), body(all things between begin{document} and end{document}),body还有分类,对于介绍个人信息以及致谢还有\makefile 我们称之为top matter, 文章主题内容叫做main matter,参考文献叫做back matter.

\documentclass{...}
\usepackage{...}
...
%all cmds above are called premeable
\begin{document}
\title{}
\author{}
\address{}
\date{} % or \today
\begin{abstract}
  ...
\end{abstract}
%top matter

\section{}
...
\section{}
%main matter

\begin{thebibliography}{9}
...
\end{thebibliography}
%back matter
\end{document}

举个例子:下面是我粘贴More math into LaTeX里面的first article,在代码中我们解释这些东西

\documentclass{amsart}

\usepackage{amssymb,latexsym}

\newtheorem{theorem}{Theorem}

\begin{document}
\title{A technical result\\ for congruences of finite lattices}  
\author{G. Gr\"atzer} 
\address{Department of Mathematics\\
  University of Manitoba\\
  Winnipeg, MB R3T 2N2\\
  Canada}
\email[G. Gr\"atzer]{gratzer@me.com}
\urladdr[G. Gr\"atzer]{http://tinyurl.com/gratzerhomepage}
\date{March 21, 2015}
\subjclass[2010]{Primary: 06B10.}
\keywords{finite lattice, congruence.}
\begin{abstract}
We present a technical result for congruences on finite lattices.
\end{abstract}
\maketitle

\section{Introduction}\label{S:Introduction}%Section~\label{S:Introduction}
In some recent research, G. Cz\'edli
and I, see \cite{gC13} and \cite{gG14}, spent quite an effort
in proving that some equivalence relations 
on a planar semimodular lattice are congruences. 
The number of cases we had to consider
was dramatically cut by the following result.

\begin{theorem}\label{T:technical}%Theorem~\ref{T:technical}
Let $L$ be a finite lattice. 
Let $\delta$ be an equivalence relation on $L$
with intervals as equivalence classes.
Then $\delta$ is a congruence relation if{}f 
the following condition and its dual hold:
\begin{equation}
\text{If $x$ is covered by $y,z \in L$ 
and $x \equiv y \pmod{\delta}$,
then $z \equiv y + z \pmod{\delta}$.}\tag{C${}_{+}$}
\end{equation}
\end{theorem}

\section{The proof}\label{Proof}%Section~\label{S:Proof}
We prove the join-substitution property:  
if $x \leq y$ and $x \equiv y \pmod{\delta}$, then
\begin{equation}\label{E:Cjoin}%\eqref{E:Cjoin}
x + z \equiv y + z \pmod{\delta}.
\end{equation}
Let $U = [x, y+ z]$.
We induct on length\,$U$, the length of $U$.  

Let $I=[y_1,y+ z]$ and $J=[z_1,y+ z]$. 
Then length\,$I$ and length\,$J  < $ length\,$U$. 
Hence, the induction hypothesis applies to $I$ 
and $\delta\rceil I$, and we obtain that 
$w \equiv y+ w \pmod{\delta}$. 
By the transitivity of $\delta$, we conclude that 
\begin{equation}\label{E:three}%\eqref{E:three}
z_1 \equiv y+ w \pmod{\delta}.
\end{equation}
Therefore, applying the induction hypothesis to $J$ 
and $\delta \rceil J$, we conclude \eqref{E:Cjoin}.

\begin{thebibliography}{9}
\bibitem{gC13}%G. Cz\'edli~\cite{gC13}
G. Cz\'edli,
\emph{Patch extensions and trajectory colorings of slim
rectangular lattices.}
Algebra Universalis \textbf{88} (2013), 255--280. 

\bibitem{gG14}%G. Gr\"atzer \cite{GS13}
G. Gr\"atzer, 
\emph{Congruences of fork extensions of lattices.}
Acta Sci. Math. (Szeged), \textbf{57} (2014), 417--434. 
\end{thebibliography}
\end{document}

在这里插入图片描述
定义自己的命令,这是一个非常常用的,将文字(文字环境下定义为数学环境下的),或者多个语句定义为一个语句,有时候我们需要定义一个新的数学符号就需要这个语句。

\newcommand{\pdelta}{\pmod{\delta}}
\DeclareMathOperator{\length}{length}
$x \equiv y \pmod {\delta}$
$x \equiv y \pdelta$
length\, $U$
$\length U$

添加插图(add the illustration),需要\usepackage{graphicx}而且\label需要放在\caption后面。

\usepackage{graphicx}
\begin{figure}[hbt]
{centering
   \includegraphics{covers}}
\caption{Theorem~\ref{T:technical} illustrated}\lebel{F:Theorem}
\end{figure}

接下来就是beamer,这是很多人学习LaTeX的初衷,因为开组会需要(hhh)






  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值