0 d/ i0 h n0 d" [2.第一个文档 & o. S/ O, U& C打开WinEdt,建立一个新文档,将以下内容复制进入文档中,保存,保存类型选择为UTF-8。 0 M# p3 k& y! N- B$ U( k
1 W7 Q6 R) y. a' J3 u* i2 s3 X\documentclass{article} - f# T5 }; D! w
\begin{document} ) \, k3 V: ~9 s5 ?
hello, world - k) e% d! }4 a5 ~2 u8 l6 @\end{document} $ [1 j: `! Z4 R
, s4 y2 S& T3 X- ~( N
然后在WinEdt的工具栏中找到编译按钮(在垃圾桶和字母B中间),在下拉菜单中选择XeLaTeX,并点击编译。 如果顺利的话,我们就可以顺利生成出第一个pdf文件,点击工具栏中的放大镜按钮就可以快速打开生成的pdf文件。 5 _$ d: ^, ^2 [
& q, R5 ]6 R% l/ n; f3.标题、作者和注释 : ]( X& s r! i( J建立一个新文档,将以下内容复制进入文档中,保存,保存类型选择为UTF-8,编译并观察现象。 4 E0 A/ b0 |! _" G
$ k2 f7 F- ~8 b1 ~( }3 Q
\documentclass{article} # R o* w* j y) H
\author{My Name} 8 R7 M2 ^+ s2 R- [9 O
\title{The Title} 8 S4 [% `, q, `; w
\begin{document} 0 v# ~' D2 f$ ?3 V% C
\maketitle 4 i1 j' A+ o$ t1 T+ G4 U hello, world % This is comment & d" M% A9 G0 p1 C\end{document} 4 M% L' C: |: M+ w9 t5 Z%意为本行右边所有内容被注释掉,在生成的pdf中不会显示。- N, r, l" V, e, T1 S% n* O$ g
2 x( Y/ {8 _6 v/ e2 N
4.章节和段落 |. \2 \/ J& a8 i
建立一个新文档,将以下内容复制进入文档中,保存,保存类型选择为UTF-8,编译并观察现象。 0 B# N2 {% l& z- Q$ {* B
$ }3 h4 X% j: Z7 G" w1 Y
\documentclass{article} - `! E( @- X* N& M
\title{Hello World} 5 ]: k9 Z& z3 M" D\begin{document} ! l6 E* ?' Y: Z9 L. B& E5 a& W1 s2 o
\maketitle 8 F) _- v4 X# z9 K8 v& R) M/ ?6 ~$ }
\section{Hello China} China is in East Asia. - r/ o% P" \9 N/ h0 O9 _% i \subsection{Hello Beijing} Beijing is the capital of China. 9 z5 q5 d& f/ N6 G
\subsubsection{Hello Dongcheng District} , n; S X8 x" v. O( x' V- Y
\paragraph{Tian'anmen Square}is in the center of Beijing 3 L7 O$ G6 y9 Y6 Y$ H; q3 e& x8 `, n
\subparagraph{Chairman Mao} is in the center of Tian'anmen Square ! R% T5 c8 K9 p- r; a, @: O# D
\subsection{Hello Guangzhou} T$ j6 r7 C8 f \paragraph{Sun Yat-sen University} is the best university in Guangzhou. ! e9 y9 V: h* A. P% i+ P
\end{document} f# f; C$ `7 g& F( k
" _9 m2 ]8 s& u" G) F" n0 K9 D退格只是为了看起来层次清晰美观。实际操作上未必要如此,每一行之前的空格不影响编译生成PDF的排版结果。 & i+ q; p4 s! p7 c, M) b$ [# p' m ?
5.加入目录 : x6 z8 G! m5 T6 r) ^建立一个新文档,将以下内容复制进入文档中,保存,保存类型选择为UTF-8,编译并观察现象。 * X8 R: M. X; y! v& A1 f2 I8 z& ^, P " w( |3 R8 `) I7 ~0 H/ }\documentclass{article} $ S: B- D: }+ w/ x8 u- H( `\begin{document} $ ^* Q$ ^/ a% a0 S! j( Q9 C: a- [
\tableofcontents ! P/ `& V8 u: ?: g* c' E+ r+ V
\section{Hello China} China is in East Asia. # w: x% h) j& D5 \: {: I \subsection{Hello Beijing} Beijing is the capital of China. 5 p( _3 [# y/ _) L( _
\subsubsection{Hello Dongcheng District} ; w: X3 ~4 c' k& \% V! `
\paragraph{Hello Tian'anmen Square}is in the center of Beijing ( j. g( X( I8 K0 D% j
\subparagraph{Hello Chairman Mao} is in the center of Tian'anmen Square 9 O% \7 e( _. e: A$ M0 J2 N
\end{document} # {& e6 v" h E& G, o: M) ]
3 t% T' a( V! s7 c. u
6.换行 / ]( v/ H( S9 @建立一个新文档,将以下内容复制进入文档中,保存,保存类型选择为UTF-8,编译并观察对比现象。 3 p0 I: T8 P& C' i7 R5 J( P! Y% Z5 T# t
\documentclass{article} % c* d; L1 D+ p% b; V
\begin{document} $ |7 n, ~& P: x4 i! @2 d, ^& Z+ v
Beijing is % }/ n' o) G0 { the capital 9 N/ Q$ \2 B( k5 ]4 }, s of China. $ X ~( V) y/ ~. d
: i7 `/ V1 I. k, ?8 I( t Washington is C1 q" p# a! X; I$ ]; ^
* F+ C' C% V7 w. W. u W$ O6 Z. r the capital ! d9 l* I1 q' N. m4 d( b
M9 |0 T" C; U" Q; Z5 [9 v of America. : G% r' a6 c3 M* [8 X J6 Q
{7 S1 X8 f- |3 u# @% k
Amsterdam is \\ the capital \\ 6 ^! I4 y3 U' e; E2 R& g0 A2 d- d. Y
of Netherlands. 1 _3 @0 V# S1 [+ A2 V" L
\end{document} + f2 K& ^2 R# _: O% o# m* N . \( f$ c) R( m% X( {+ j; V空一行为另起一段,\\为段内强制换行。( B9 }2 z, D' g* Z' Q5 t" O2 l h. e
我对之前手滑写出New York is the capital of America这类低级错误表示非常抱歉。 / U1 r" e9 x4 g! U6 n% B, v2 W0 _ j5 c9 [: M
7.数学公式 + h4 z: I& \1 u$ O8 v
建立一个新文档,将以下内容复制进入文档中,保存,保存类型选择为UTF-8,编译并观察对比现象。 0 `, V: Z6 _3 I2 b( h$ c( f/ O, Q# R: s. b3 C( X/ e- N
\documentclass{article} + ~7 B; i8 @$ k6 A5 Q7 S" @
\usepackage{amsmath} ' Q+ c" x6 X9 }! Z- B( Z; @5 I
\usepackage{amssymb} 1 s3 s2 G5 ~9 C/ N- s5 q2 ~
\begin{document} % y( |+ t, @; v' j/ p. C+ s, } The Newton's second law is F=ma. $ F1 W: f8 o2 O8 [, V& }5 L
- {3 V6 t! H$ _3 P9 N! t
The Newton's second law is $F=ma$. N; O6 o7 y+ ?1 r- P
' v& N8 z# m" A! j8 I) x The Newton's second law is $ O/ v) c( \( S3 k0 x- U+ t p
$$F=ma$$ 4 H* z. N6 ^$ _ D; J
1 a& q% K5 m; o
The Newton's second law is 6 g, X* c( {9 e
\[F=ma\] ' o1 G: ]" D/ _) ~ R& Z & M! e) i) J7 I: Z. L$ ^! D5 ? Greek Letters $\eta$ and $\mu$ + |" I, d0 r3 E8 E* R # h: |' o M" d0 p: O2 C Fraction $\frac{a}{b}$ ( m# d- y$ w- k" N # ]5 `0 N, k! k Power $a^b$ % m6 d/ Z4 i( V
C& D/ [- l' k" Z Subscript $a_b$ / E$ a) n5 y: U' J. [ . b0 U8 I7 s. ^) Z. Z4 T; u, `6 G Derivate $\frac{\partial y}{\partial t} $ & ]- W2 O) k) N3 E6 U- T7 v4 F5 H& Q0 [% t: k) ]
Vector $\vec{n}$ . }7 p2 ]! W% A: Q4 \ & ~: @1 B b* H) m, l2 } Bold $\mathbf{n}$ 9 L5 u" y- }) K- Q }; K7 W. X1 x! J; w; l2 n9 O: v
To time differential $\dot{F}$ + e- l2 p& Q7 l. ], | q! l; Q g6 b! U
# B' x8 @ q4 Z
Matrix (lcr here means left, center or right for each column) 0 V9 ?: O+ S$ ^ L( e5 {- @ \[ ; _5 I! i! n$ A+ ~) j \left[ - w9 a, U: I& T9 d; a \begin{array}{lcr} + L0 d: e& f( ]4 K
a1 & b22 & c333 \\ 6 o/ Z9 `8 q2 {' T: X3 a
d444 & e555555 & f6 9 u4 {9 A$ D- W& U- G* s
\end{array} " | f0 Q, T! _% u* f; b8 d6 g( S \right] 3 O+ x4 K$ M6 ?7 e \] n3 u9 b2 @# s, n1 A1 v
2 d/ p6 f9 j9 `' |- `
Equations(here \& is the symbol for aligning different rows) 3 w. C. P. Y. }* H0 [
\begin{align} . v; h& s3 q; n s% A a+b&=c\\ * s8 k( u" K! ^ d&=e+f+g : ^* Z; Z( R, M. ?9 `7 ]: S\end{align} " z, _% I7 {( B. R! R# d) N; f' R9 a8 `" O# V0 W) f
\[ 7 q$ o& V s* F N \left\{ + K- d( G1 ~; G& q; @" f
\begin{aligned} 1 A. e0 m( D3 h8 n# h k
&a+b=c\\ ( w1 n( W i% o! I R
&d=e+f+g 2 o% ?0 r* ~* ^" ~. W. `7 b5 O \end{aligned} ) {! Q2 i" G: O. [/ Y" k
\right. ; J. b* h ^; n7 u9 L" V- e0 o; X* s\] / ^ W% A7 B5 R$ l/ I3 w8 c
2 n8 p' [. n: Y! t7 { w; S\end{document} 0 D* T U/ v5 @1 J3 ~
' n2 F9 a- g* R/ A6 c具体细节可以自行搜索LaTeX的数学符号表或别人给的例子。3 d0 E( s$ ], l! R0 P8 h# R
$...$是开启行内数学模式,用于和文本合在一起使用。 6 t! G0 H- M3 l+ e$$...$$和\[...\]是另起一行居中开启数学模式。通常用起来差别不是很大,不过$$会修改默认的公式行间距,有时可能会对文章的整体效果有影响。! g- e3 V& c) z