, V4 b L6 m" Z/ C4 _=============================================4 R# _* h8 f2 ^2 C
( |( q- X! [/ k
下面是教程正文。(正文最后应大家要求增添了附录) 9 o( O8 ^; Z5 W1 N0 q+ t6 w1 i8 S, V# E/ |) Z
3 }4 k1 B# Q4 w% J6 B% M) n. l+ b' ?0 J" Q
4 u) N$ _ W1 B2 J; l5 {
- r' t2 O( [; B9 Z5 n' S" J1.LaTeX软件的安装和使用 " j$ ~* a. a* k$ ?8 _. `+ A方法A(自助):在MikTeX的官网下载免费的MikTeX编译包(150Mb)并安装。下载WinEdt(9.5Mb)(收费)或TexMaker(32Mb)(免费)等编辑界面软件并安装。 3 N) k/ a- L$ K2 V: j
方法B(打包):在ctex.org下载ctex套装(203Mb或1.3Gb)(含MikTeX及WinEdt)% ]5 c, m6 O8 B, j9 V
. f2 Y" u. o. @& F0 R
哈哈这一部分当然不包含在标题的30分钟里。 , t; A5 O) t! u t) w- w/ g& t) s7 W" q. ^
新人不必纠结软件问题,随便什么软件随便什么版本只要下载下来能编译出pdf来就可以,先下载了装上来试试再说。在真正开始跑步之前没有必要纠结该买NIKE跑鞋还是ADI跑鞋,跑起来再说。不要瞻前顾后,just try it.6 \$ }" p* p3 p
! t4 g, v. `6 b, c $ I# I1 O3 ]8 T4 ] ; }5 A$ S, @9 }6 G2.第一个文档 5 N' M& I# m4 ] d2 e; y, @8 ^
打开WinEdt,建立一个新文档,将以下内容复制进入文档中,保存,保存类型选择为UTF-8。 - ]2 g. s4 d7 f8 E; K. I / @# a. e0 ?" g3 l7 @+ {& a\documentclass{article} * k3 [' c% w; H1 V* c9 d: W- d\begin{document} 1 O1 Q# S) a* O0 ?1 h
hello, world - C+ C' P" ]4 f5 [5 G\end{document} + h8 A: s! ?. B4 z$ y% a+ s$ ?; o: V# L, G: k6 n
然后在WinEdt的工具栏中找到编译按钮(在垃圾桶和字母B中间),在下拉菜单中选择XeLaTeX,并点击编译。 (这里请注意一下我之前一直笔误写的XeTeX,给大家带来困扰深感歉意) . p! M) E3 H9 f4 n8 M
如果顺利的话,我们就可以顺利生成出第一个pdf文件,点击工具栏中的放大镜按钮就可以快速打开生成的pdf文件。 9 X$ @9 D V7 ]* l3 L8 G
/ l9 @8 f; D2 y- {) `# Q# c
! T: g6 E" d' L/ N X
3.标题、作者和注释 8 m/ m/ S y- I- N0 C: ~
建立一个新文档,将以下内容复制进入文档中,保存,保存类型选择为UTF-8,编译并观察现象。 ( b; z4 x# m9 y* J
6 v3 T: B7 l( u$ ]
\documentclass{article} 5 ^6 S: d" v: I6 g- R \author{My Name} $ T4 }6 [7 U3 b5 W* t* d
\title{The Title} 1 {6 N$ s2 l) ?) E. R, b/ m\begin{document} ) w( M$ ?/ }% D
\maketitle 7 ?) v, y; v" e; k' k7 A hello, world % This is comment ' t8 n0 x# y" B4 m/ ?; c+ K
\end{document} $ n1 z& w4 E" t* x: w* D. K1 X1 L . c. R/ P8 U$ V* k1 ~%为本行右边所有内容被注释掉,在生成的pdf中不会显示。 ' d8 V( F- @4 S# @5 l; K & C1 Y6 s5 f- n9 T( [+ G* B7 ~块注释也有专门的语句,不过更方便的方式是选中一块区域点鼠标右键,点comment ( y( }7 a) e8 Y8 f4 C
4 U$ }. [: k* U/ Y! C: i/ W" }% {/ U- n" E* ?' e
4.章节和段落 ; s8 ^, b# C+ _1 T8 i
建立一个新文档,将以下内容复制进入文档中,保存,保存类型选择为UTF-8,编译并观察现象。 * ~* B( p( s+ H! S- w& I8 ?9 F0 Z , }) m4 U% _8 Y5 h2 U% O. V\documentclass{article} ) A8 A. \- J3 Y: N- ^* H" N1 f
\title{Hello World} 0 y) B# V# l- X: A! c\begin{document} ( B& c* [- e* B( k \maketitle ; ]% g7 g' I6 z6 X- u. R8 q9 A
\section{Hello China} China is in East Asia. 9 Y" A5 G1 _ e% H% c3 f
\subsection{Hello Beijing} Beijing is the capital of China. / \- C) a$ v- X! o" X3 ^( L0 s& r
\subsubsection{Hello Dongcheng District} 8 e9 L: f R* r8 Q& Q \paragraph{Tian'anmen Square}is in the center of Beijing 0 A' @) U# V9 N6 u1 ~' v. H) y' x \subparagraph{Chairman Mao} is in the center of Tian'anmen Square 1 ?; [; G% Q) D$ T
\subsection{Hello Guangzhou} 0 p/ I1 f) L& N$ @7 z
\paragraph{Sun Yat-sen University} is the best university in Guangzhou. 9 A" s& E! B; D$ e
\end{document} , p" h8 J- \; a$ c( U
8 o9 B. ^4 \0 G* N6 c
退格只是我个人偏好,看起来层次清晰美观。实际操作上未必要如此,每一行之前的空格不影响编译生成PDF的排版结果。 $ K, W" h6 T! d) y* C+ W
6 c2 W1 V0 H# L* a9 _
& Q: W. M1 J3 y3 p2 A
5.加入目录 0 r# L6 s. E/ s3 ?, a- o0 `9 M
建立一个新文档,将以下内容复制进入文档中,保存,保存类型选择为UTF-8,编译并观察现象。 . T% w! t+ X" B3 m
0 A" r8 d% ~: a4 q2 M( f9 K3 p3 [
\documentclass{article} 3 t& k* \4 s# O; Y3 |' S) z# y3 e
\begin{document} - @, w" M7 t% K6 `* W% I9 G \tableofcontents 2 _5 R' ^4 o( u* A- L2 U
\section{Hello China} China is in East Asia. 1 H' y* ], @9 m# M8 N5 Y
\subsection{Hello Beijing} Beijing is the capital of China. - K2 |' ~- l$ m0 ?
\subsubsection{Hello Dongcheng District} 7 s' T: m, @; g \paragraph{Hello Tian'anmen Square}is in the center of Beijing & S4 \4 Q5 x$ K* [! e( _$ j! ~% F2 E
\subparagraph{Hello Chairman Mao} is in the center of Tian'anmen Square " `7 |3 @% v- E\end{document} # X& H' B% j8 C1 ~8 h v2 G* A" N1 {# R% o1 O4 v6 H. G1 U R. D" s
6.换行 5 J1 {2 d8 m8 \! K9 @2 ^
建立一个新文档,将以下内容复制进入文档中,保存,保存类型选择为UTF-8,编译并观察对比现象。 9 _* Y, q+ k% j8 @9 o, F\documentclass{article} 9 V) M0 h$ N, ~: e, f( M- W
\begin{document} 5 D* Y) N W$ \, L7 q! ?
Beijing is ) g2 v: ?+ x# H7 E
the capital : K; X* `& j2 v' J" z0 } of China. " q& [% X" q/ S; N A* P6 A' G' K' I New York is 7 y1 f4 c2 Z; }" R! U. V& Y7 q" ~" h+ J$ [2 Q2 j, ?
the capital 4 W9 P ?7 J: r/ P3 X. _! U5 ?9 C( _
of America. ) @8 L: d' U+ H+ z
6 ^/ ^& e$ E' y( ^4 J
Amsterdam is \\ the capital \\ m1 E- @6 G4 X* { of Netherlands. # R, k+ i7 N( ]& L. b
\end{document}# u- k0 P; m0 k4 g0 O& k% U: q, C
/ j( @9 O/ @% @' z- J7.数学公式 $ B- _7 t4 `( @
建立一个新文档,将以下内容复制进入文档中,保存,保存类型选择为UTF-8,编译并观察对比现象。 8 T' {5 K' y1 Z( Q" {7 h* ^ : [) L: _; l# \! Y3 L2 Z\documentclass{article} 8 f$ j o' D, ? \usepackage{amsmath} 7 q& q& E3 J+ j3 s$ V9 w$ M; ~ \usepackage{amssymb} 3 e$ I; c2 n% X+ J$ B, Y! X\begin{document} 7 D$ F5 E$ Z& E r7 I* [, ^; Q: ` The Newton's second law is F=ma. - Y& u" J; _* V+ z! l
/ D5 V! G9 B$ b) W
The Newton's second law is $F=ma$. $ }% _2 |! X3 D; q5 Q9 M2 s* E
" I: x) L; I \' _) v The Newton's second law is " t0 b8 p" O4 E$ {$ f8 Z5 J
$$F=ma$$ 7 T2 C) ?1 w4 |+ D& m# d ) E6 E7 B/ ?0 n& D8 j The Newton's second law is , b: B$ O/ N$ g \[F=ma\] 0 R# ?) _! L5 q/ p. P' e7 d
+ X: }* L- {" M/ V, j Greek Letters $\eta$ and $\mu$ , r3 c z% D4 `% M) W2 T4 H, {
0 ]& h7 _; ~" C0 h, v- i Fraction $\frac{a}{b}$ * I3 Y6 r/ c* N2 ^ t4 u/ h# P
`5 C5 t% Q9 n' O7 a m& F
Power $a^b$ 0 |, e) ~/ G( T2 O4 `5 @