. K: o6 m( b* \& j# p; A; v& D然后在WinEdt的工具栏中找到编译按钮(在垃圾桶和字母B中间),在下拉菜单中选择XeLaTeX,并点击编译。 如果顺利的话,我们就可以顺利生成出第一个pdf文件,点击工具栏中的放大镜按钮就可以快速打开生成的pdf文件。 / O: h6 k6 z' ^* E7 h & h& v( w+ @: y1 j8 V* Y8 [3.标题、作者和注释 1 ]5 L$ J9 e5 f
建立一个新文档,将以下内容复制进入文档中,保存,保存类型选择为UTF-8,编译并观察现象。 & m, _6 l% v4 ?. @: y7 N$ d* Q' q) \; F3 L& ^. L
\documentclass{article} " n/ o. J9 w* B) m3 \" R \author{My Name} + a$ ]& r8 e: c \title{The Title} - s: f5 p2 ^: `; x\begin{document} 0 e, e7 d' U* Q0 J. Z7 m- P \maketitle 5 C- g' \. F0 o. I {
hello, world % This is comment & @) T, j: x' g1 D\end{document} $ r0 }+ X' {: P( s w8 k%意为本行右边所有内容被注释掉,在生成的pdf中不会显示。 - u# l( u( X x' B# A/ | 0 ^: K# e$ x9 ^* ]$ F; K5 G6 s$ g4.章节和段落 $ f2 k {& c7 a) `
建立一个新文档,将以下内容复制进入文档中,保存,保存类型选择为UTF-8,编译并观察现象。 ! k) s! |7 \$ f% u& q8 W ( y1 E+ M( e4 ]4 _! ~* O' p7 Z/ N\documentclass{article} 5 e: P# `4 i- h% A, g
\title{Hello World} + \' U$ }' n2 F& i n4 r
\begin{document} + Y2 r# P% Y! I6 X \maketitle " ?) U- w1 W8 y( @7 X" D& u
\section{Hello China} China is in East Asia. # @9 W/ H1 h+ y0 N! {8 F
\subsection{Hello Beijing} Beijing is the capital of China. 0 b- V! |" }9 v9 s8 ]; j \subsubsection{Hello Dongcheng District} ( f, S0 ?1 `' q( R/ a
\paragraph{Tian'anmen Square}is in the center of Beijing 1 U& E7 [" Q5 x1 G6 @
\subparagraph{Chairman Mao} is in the center of Tian'anmen Square 1 j0 F& a9 r9 L; n
\subsection{Hello Guangzhou} ) c7 `& X1 M; I$ J& |$ j \paragraph{Sun Yat-sen University} is the best university in Guangzhou. 8 l$ V* t( [& L5 V\end{document} , X+ l+ H2 X+ ` 4 [! h* E$ Y$ p4 L6 o# P& D+ d/ z退格只是为了看起来层次清晰美观。实际操作上未必要如此,每一行之前的空格不影响编译生成PDF的排版结果。 7 V/ n0 K+ m0 w
; L0 T, U: t; \
5.加入目录 - ]3 x3 {( s+ U* R
建立一个新文档,将以下内容复制进入文档中,保存,保存类型选择为UTF-8,编译并观察现象。 ( }. s- v0 w3 t ?( Q
4 I6 I% a: u/ r& N6 l
\documentclass{article} : H/ m$ {0 S5 W% c- I" {% f- k\begin{document} + p/ N: x/ c7 z \tableofcontents ; Q8 ?3 K S% w4 g% G \section{Hello China} China is in East Asia. " j. f* S+ D @
\subsection{Hello Beijing} Beijing is the capital of China. ' S* H* ?, K) L5 V" |2 E; }7 u0 P \subsubsection{Hello Dongcheng District} ! w4 \0 J, B1 x! u# L9 D* b) Z \paragraph{Hello Tian'anmen Square}is in the center of Beijing & p( i0 i$ B# Z5 b
\subparagraph{Hello Chairman Mao} is in the center of Tian'anmen Square # t: j. N& \8 c6 m* _
\end{document} 0 m- H* {7 w, U4 |2 M2 Q- R- R# q/ l# a7 @1 _8 K: m' b4 S& q
6.换行 2 j, f6 Y1 J0 x q+ m
建立一个新文档,将以下内容复制进入文档中,保存,保存类型选择为UTF-8,编译并观察对比现象。 ( K! q; L' m' s m( ^5 f) W * m3 n$ h' y; Z4 T, E\documentclass{article} 8 h: Z5 D, n" j5 J: N\begin{document} ! S; g: H! l ^9 ]: V7 h' H
Beijing is " `; z( t3 j1 N) e/ |$ F* ~# b( @7 y v the capital + Y+ K* @6 ~3 N" B# \1 i
of China. 4 P$ c* S/ [' V- g% T }
! E! S0 U& w, e; ~, f3 Z Washington is / s* \7 ^4 O& [( {4 L
3 u) L4 e" S; H# K% J+ t the capital + Y* T4 D! ~2 ~# H& y- U & Y+ W! E0 [# q3 b8 b- d of America. % D# u9 x" B' i1 P( w 5 x0 ^) w) s' ]; k/ m Amsterdam is \\ the capital \\ 7 a5 K$ z; s* C& I" F7 u of Netherlands. / i* j. d! Z+ q Q" [
\end{document} * x6 |9 b: t5 C7 c) w$ X9 y9 G! s0 r
空一行为另起一段,\\为段内强制换行。# X, v+ c7 o! Z4 `/ G
我对之前手滑写出New York is the capital of America这类低级错误表示非常抱歉。1 {, \% `3 w- x/ {* v$ x3 j# ^
1 N8 e: k# D( v\documentclass{article} 4 m/ L. u- |$ I0 q. S
\usepackage{amsmath} ( V$ W8 o3 T; v& k8 p \usepackage{amssymb} : k9 Q1 [# w) @$ Y# [1 O7 ~\begin{document} & S5 y% h' c: R6 u The Newton's second law is F=ma. 7 C" t1 o, ]7 q4 U9 {5 W
8 {% S" f1 P8 ?; p- c
The Newton's second law is $F=ma$. ! f* x; w' n( s. a9 N' k2 o( ~
, U" }5 {+ A1 r# E6 u
The Newton's second law is + F8 ]0 R* w+ t" Z" m k" S6 ~4 P( T, L $$F=ma$$ 4 g" i9 O; t3 ]2 `. c 3 q& K3 n3 ?* P4 K j2 e, X. h The Newton's second law is ' b3 l+ T. V. j1 N! m3 B' S! C \[F=ma\] 9 X {$ e8 Z, p; T+ g' g- ~/ r2 K5 H5 n6 r6 @# Y9 s
Greek Letters $\eta$ and $\mu$ 1 M: ^2 o* y7 a7 |% L2 _- m1 P
; T8 h6 R& f6 z8 ^* U/ m. d
Fraction $\frac{a}{b}$ 5 ]! B3 |6 o% g6 b3 H8 I$ r
8 D7 r/ }8 `# a$ A$ N& d
Power $a^b$ $ `% Q' U/ M( `% @3 c8 T
- V- a. @# O& k6 _2 B D Subscript $a_b$ " Z! ?) H- r$ d5 {7 p' j8 Y% R' d) T. s! f! x* |' l+ _
Derivate $\frac{\partial y}{\partial t} $ ; [2 B/ d# K- `: {6 `
' E) l) }; S. ?( z Vector $\vec{n}$ 5 `8 R7 b6 Q+ P( f- O, [ , x8 U6 R/ n; d# I! [3 x Bold $\mathbf{n}$ % N0 N( t6 }* I; q9 V$ |9 G/ m 4 s1 P& p$ ?! i" U To time differential $\dot{F}$ " D( W6 y, e6 A
% W0 F' r: u2 K. I
Matrix (lcr here means left, center or right for each column) 0 d6 ^8 h# x# F: P( @9 A) q c
\[ , u7 R" I( A3 n& d \left[ 5 [7 F; U* x1 V) u" r) ~6 G K% N \begin{array}{lcr} ; x P/ G! N: A# p- e% ^) K
a1 & b22 & c333 \\ + V+ X6 l; \, ^9 L& D1 G
d444 & e555555 & f6 * E; @" ]1 G. }& w \end{array} / o% P5 v3 c7 x! k- W4 V) x3 M \right] 3 ]7 b8 h! M" p/ O& B2 O
\] + a- k! h; ]# h8 w# H* i+ k: v& \: [) F
Equations(here \& is the symbol for aligning different rows) ( `$ \1 Y6 a( D$ H$ k\begin{align} 6 u- d, l% Q2 K1 Y. q
a+b&=c\\ 8 w. K* W+ f* y/ l( m& k, B d&=e+f+g : g: o9 w0 m; h; l) p
\end{align} 3 c: K3 ]) c8 N/ o; i/ N$ i) K3 k9 v% ?% Q$ O
\[ + a1 s/ d {+ y, S9 z5 L
\left\{ ! S3 a$ \# u% }' B) d+ ?# p5 n7 F
\begin{aligned} % T9 J- }/ K8 K* f2 b' | &a+b=c\\ / n9 ?, Q- i% X# H; _
&d=e+f+g ! ]0 {1 s) H* ?+ N" e- E: [2 l
\end{aligned} 9 a. J# } i% H \right. & q0 H: ~7 h! Q: X y) o" Z\] , ?4 ?& h& F, _+ {8 b v/ _, S+ `# ?3 O. q2 O2 H$ h7 y" i! H8 S
\end{document} - B# m& ]) \8 i3 N" } 8 A8 c1 J1 a3 Y6 A" Y# v1 E3 {% k具体细节可以自行搜索LaTeX的数学符号表或别人给的例子。( b! S. [, F6 S" r
$...$是开启行内数学模式,用于和文本合在一起使用。 3 u I) a- k# p }) h' H* `$$...$$和\[...\]是另起一行居中开启数学模式。通常用起来差别不是很大,不过$$会修改默认的公式行间距,有时可能会对文章的整体效果有影响。 ) F' D2 O( y) ^# k" R. U( b- I, w% m# E& Q: r
PS:有一些网站可以通过画图的方式来生成公式,有的编辑器集成了各种数学功能按钮。这对于公式需求少的人来说很方便,具体信息可以自己去搜索。但是如果你的文章中要出现大段的证明过程,就会发觉还是要老老实实地google一篇latex数学符号表,然后不懂的去查代码,自己用手指敲来得干脆利索。再进阶一点,可以去搜一下有关LaTeX的自定义command的内容去看一下,在敲公式时能省很多力气。 8 H# O5 s1 r+ c0 f 2 U |; N& ?4 O% l4 \8.插入图片 ; G- K7 P3 _7 {, d
将待插入的图片姑且先命名为figure1.jpg ! h' S U5 `) }- @9 I- w建立一个新文档,将以下内容复制进入文档中,保存,保存类型选择为UTF-8,放在和图片文件同一个文件夹里,编译并观察现象。 1 H! V5 N0 m0 \5 D% b) b1 z9 ] ; n% @/ p2 V4 p; {7 J3 l' o" w\documentclass{article} ; I v, j- e- t \usepackage{graphicx} " ?+ |9 Z" A. ~+ g\begin{document} : }/ W' `) ?1 ~" q. E2 `5 {- m \includegraphics[width=4.00in,height=3.00in]{figure1.jpg} 3 U# V' E/ a9 ~, g5 L7 o: T4 W7 K\end{document}' p9 s1 M; m& V. @: H3 [$ c- q
# H" T2 |+ n) M$ f& C7 G7 o5 tPS:在老版本的LaTeX中是只支持eps图片格式的,现在的LaTeX对jpg、bmp、png等等常见图片都可以支持。 $ B. C ^0 j7 E6 \ 5 n) n9 Y9 G" C/ e9.简单表格 9 q6 m' S n' G% c# G
建立一个新文档,将以下内容复制进入文档中,保存,保存类型选择为UTF-8,编译并观察对比现象。 & R2 b1 B: _" Z2 v$ x ' ~7 I9 ]1 X# x- c- T% n\documentclass{article} 4 I+ D" Y5 {5 G& \
\begin{document} 9 N/ c9 N, C- I
\begin{tabular}{|c|c|} # m7 o, e2 B7 X$ e/ s- w! e! |6 z+ g aaa & b \\ # a# x. k' B8 z* y- V# y' w c & ddddd\\ " W+ T/ z' y3 R1 ~6 r* l: u \end{tabular} ' D% v* }( U" A5 K( I% D- @1 b1 @3 h; l" m) y+ b7 S
\begin{tabular}{|l|r|} + @2 T: b# v, X6 L \hline , d% S! i- [ G, \6 y; N8 W aaaa & b \\ ( X# H. ^0 V0 T4 V- W6 X \hline ; x) {, m3 S7 e c & ddddd\\ 3 C( Q( l& K! w7 h
\hline / W M5 G& B" H V4 o5 d+ V/ v; Q2 l/ h \end{tabular} ! E3 Z# j+ ~; t$ u4 e u \begin{center} ; K* V) h1 H% g% @1 I I
\begin{tabular}{|c|c|} 6 m+ w/ ]$ M6 l$ B: S4 s
\hline 9 {4 l- S7 C6 P8 _1 a0 e$ L, i- H6 \ a & b \\ \hline : |4 W% w& J1 Q. L- ~ c & d\\ . ]) Y. n0 C: g8 U1 c- v2 l! R
\hline ' ` c& H, W6 M, n) J0 o \end{tabular} % _4 K& e# G8 g8 E4 D9 l5 K
\end{center} 0 J0 t a' M! E' W. g s
\end{document}0 q5 } T% K( a4 W; h: J$ v
注意观察有无\hline和有无\begin{center}的区别。注意观察\begin{tabular}后的lcr的区别,分别是left对齐,center对齐和right对齐。 1 r+ E; q% V9 a l9 l