: l+ X# y! ?4 W" c5 @: l+ @2.第一个文档 ' D, R9 D0 R) z( Z打开WinEdt,建立一个新文档,将以下内容复制进入文档中,保存,保存类型选择为UTF-8。 $ }! Z6 _4 V; W+ E7 T8 Q8 d
8 r9 z, E% b% d5 k9 o( v
\documentclass{article} ( q/ j$ B% ]6 |! ?\begin{document} , k3 p/ [ y `, c& J hello, world 8 I/ z- v* e/ M$ C' p\end{document} $ f* v/ k. I# f
! q# h2 W; d) `$ E1 \7 C! E
然后在WinEdt的工具栏中找到编译按钮(在垃圾桶和字母B中间),在下拉菜单中选择XeLaTeX,并点击编译。 (这里请注意一下我之前一直笔误写的XeTeX,给大家带来困扰深感歉意) 0 ]$ L2 _$ Y3 d% x1 m) y
如果顺利的话,我们就可以顺利生成出第一个pdf文件,点击工具栏中的放大镜按钮就可以快速打开生成的pdf文件。 % B; j l# L2 q1 r1 x 4 a; j3 t8 m9 ~# J+ n; M7 E+ k! e7 {0 X0 \1 Z; ?
3.标题、作者和注释 6 S8 n; G- V6 l5 \# V4 F& G
建立一个新文档,将以下内容复制进入文档中,保存,保存类型选择为UTF-8,编译并观察现象。 $ N A! H( r0 \. |1 S( ^" J ( E1 j4 f- R- H- ?8 d5 E\documentclass{article} 4 c* \7 @7 i3 i/ c
\author{My Name} : m9 Z) E" M. D9 \2 N& v1 E \title{The Title} & d3 G# G+ M& b( [* Z
\begin{document} 3 Q8 _* C6 \ ]6 t. N \maketitle 8 j* q/ w$ x2 Q4 X0 ^* t
hello, world % This is comment + V0 Y4 D `7 _- `6 _$ I
\end{document} 9 e! C& d# E' H! {$ [' J/ r0 ~/ i' R* T/ g- w, O5 y& ~* d
%为本行右边所有内容被注释掉,在生成的pdf中不会显示。; p* |! ~4 l+ ]7 m
; e! C0 H- P3 F
块注释也有专门的语句,不过更方便的方式是选中一块区域点鼠标右键,点comment 6 x2 p9 O c. E& U( Z
) q- c. l& Z) l5 E
+ O, }) l3 O* @2 A9 b
4.章节和段落 2 ]- h4 k, @$ ~( N; D7 J. V( z
建立一个新文档,将以下内容复制进入文档中,保存,保存类型选择为UTF-8,编译并观察现象。 6 ^8 t) B. }2 e' x2 r' f# T0 H- ~; j, y4 x) E6 w7 \
\documentclass{article} & [8 O0 d1 |; ?4 b5 }! q$ x# E$ a
\title{Hello World} 8 m+ ~! |6 U4 D* w\begin{document} * F! g8 `9 @) I, w \maketitle 1 b& C! b5 }5 m- ?6 l- q- g
\section{Hello China} China is in East Asia. 3 ` @+ i4 i% |3 w# `$ d V \subsection{Hello Beijing} Beijing is the capital of China. ) M. w I8 l/ T \subsubsection{Hello Dongcheng District} ' i& a( x6 i: l
\paragraph{Tian'anmen Square}is in the center of Beijing : y+ S# _& q1 f- A' j; E
\subparagraph{Chairman Mao} is in the center of Tian'anmen Square 3 e% A. ?; s8 k7 V* H4 n* s F \subsection{Hello Guangzhou} % K2 B; X: k% `: E7 e) ?* T
\paragraph{Sun Yat-sen University} is the best university in Guangzhou. N! E, P6 P$ R1 S\end{document} / v6 y/ ~! q: u: t. a8 Z- h6 N 1 d# v; `9 \% c* S7 B退格只是我个人偏好,看起来层次清晰美观。实际操作上未必要如此,每一行之前的空格不影响编译生成PDF的排版结果。 $ g( j7 K) ` w) ~7 }! N$ x$ r$ U8 [. l- ]! U4 U
& z5 J- ]& N! F' a- N7 Z
5.加入目录 # L. v6 a( t- b Y/ n; {建立一个新文档,将以下内容复制进入文档中,保存,保存类型选择为UTF-8,编译并观察现象。 4 O2 e, R6 z4 f# w! y3 g ) {$ b# h- t4 F3 C0 d: z' Y\documentclass{article} / ?# R0 O" X# b3 l" R( o# o) L, J% _\begin{document} 9 g4 g* J: w. R& E) I \tableofcontents $ Q H- G |5 u9 ] \section{Hello China} China is in East Asia. 2 y2 S' J% L7 P/ V# K% l \subsection{Hello Beijing} Beijing is the capital of China. 5 X6 y, ?3 A1 K
\subsubsection{Hello Dongcheng District} . ^/ B* n) k! A- e \paragraph{Hello Tian'anmen Square}is in the center of Beijing 4 a; b9 b5 {6 Z; ?% p \subparagraph{Hello Chairman Mao} is in the center of Tian'anmen Square 7 ^9 _3 {2 W/ N. g b9 x\end{document} ( G8 `! ~2 W2 z( e9 e/ D# g! q: @, j2 q8 k# C8 y
6.换行 # q1 e6 G5 T4 Z2 e& P6 L
建立一个新文档,将以下内容复制进入文档中,保存,保存类型选择为UTF-8,编译并观察对比现象。 5 f9 Q% S( x1 y; Q* `7 z% L
\documentclass{article} . F" c4 d; O' @. H1 K
\begin{document} . f# m& P9 d% W8 a& j4 O Beijing is 4 G; d4 I, ]6 P9 j i' [) ~( }
the capital % C4 H) E: b6 \1 x( m# c' ^ i of China. * |6 Q2 C! e/ p* E+ C4 \- e 6 b/ F8 ^* Q4 f( i! c' J" P, y. X New York is : `& B; R5 V, z& Q4 O% D5 @, `2 Q
) Y. g( W- [* \5 x' ?' a7 B the capital % J: D) ]# {/ J' c 5 e+ v. b% _, h p3 r& {4 X2 T of America. 8 p$ \5 M( x2 g8 r& \5 V' u- {2 ?& ? z k3 e$ R& D0 }
Amsterdam is \\ the capital \\ " D8 O) l T9 H2 V R3 Y; E of Netherlands. * d7 Y6 x g7 n; k" P\end{document}2 V1 B# M- c9 Y- f* @7 _7 r, b
/ W- a' E; Y3 E7 `# @; Y3 l
空一行为另起一段,\\为段内强制换行。 9 D5 [# |* e9 A3 X4 R& [& u% E" H7 e' F
0 o- d4 S( b- Q7.数学公式 * {2 e, `% J! K+ P) Q" [9 W6 w' N建立一个新文档,将以下内容复制进入文档中,保存,保存类型选择为UTF-8,编译并观察对比现象。 ' `; V, m/ R) a3 W9 t
2 ^( W1 K% O, f8 H0 p7 ^7 {
\documentclass{article} 3 n& ]) N- S, q6 D& Z
\usepackage{amsmath} 4 Z: n: {1 @0 [* [& R# J2 | \usepackage{amssymb} 3 J l" u* A# ]. I8 w/ d% j\begin{document} 0 @& R; m s6 h9 \$ {& H The Newton's second law is F=ma. 3 ?+ Q% e+ ?6 a( M+ \2 f
# Q3 D. \5 v% E( Z! D* g The Newton's second law is $F=ma$. 0 `" B0 l( s# ?
- q* H% u% o+ W' I0 b5 ~' ?
The Newton's second law is / V8 G' d0 ]) |3 I2 ? $$F=ma$$ 4 ]! J- M! E, [+ c 7 z$ J# C1 F+ | The Newton's second law is : D8 _( h# f; @
\[F=ma\] 0 |7 P* p% M% ?# K
2 {" C! }' Y$ o, o' ?; q& i; S2 s Greek Letters $\eta$ and $\mu$ - S1 Q" X d: }
3 ]+ {9 P/ v% V/ }9 z! }
Fraction $\frac{a}{b}$ 2 E+ R1 s$ M, N' \/ M$ O % ]9 Y1 P' X3 z. \3 W/ P Power $a^b$ 6 l& D; [$ M$ F2 {3 {0 J6 c% {# }+ @4 H6 `
Subscript $a_b$ 6 s6 b7 u1 t0 W8 R L/ K 4 e% E8 w- `6 S0 { Derivate $\frac{\partial y}{\partial t} $ " c: f$ B4 m2 Z4 V 8 ~8 J# M6 M5 l Vector $\vec{n}$ 8 C1 C- Y$ |7 y6 a6 I8 s8 o " `% c) l2 B9 [: b0 X1 D Bold $\mathbf{n}$ 0 f& M& L# c( n+ L. w6 q
) S7 Y/ Z( X3 g: S' x! y5 B" P To time differential $\dot{F}$ 8 K0 t/ F$ w( `9 G/ F; C8 ?7 j & z8 b* o u R; F0 t: C% i& b Matrix (lcr here means left, center or right for each column) & c$ Z9 V5 C; h. o6 Y3 q
\[ / s" _- n2 a9 Y( E; A" u+ S+ T
\left[ 0 Z) a$ k" o7 D8 h+ J7 I% t: m
\begin{array}{lcr} 3 b9 S6 R7 L+ f9 q, ?9 w a1 & b22 & c333 \\ : D4 L( g! w2 w4 `+ {) v d444 & e555555 & f6 - P7 `1 O/ ]3 ]7 j% f& [* T0 h& g \end{array} 8 @( C, A, A3 ?0 T9 t" G* I
\right] $ w9 |1 d$ j u: y& G \] 3 c* w1 n: D9 I. a! z& D( T( x3 N
& }9 e+ N' n$ z4 vEquations(here \& is the symbol for aligning different rows) % z: \$ N( Y& R. @2 G/ N1 {4 _0 p
\begin{align} ) R, l( G* C/ x% x2 l9 i a+b&=c\\ . X0 B; `' x- O {4 ? d&=e+f+g 0 F7 ^5 J0 I5 D/ E" d i& o
\end{align} 0 t; @" E$ ^: I: M3 z" V" z
, s4 q0 e: j8 u5 j8 Y! G8 O! t\[ 7 q8 ^' v& I- E6 q
\left\{ % ?2 b' a `$ h. R/ x
\begin{aligned} 0 [: H( z! S* s+ J4 n &a+b=c\\ 3 e3 k* J$ w$ C3 @1 z7 v
&d=e+f+g + w) S9 Q A/ V0 P
\end{aligned} 0 q+ \- l! @6 G3 \% J9 }
\right. 9 ~% e8 ^7 m2 R4 Z\] 4 V, w) Z3 _) r4 c5 ?6 C$ f- A. ?1 k
1 d: O: e2 T- o- \; b* @9 t+ T
\end{document} $ g3 V. d- j$ A" |- P
5 }, y+ p# E. b3 W" `# _; V7 I0 z, u具体细节可以自行搜索LaTeX的数学符号表或别人给的例子。6 `6 v l3 Y1 Y' u4 O
s% |( Y* O" m4 A ! Q( n% o. K/ K( F0 K; D
z% ~5 C' u( z/ i3 x7 |9 p1 Q$...$是开启行内数学模式,用于和文本合在一起使用。9 g9 G6 n+ ], e1 _7 [4 V7 U, f
) P; ^4 `1 L9 }) b7 Y- r( H1 L$$...$$和\[...\]是另起一行居中开启数学模式。4 i9 x' |( B+ \. i* E" B- W8 K% r, D
+ |7 J9 E9 R x* `7 q3 G" I
+ k. m. {8 D/ w! S6 i+ k; @4 g1 T
# V5 o+ D: ?# j* p; w
有一些网站可以通过画图的方式来生成公式,有的编辑器集成了各种数学功能按钮。这对于公式需求少的人来说很方便,具体信息可以自己去搜索。但是如果你的文章中要出现大段的证明过程,就会发觉还是老老实实地google一篇latex数学符号表,然后不懂的去查代码,自己用手指敲来得干脆利索。再进阶一点,可以去搜一下有关LaTeX的自定义command的内容去看一下,在敲公式时能省很多力气。 # `3 `. ~2 O( ]. A. F6 W5 Z5 j + @2 Q) s# N; L6 q, \) H; k+ T1 z1 S4 a T4 I
8.插入图片 - @1 j9 x5 y. L1 k% I g" c6 z
将待插入的图片姑且先命名为figure1.jpg 3 s6 j/ |2 l5 I- {* v$ X
建立一个新文档,将以下内容复制进入文档中,保存,保存类型选择为UTF-8,放在和图片文件同一个文件夹里,编译并观察现象。 9 [$ k4 O5 V& V! ~