; k+ y2 F: K$ E4 g8 F( @2.第一个文档 * } z Z% B! M! Z' |9 s打开WinEdt,建立一个新文档,将以下内容复制进入文档中,保存,保存类型选择为UTF-8。 % F0 z3 E( i `3 U) y: Q' }5 W+ k) W( Q' S
\documentclass{article} 0 q; L8 Y, C/ K/ x f
\begin{document} 7 D( E, ]* i, E hello, world , d- w- }7 I& ~6 [/ m. k c\end{document} 2 q$ m' H* C. q% S
2 W( G! S3 s+ S% r7 v3.标题、作者和注释 7 i/ L8 a0 @: j; R$ u建立一个新文档,将以下内容复制进入文档中,保存,保存类型选择为UTF-8,编译并观察现象。 4 c p: I1 N/ A$ G( n0 q2 v% u6 Q+ M& E& y9 v: @
\documentclass{article} 3 T0 s" [: w2 x) x& s; G3 \
\author{My Name} * d+ \0 ]3 C: u; a1 ^ \title{The Title} + q" m3 v. O8 Z, K4 s% \8 @
\begin{document} ; T: P, J* ^$ |* g7 f5 O S* S \maketitle 8 x6 Q$ q$ v/ K, b, K( M: r
hello, world % This is comment - S3 l n! l: r) g\end{document} , u: I. p( b" n. v! L2 a%意为本行右边所有内容被注释掉,在生成的pdf中不会显示。 ' V9 W( n8 R; X9 U- B 5 F f4 V' q! z; Y4 s" M4.章节和段落 - y# g1 M0 B0 u8 q2 `2 Z建立一个新文档,将以下内容复制进入文档中,保存,保存类型选择为UTF-8,编译并观察现象。 ; Z* K; S3 C2 X+ d& u% Y2 S/ m. ~3 n1 t- e; Q& e1 w) ~& ~
\documentclass{article} ' s' c9 k+ q9 a! ]6 I
\title{Hello World} " H4 p8 {" }+ Q# Q4 t4 Y, B6 g
\begin{document} + B4 `# D) p! C
\maketitle : s' I, _5 Q2 k, E" I, ?: {
\section{Hello China} China is in East Asia. 4 Q5 n6 t/ z+ C* u" X6 P
\subsection{Hello Beijing} Beijing is the capital of China. ; X- p5 {7 A- m( a' ]0 V% Q" r \subsubsection{Hello Dongcheng District} , P- l( w* j% X' F! I \paragraph{Tian'anmen Square}is in the center of Beijing 2 z# ?1 v1 ]! H0 b \subparagraph{Chairman Mao} is in the center of Tian'anmen Square 8 m% w* y9 }5 K \subsection{Hello Guangzhou} / b* H8 z5 a# k
\paragraph{Sun Yat-sen University} is the best university in Guangzhou. * U" H& u* W1 u0 o- N5 i, g+ ~7 P
\end{document} - M% T W6 _9 C3 F9 Z+ j# N. l" Z2 [" R* {; h
退格只是为了看起来层次清晰美观。实际操作上未必要如此,每一行之前的空格不影响编译生成PDF的排版结果。 # P3 f# v1 Q" G3 q& N* `- h ; V- w+ k8 @& W) l" t7 a h1 \5.加入目录 5 D' g5 W1 N1 p; a" E# w
建立一个新文档,将以下内容复制进入文档中,保存,保存类型选择为UTF-8,编译并观察现象。 & w: \1 S7 L1 O. v( E
: Y4 x( M x9 B9 \. j7 k; j' L\documentclass{article} 1 E' M7 m4 a% N; c6 C u: i9 i9 I
\begin{document} # E. ^5 I7 K8 I5 w; Z) S" n" | \tableofcontents % _: d4 M. k; T) Z3 D4 ? \section{Hello China} China is in East Asia. : s( G0 ?' S7 r! x% D- d: d5 C \subsection{Hello Beijing} Beijing is the capital of China. ! k7 n* p/ ^9 E. ]6 t' J3 Y7 }
\subsubsection{Hello Dongcheng District} " j& ^/ Y' z* r) |. ~( P
\paragraph{Hello Tian'anmen Square}is in the center of Beijing 9 G F! @" R2 b- z6 U
\subparagraph{Hello Chairman Mao} is in the center of Tian'anmen Square ' y" F5 |# k! A( h+ Q\end{document} s) U- \3 u" r7 r: k + k1 ]: w g+ E" O( A. R8 V, k2 ?6.换行 ( S/ w- [+ h7 g. u6 _1 m5 P建立一个新文档,将以下内容复制进入文档中,保存,保存类型选择为UTF-8,编译并观察对比现象。 / s" u$ f5 }' \0 g% ] ) g1 s+ u4 k) \( i9 _6 M' j\documentclass{article} ) t: Z) c% d5 g( C" u. {\begin{document} + |, I+ t d. P9 ?
Beijing is $ W8 |* U* x4 m% Z" b the capital # ^% p. ~/ A3 }$ o
of China. , T, c) L9 p3 k$ r4 e; y R) `6 Q 9 I. Q! z9 B" ~- o* V2 {6 o Washington is ) l. H4 @4 X$ l' M0 A9 O8 v
2 B$ e! Z ]2 Q
the capital 4 d* C+ |1 f+ ~4 E | $ `5 T3 n6 B4 B& z) L/ T! ]4 _ of America. ) Z/ u$ J) H* m* g% z6 X& O( O
. b8 G9 S" X5 C% i7 J( Z4 m Amsterdam is \\ the capital \\ ' J9 i0 T4 B( R- l" }" S, L. M of Netherlands. 7 A: K7 f- k. v, }& \\end{document} ( q- L5 ]& `+ x% j# _: j. B! G3 J5 a* X/ C
空一行为另起一段,\\为段内强制换行。$ b1 X; G( C7 W$ R
我对之前手滑写出New York is the capital of America这类低级错误表示非常抱歉。- U% o* G; r: a( ?
# \9 S; |; I- {7.数学公式 $ A7 L: ^; b9 _
建立一个新文档,将以下内容复制进入文档中,保存,保存类型选择为UTF-8,编译并观察对比现象。 ' |( G, S/ N! q6 }/ t, N( K& ]: q$ h7 u
; Q* ]9 K: c9 t) p) ^7 q) k
\documentclass{article} ( v/ q, a5 ~1 h$ o \usepackage{amsmath} - ^( z8 x8 p, [( n/ K
\usepackage{amssymb} $ O! w! e: h0 J" M: j
\begin{document} . V, @5 C# @9 T6 Z8 I+ D
The Newton's second law is F=ma. 2 i- d) U6 ?* [" T) r- T. L
7 ?9 p: \8 a/ F
The Newton's second law is $F=ma$. 6 H; z7 F+ X8 Q' C! ]% U. ~0 W5 E, n4 q' k. K8 ?
The Newton's second law is + P# {6 @% m) H) D $$F=ma$$ @/ x9 h B3 @0 V9 u3 |9 G8 p9 l7 x
) A- _% i+ R6 G0 h
The Newton's second law is 4 X& A4 h( ^( w# R
\[F=ma\] 5 `. c4 G; X, [( z# u & j b1 a6 N$ M9 e/ ]* P! D Greek Letters $\eta$ and $\mu$ - Z% D [1 n, y8 s1 v( q ) T5 w1 l1 Y6 i' o* u0 d9 J Fraction $\frac{a}{b}$ 6 _& i# j9 D! R4 d& [
7 E" U- `( b7 S) D0 J' }2 w. \ Power $a^b$ 3 m5 U4 x5 }$ {$ a! R9 r8 Z G- W4 z* G- J0 @# d, ^3 ?3 n3 G Subscript $a_b$ ) L1 p8 a" K0 `3 v4 I% O# G( Z3 g- f6 X- d
Derivate $\frac{\partial y}{\partial t} $ " r+ v3 M0 l$ @/ T0 v+ w 5 J7 Z2 n0 A/ x. R6 \ Vector $\vec{n}$ ! ?+ Q2 \0 H% A' } 7 c- P, ]/ A0 p' K8 Z" Y4 g, @; R. x- N3 X Bold $\mathbf{n}$ , Y$ G6 I# U/ ^+ A9 k! V( e. C 0 l2 N6 O) L' \* d. q; [: _9 o To time differential $\dot{F}$ 2 p* o6 L6 ?# \3 I
" j& n7 x2 M% T! c+ | O6 \ Matrix (lcr here means left, center or right for each column) / A& L* d I3 X5 P, [5 l, M8 C. `. D
\[ & d$ [) [4 T4 P# |- K' |3 q \left[ / w8 t1 C2 n( q7 x4 ` \begin{array}{lcr} ; m4 ?; Q1 q$ `# A+ s
a1 & b22 & c333 \\ - J: [) U' k$ s+ N d444 & e555555 & f6 3 z% ~, v; B/ g& Y, I1 L \end{array} * f" L+ m4 T7 i- g* ~ \right] 2 S& B( h$ g) `$ k2 v5 e" t* c \] 4 G$ u# q" c: [/ Y% o1 x
* U1 o7 Y% @! N( D- ^7 p$ pEquations(here \& is the symbol for aligning different rows) % H C+ X+ u/ N\begin{align} 1 l3 x/ y% e) n/ t5 K: i4 z
a+b&=c\\ L6 n3 V- N8 N% @' j/ B- s% p0 J+ U; N d&=e+f+g ) v7 ~9 @- N* x$ t5 z# c
\end{align} 2 t3 `" R/ e6 e
9 A' S" R7 F' _; ~\[ p4 P7 Z- b" W& {( v% J3 v9 i
\left\{ 0 v- h! I7 U7 X \begin{aligned} ' ~; e4 ^7 f- ^% K5 G
&a+b=c\\ % E; I+ V8 |- j% v: a# [$ e8 a &d=e+f+g 4 g9 u7 }+ v5 `. n \end{aligned} 1 _( T& U9 m. ^% K \right. 4 O& h% j( q5 a7 f# d7 Z0 F8 f\] ; v1 @( v( J0 ~+ `7 H# I) G% W; A9 o) U- Z
\end{document} 4 l; g& ~, o! G) t 0 `$ S' I8 W3 c; @0 H. ?9 T, u具体细节可以自行搜索LaTeX的数学符号表或别人给的例子。 0 |$ w) U9 z! c' i; t& `7 u5 G. A7 G$...$是开启行内数学模式,用于和文本合在一起使用。 1 w4 O* Z- e, D: D6 r: c$$...$$和\[...\]是另起一行居中开启数学模式。通常用起来差别不是很大,不过$$会修改默认的公式行间距,有时可能会对文章的整体效果有影响。% r( `' r: N7 ?. j. M# T
6 Q/ P; p- S1 U3 [PS:有一些网站可以通过画图的方式来生成公式,有的编辑器集成了各种数学功能按钮。这对于公式需求少的人来说很方便,具体信息可以自己去搜索。但是如果你的文章中要出现大段的证明过程,就会发觉还是要老老实实地google一篇latex数学符号表,然后不懂的去查代码,自己用手指敲来得干脆利索。再进阶一点,可以去搜一下有关LaTeX的自定义command的内容去看一下,在敲公式时能省很多力气。1 d9 v- T! s }* a" i# Q( q
/ K H0 C7 |6 K/ k) A6 @3 j' N
8.插入图片 ( v$ D0 K! {1 J2 @- w. E; ~6 X* G2 ~将待插入的图片姑且先命名为figure1.jpg ' }2 l3 P. f0 K& h' P9 [& h9 Y' p
建立一个新文档,将以下内容复制进入文档中,保存,保存类型选择为UTF-8,放在和图片文件同一个文件夹里,编译并观察现象。 ! F: i" w1 f1 n9 g
$ I' V9 r+ c1 i& T3 Q) U
\documentclass{article} " N) P ?) I4 G; E5 ?' z6 b
\usepackage{graphicx} 5 l) J3 P4 h1 ^, @/ u$ z\begin{document} $ d$ q7 n" l& {- X \includegraphics[width=4.00in,height=3.00in]{figure1.jpg} 2 _ M, P& [. t
\end{document}, p+ H! ?5 o4 X
6 g4 x. t5 ?; `0 r( {' E
PS:在老版本的LaTeX中是只支持eps图片格式的,现在的LaTeX对jpg、bmp、png等等常见图片都可以支持。 . F) a, u) m) j" `6 j+ A! w5 E5 b' v& o
9.简单表格 / [. Y% r$ d2 j4 U& i- x# L2 M建立一个新文档,将以下内容复制进入文档中,保存,保存类型选择为UTF-8,编译并观察对比现象。 4 Z5 m _# Q' H7 }. u; A/ d7 Y( y8 ~/ j: V" z
\documentclass{article} 9 K0 k% X, c/ [& P" a
\begin{document} 7 E/ ~" T, I% M& Y5 q2 q* u9 P0 s6 h \begin{tabular}{|c|c|} ) s3 _# j/ i; F: A
aaa & b \\ 0 Z4 ]2 G. u9 D* G7 V' r
c & ddddd\\ , ^! d" t# p8 v% } s
\end{tabular} * t1 J) L5 z' I