3 c% ^1 T- ^: M6 @方法A(自助):在MikTeX的官网下载免费的MikTeX编译包(150Mb)并安装。下载WinEdt(9.5Mb)(收费)或TexMaker(32Mb)(免费)等编辑界面软件并安装。 * J' Q5 k6 \$ \7 v' d方法B(打包):在ctex.org下载ctex套装(203Mb或1.3Gb)(含MikTeX及WinEdt) 9 p& \: h3 b3 |新人不必纠结软件问题,随便什么软件随便什么版本只要下载下来能编译出pdf来就可以,先下载了装上来试试再说。我推荐winedt也是方便我在介绍按钮样子的时候可以统一描述。- k t0 y) {. t
$ A' e/ S7 w6 r. L; S. ?8 l4 @( ^
2.第一个文档 2 D y3 m3 n8 \8 S( s打开WinEdt,建立一个新文档,将以下内容复制进入文档中,保存,保存类型选择为UTF-8。 ) j! I& N; t% M* H; y 9 f3 j& C( j+ z, X4 C# M\documentclass{article} 9 W7 s- C. Q. p, ]% E M
\begin{document} + P6 y- d1 c* m E" m! j hello, world 3 F6 h6 i( Y# {5 |( }+ e, n
\end{document} * i: W# S% |% Q9 W# v2 W" M. c0 @$ s2 k9 T3 N
然后在WinEdt的工具栏中找到编译按钮(在垃圾桶和字母B中间),在下拉菜单中选择XeLaTeX,并点击编译。 如果顺利的话,我们就可以顺利生成出第一个pdf文件,点击工具栏中的放大镜按钮就可以快速打开生成的pdf文件。 & a5 R7 E" q; u, T- `5 {4 R2 G8 F( f/ N0 Q6 ?
3.标题、作者和注释 5 N/ `' ?( u$ d2 ?
建立一个新文档,将以下内容复制进入文档中,保存,保存类型选择为UTF-8,编译并观察现象。 ; r7 e# w) i) e5 W9 B* l: Y8 I' d. H
! y9 S7 L+ @- W' Z5 w/ I
\documentclass{article} 2 F. U) Y1 }: ? \author{My Name} + d8 ?! ^% I2 P% N \title{The Title} 7 V! N) K9 w7 T" d& ^
\begin{document} , l. B! ]. f v. a \maketitle + }$ v- Q5 D% ?0 K. N, g hello, world % This is comment : o8 Y+ D: \4 i$ Q* ?: s) J" o
\end{document} & S& W1 _4 m/ H$ e' F+ ~$ b. V%意为本行右边所有内容被注释掉,在生成的pdf中不会显示。 ; y( x+ L; w* T$ b: V _4 o- O E# O. _
4.章节和段落 ( L0 a' r- _9 P: C5 R) S7 ~) K建立一个新文档,将以下内容复制进入文档中,保存,保存类型选择为UTF-8,编译并观察现象。 % }3 q+ R$ b2 b+ i$ G& Z3 v; x" Q/ e- L, z
\documentclass{article} 6 y, y# `5 k. ~3 u \title{Hello World} / ?. ?, u# n6 h5 ?& s3 I
\begin{document} 0 b' @- e. J$ Y M$ P \maketitle & I& i$ E o( P/ s \section{Hello China} China is in East Asia. - E0 q2 \2 V/ X4 X! Z' M- e6 G
\subsection{Hello Beijing} Beijing is the capital of China. & W/ U0 y* L0 m# w
\subsubsection{Hello Dongcheng District} 2 A2 J+ L8 ?" R2 E/ S1 t. v8 F
\paragraph{Tian'anmen Square}is in the center of Beijing # r. p4 u R6 S# p7 A1 M
\subparagraph{Chairman Mao} is in the center of Tian'anmen Square : \; T( M ^4 G/ q& Z \subsection{Hello Guangzhou} " {6 F' _7 ~4 H
\paragraph{Sun Yat-sen University} is the best university in Guangzhou. ) h) }, o9 } g" p( G5 x
\end{document} , K3 ^6 a" u6 f 0 t* O& \( |" m5 Y2 t7 F* e退格只是为了看起来层次清晰美观。实际操作上未必要如此,每一行之前的空格不影响编译生成PDF的排版结果。 ; x) F; @) w8 Y% R$ Y. ?
) \8 l4 F$ w/ }2 F9 F# L0 a( x
5.加入目录 ( ~% N- u5 Q' V" T) n- P+ P建立一个新文档,将以下内容复制进入文档中,保存,保存类型选择为UTF-8,编译并观察现象。 ; [# |% b: A' e
- @- n! f+ R7 v4 \4 V+ v3 K
\documentclass{article} : z2 I% z5 f$ z b D\begin{document} : g9 g5 l' ^ U- r \tableofcontents ( I% v; O* }4 E0 C- @
\section{Hello China} China is in East Asia. 3 K; @0 h4 P$ b3 R+ j) v2 n r
\subsection{Hello Beijing} Beijing is the capital of China. & k( |' [- ^* c
\subsubsection{Hello Dongcheng District} 8 W# D2 t4 x+ C2 Z
\paragraph{Hello Tian'anmen Square}is in the center of Beijing 9 a; V- l( m0 }
\subparagraph{Hello Chairman Mao} is in the center of Tian'anmen Square 2 O6 \. W/ r/ Q6 G' g" s- w! Y
\end{document} . I" p6 j2 E6 D! O8 F6 o% ]' S7 \+ h d1 A7 Y o+ R/ o# M' l
6.换行 / C, \+ v: W2 @) `4 n
建立一个新文档,将以下内容复制进入文档中,保存,保存类型选择为UTF-8,编译并观察对比现象。 - A4 w) l* |5 _- x' X- Y& N& [3 \5 j- X) ~, Q' d
\documentclass{article} 7 l+ V- T0 H, y$ W+ z" x7 X) E0 \
\begin{document} ) b5 |# q1 R2 T' t$ ]; T2 m
Beijing is & s7 ~4 P6 Q. C/ H" P) p1 l; ~ the capital + w; L3 d+ {; r' O* E9 i
of China. - a6 H" c% a4 l* y
- ~( j* ]# D3 Z# v( H& @7 q
Washington is + N& u9 l- I! n. ^2 y& K
) N& b6 |' h7 \5 a7 ~
the capital 4 K1 q( }5 `, e1 f1 a$ W
& ~: j/ R7 d# V9 t& | l3 d
of America. " Q) x4 W% j% M5 c9 Q/ t2 @ ! @- n. G9 V5 `# e Amsterdam is \\ the capital \\ # |( u$ I; I$ m. w5 i& w5 e
of Netherlands. . C& A0 Z$ C9 r9 Q" T
\end{document} 7 v2 J- i3 `1 C! ?: Y+ R3 c! L, V' W: N$ G! L
空一行为另起一段,\\为段内强制换行。 5 H: t* u8 Y2 K4 O" V% E: `我对之前手滑写出New York is the capital of America这类低级错误表示非常抱歉。8 k8 F& i5 v& P- _3 L
$ H5 ?8 @9 M; ]6 k7 @: Z7.数学公式 # B0 T( v) F' G/ a. w) i/ q/ a
建立一个新文档,将以下内容复制进入文档中,保存,保存类型选择为UTF-8,编译并观察对比现象。 1 r8 N/ Q: g( c5 k+ m5 @/ x$ g, U$ [2 G( @
\documentclass{article} 6 p& F2 n5 ]* s- i: D, g: e0 B; T2 r
\usepackage{amsmath} $ U- V& b* t/ f- u: f \usepackage{amssymb} 1 s5 u0 _, M" V) e. K' Z. z6 s
\begin{document} 8 b- b! r) h$ q, d1 u2 x+ s' z
The Newton's second law is F=ma. 9 ?* @ @5 D( \4 t" b9 R' o% d
7 o4 t0 d4 Y3 @$ \ The Newton's second law is $F=ma$. $ Z. [! Z. ^. _5 _" {
8 @/ Y7 b/ x; d) t& I9 `& }
The Newton's second law is $ d# J1 ]# ]: Y $$F=ma$$ 5 ?4 Q: r7 K' I4 v6 {6 N
0 i; W+ c: r; P R# n6 ?+ N% g+ q, l n
The Newton's second law is " d0 J* i, Y5 Y, h9 V6 U' X& y \[F=ma\] % v) G( U5 q9 b( k+ G( l( R/ R