7 `* |9 X/ r$ W7 B8 ]' k o\documentclass{article} 0 s2 A* f, Y4 N! q\begin{document} ( I1 W( p7 y7 p* Z% W
hello, world + S% Z7 K" P" H3 x' C6 d; d# q\end{document} / L4 n3 r4 ^* y$ s7 ~( Y' p# a8 C$ i5 [, c
然后在WinEdt的工具栏中找到编译按钮(在垃圾桶和字母B中间),在下拉菜单中选择XeLaTeX,并点击编译。 如果顺利的话,我们就可以顺利生成出第一个pdf文件,点击工具栏中的放大镜按钮就可以快速打开生成的pdf文件。 ' l9 s( g. b# E* Q1 W9 b8 w# b/ T 5 z4 P; H- O9 h/ U7 U* H v3.标题、作者和注释 # V5 F F- ^$ `8 N i
建立一个新文档,将以下内容复制进入文档中,保存,保存类型选择为UTF-8,编译并观察现象。 ' U* B% ?0 ]2 V0 t/ y - z3 N! a9 B2 V- X7 ?" t) `\documentclass{article} % w# {/ ~0 c& M1 Q+ `5 B- E0 w% `
\author{My Name} , O: y2 e3 A4 k9 H
\title{The Title} $ O/ w$ K7 {; J- @9 J- d\begin{document} 1 g* _9 Y: n. W" P, e* v& A3 Z1 i \maketitle ; A, D( z' K. Z
hello, world % This is comment 5 R7 y4 W/ g! o0 v: X( ?\end{document}- @% n( i- z N8 r
%意为本行右边所有内容被注释掉,在生成的pdf中不会显示。 , d& m6 [: {" H# U8 N6 s! F7 n$ W6 k. d! c% N" E) j+ _
4.章节和段落 y" y/ E! \3 ]" n+ I+ C
建立一个新文档,将以下内容复制进入文档中,保存,保存类型选择为UTF-8,编译并观察现象。 4 ?! S# Q$ u8 M2 a$ w( c- i1 J
9 ` n2 G# [1 d\documentclass{article} & W1 r9 _1 M" f6 j- I- T o \title{Hello World} ( O" N" J2 L! N% \ M
\begin{document} % k+ M4 }9 ]9 L! T- \ P4 r2 F
\maketitle - ?, I2 o, \- Y3 c
\section{Hello China} China is in East Asia. 8 ^: D) T/ G" ~5 {; C" s- z \subsection{Hello Beijing} Beijing is the capital of China. 5 U# R I( U6 ^1 L2 o7 l \subsubsection{Hello Dongcheng District} 2 g; K: i: y% ~9 V* v) M9 k: H7 Q0 m
\paragraph{Tian'anmen Square}is in the center of Beijing 1 j4 e. ^; {6 y/ w
\subparagraph{Chairman Mao} is in the center of Tian'anmen Square ) g7 t# M' v" k; Y3 n. D2 f
\subsection{Hello Guangzhou} / K/ e8 n S& L1 k/ d. E \paragraph{Sun Yat-sen University} is the best university in Guangzhou. O9 r0 k' n8 P& m, ~+ v0 A\end{document} 8 `( Z5 K) ]4 @) J. {8 K2 d. F! B# j: Z
退格只是为了看起来层次清晰美观。实际操作上未必要如此,每一行之前的空格不影响编译生成PDF的排版结果。 * c) r' b/ A) j1 d( u8 Y/ _, ]: C4 y* P" T5 T
5.加入目录 & d. K3 F, q! c
建立一个新文档,将以下内容复制进入文档中,保存,保存类型选择为UTF-8,编译并观察现象。 " m3 V' T3 V5 ]# M' Q' \! ~
- M$ `* \. w/ q! s% H\documentclass{article} : F5 {/ |( D! U1 D
\begin{document} ! h8 t8 b; s6 l/ ~ \tableofcontents $ H" `, \9 V# R+ p% y2 y \section{Hello China} China is in East Asia. ( `6 i/ s1 b! a
\subsection{Hello Beijing} Beijing is the capital of China. 1 Z. m* w6 H/ \0 D: B8 j
\subsubsection{Hello Dongcheng District} * q) g( W7 L1 d: u& M' r3 G \paragraph{Hello Tian'anmen Square}is in the center of Beijing # e( T+ k' z( i" b
\subparagraph{Hello Chairman Mao} is in the center of Tian'anmen Square 9 c% X% `0 J1 I
\end{document} * ^1 |. L3 _( a2 i/ `- n 6 p E. E8 R; Q t" |! b. g6.换行 . z* Y7 \! g& u; m% |
建立一个新文档,将以下内容复制进入文档中,保存,保存类型选择为UTF-8,编译并观察对比现象。 ! V' c6 W8 B8 n0 P/ q. ]% T ( K( r8 |/ O( x\documentclass{article} 4 F9 A9 ?9 k+ W# t
\begin{document} ( `: X( F; I5 \) h" g Beijing is 8 x) f, `0 v0 [: V2 N9 M
the capital 5 W9 t- i# ^0 E6 e of China. 5 m: [9 _& {4 {- ^1 K, w, n
1 m( f' O3 l% v Washington is W7 H/ H$ T+ b4 Q* N- L! @4 ? . F4 J5 w7 ~5 w the capital ' L1 @! J2 ~' `! Z. T) I4 w7 i1 b. e1 n5 O, q5 e) r
of America. ! @. [" G0 m# g' `4 B+ o. y. L+ C/ u) [$ Y7 z5 P; f; l* f8 U1 @
Amsterdam is \\ the capital \\ & d0 m' c) M9 u" A1 S6 ~, \ of Netherlands. ( O/ i( W0 N& N- G% z; H\end{document} 3 y9 [1 f) y& J" U g: ]# {, L* V4 C 0 t+ d. n1 g5 ~* \/ Z% E空一行为另起一段,\\为段内强制换行。 - k+ @( ^2 F0 q) d, P" B我对之前手滑写出New York is the capital of America这类低级错误表示非常抱歉。0 L0 B+ f0 e% D! R
! V. L. A8 P% n- w/ t% M" F
7.数学公式 : G* S7 I, ~% w# Q+ f* a建立一个新文档,将以下内容复制进入文档中,保存,保存类型选择为UTF-8,编译并观察对比现象。 " \ l3 ?8 M5 \4 g5 X: W Z 6 @8 J" t1 }+ X8 T2 k' R\documentclass{article} ' i) b2 B4 U2 H4 D$ v1 G" B1 r \usepackage{amsmath} " }# F$ }2 [2 J9 s/ A \usepackage{amssymb} / {' @. s5 y! t0 X( Q' G, I
\begin{document} , @% G( T4 C) x/ d R
The Newton's second law is F=ma. % j4 p) R* F' M$ C
8 p7 B/ ~4 r n" B4 P0 ]; X The Newton's second law is $F=ma$. # E) I r @' [ ! g* I9 R' _5 T1 w- o/ A The Newton's second law is 1 V- d* B3 k$ C& D* v $$F=ma$$ , m( e. y/ s" j
8 Z( R' }2 {- o3 j- i G% Y
The Newton's second law is 2 t# J/ e( w' g/ @0 i; K
\[F=ma\] 1 \9 t X( b' @/ H0 d, T . u; w/ d; `8 ~+ s6 f1 n Greek Letters $\eta$ and $\mu$ f# F M; v" g* s# `# J( x, v: d' g# v1 J/ R& b* m
Fraction $\frac{a}{b}$ ( d$ U; s& |$ Q; F0 G \) G. R % f1 b. e* [& }! q1 R Power $a^b$ & x6 L$ [, q/ n1 d7 z" k
/ h7 w0 c3 X3 [
Subscript $a_b$ . D k+ D, _$ @8 R: L# ^
' M! ~/ c2 n; l f9 H, D* w& a, p Derivate $\frac{\partial y}{\partial t} $ 7 t2 b) y6 a( Q4 b* u V$ ~+ u8 g- g; y
) y; U( w# q Z( o$ e3 t7 Y4 J Vector $\vec{n}$ + l' H' P# n% u6 M S3 u
0 G: v7 i7 [& K, {2 p1 f Bold $\mathbf{n}$ % ]5 O. O: V; z* K 8 ]7 e* Q$ v; Q5 F/ x% i e, A$ g To time differential $\dot{F}$ # Q$ g3 G, Q/ }/ a& Z' R4 m" P+ ?' `: ^
Matrix (lcr here means left, center or right for each column) " i% E5 u! c# p5 V) f- c# d
\[ ) q' Z" ^4 g ?; {
\left[ ) R1 [# l( d/ @2 S
\begin{array}{lcr} % f* k& @* J1 P) _) r a1 & b22 & c333 \\ ; F- J: w* Y) K- i- s& U d444 & e555555 & f6 $ i, g) ^& p% f, {$ L
\end{array} 9 m- v: Y+ u n8 K! s" _
\right] - U0 f. d" A7 O9 d; x+ k8 v
\] & z' |& F- F" @2 o. | + l* p/ {7 I" CEquations(here \& is the symbol for aligning different rows) ' o/ ~! w; M% l1 R
\begin{align} 0 C+ F7 @5 K1 f y: I a+b&=c\\ - S' C0 J; r5 k d&=e+f+g 7 f" m2 s2 n3 g9 t" a
\end{align} $ g; ?! Q& ~* B# _4 `* S1 M% a+ E4 L( n: O% Z1 j
\[ 3 `; n. z5 S5 _$ u \left\{ 7 X7 O4 D0 a* ]0 x; H
\begin{aligned} ]2 @4 w F8 L &a+b=c\\ 7 q$ m9 p6 {' |* I% M1 U
&d=e+f+g 3 g! j; J' G" k
\end{aligned} . l8 y a( I7 d. M: Z \right. 7 d7 b x3 g0 O6 |, o) B
\] 7 ~+ A' K5 U( Y5 x( v. z" n/ e8 `; a! h9 f$ H, e+ ^2 Y9 C S
\end{document} . {$ }9 v0 T& _# _! n' _ 7 {* U0 _* H. q! U具体细节可以自行搜索LaTeX的数学符号表或别人给的例子。 : y+ Z3 X9 |6 Z) S2 s3 r$ `$ O$...$是开启行内数学模式,用于和文本合在一起使用。* s ^' z3 ?" t
$$...$$和\[...\]是另起一行居中开启数学模式。通常用起来差别不是很大,不过$$会修改默认的公式行间距,有时可能会对文章的整体效果有影响。 4 G& v2 t9 i1 }8 r* k6 ?! M' ^/ v* s
PS:有一些网站可以通过画图的方式来生成公式,有的编辑器集成了各种数学功能按钮。这对于公式需求少的人来说很方便,具体信息可以自己去搜索。但是如果你的文章中要出现大段的证明过程,就会发觉还是要老老实实地google一篇latex数学符号表,然后不懂的去查代码,自己用手指敲来得干脆利索。再进阶一点,可以去搜一下有关LaTeX的自定义command的内容去看一下,在敲公式时能省很多力气。 ~+ \( i: g# s6 \) d" i$ l+ m( t9 I