- F9 K& y/ r; O) G* Q注:文章里的代码我自己测试是可以直接复制进winedt编译成功的。但是有朋友反馈说编译不成功,检查后的结果大概是在发帖的时候,排版系统自主“智能”增添了一些换行符制表符等类似物。因此如果直接复制编译不成功的时候,请尝试手打一遍。(*^__^*) 嘻嘻……" d* x5 Y" l) @( z" K) D
" e' n( b( f* Q$ h7 o6 [7 r5 d6 ^8 F
1.LaTeX软件的安装和使用 1 Q4 t0 \$ ]6 V1 ] : }3 A3 ^& o2 v9 P# @方法A(自助):在MikTeX的官网下载免费的MikTeX编译包(150Mb)并安装。下载WinEdt(9.5Mb)(收费)或TexMaker(32Mb)(免费)等编辑界面软件并安装。 0 h6 H" T4 @2 T, S+ ^- q方法B(打包):在ctex.org下载ctex套装(203Mb或1.3Gb)(含MikTeX及WinEdt) 0 i6 U$ M+ H7 t+ w: n& `- f新人不必纠结软件问题,随便什么软件随便什么版本只要下载下来能编译出pdf来就可以,先下载了装上来试试再说。我推荐winedt也是方便我在介绍按钮样子的时候可以统一描述。' Q# T% Q, b- x+ @: a) X
; |$ b7 [. @/ t( B+ u3 H
2.第一个文档 C7 ^& c7 a9 Z n6 d
打开WinEdt,建立一个新文档,将以下内容复制进入文档中,保存,保存类型选择为UTF-8。 ( \8 n/ W" S/ J9 U, L1 p6 v g" A! R. j+ P6 M! Y$ G
\documentclass{article} $ o/ n) [# I& r8 i+ ]- X
\begin{document} / r) |2 h' A# r: l4 F$ z' Q
hello, world j% o" T$ }7 D9 C. _0 m) C
\end{document} P; h6 ?$ l( k. G Q4 C' {7 n% A' f
然后在WinEdt的工具栏中找到编译按钮(在垃圾桶和字母B中间),在下拉菜单中选择XeLaTeX,并点击编译。 如果顺利的话,我们就可以顺利生成出第一个pdf文件,点击工具栏中的放大镜按钮就可以快速打开生成的pdf文件。 " X4 N" ^3 G& t5 H( ]( b4 e. T2 S6 y
3.标题、作者和注释 % n/ V0 Y( ~; d建立一个新文档,将以下内容复制进入文档中,保存,保存类型选择为UTF-8,编译并观察现象。 9 i' G* D' d. ]7 {# \) j: w# _0 A# S# \* Z% {/ d& S
\documentclass{article} 7 B Q! Z* X) L# b' w \author{My Name} ' R6 u5 W# O. W0 p; f3 C' J \title{The Title} 0 h# f& x7 ^# Q# b) t4 k q: C
\begin{document} : p# {, @# `* O; F$ l \maketitle - w# Q* G- A( C- }9 {: Y
hello, world % This is comment u0 C! U" t( {$ p+ [5 L! n8 J
\end{document}" H* |! F* X4 W8 H5 o$ W3 K1 D
%意为本行右边所有内容被注释掉,在生成的pdf中不会显示。 ; r4 ^) J* J& u$ \1 }* ^; o ~2 Y3 U2 A( V5 T, e: }
4.章节和段落 ' ]- k2 Q: F5 x; d3 R
建立一个新文档,将以下内容复制进入文档中,保存,保存类型选择为UTF-8,编译并观察现象。 ; n$ E. z+ E; @" c- d6 }0 ]1 r6 B4 I; Y/ a0 m
\documentclass{article} " {9 r3 p! ^2 L
\title{Hello World} 4 L/ V3 X$ I8 Q* w8 U\begin{document} 1 D+ o |# M8 F( a, f8 m$ K: W
\maketitle * J1 K: D+ [, k: p8 O+ h# o f9 @3 j2 u \section{Hello China} China is in East Asia. ! i8 w5 c" V& y# W
\subsection{Hello Beijing} Beijing is the capital of China. 7 D E% |- D% ]* j7 Z \subsubsection{Hello Dongcheng District} * |( [6 c5 F; [4 } \paragraph{Tian'anmen Square}is in the center of Beijing ; B4 w7 [" g) i+ j" {: e" \; c
\subparagraph{Chairman Mao} is in the center of Tian'anmen Square 5 c0 ~4 c' A& t/ h. T ]) J: \ \subsection{Hello Guangzhou} _% z+ X$ {3 m8 Q \paragraph{Sun Yat-sen University} is the best university in Guangzhou. 5 x0 N6 n7 {; F\end{document} 2 L4 M [7 U H! x1 B4 T( n( H- a0 c! ~) p8 D: r& F# S
退格只是为了看起来层次清晰美观。实际操作上未必要如此,每一行之前的空格不影响编译生成PDF的排版结果。 ' q* w; }) A+ q! d, z. e6 t & ~1 A( u) q( }1 L. Z" \5.加入目录 4 b. E6 O j6 c4 @! Z/ T
建立一个新文档,将以下内容复制进入文档中,保存,保存类型选择为UTF-8,编译并观察现象。 # t" C: `: C- r* a j
! H" W; [! b7 P' A: s# A
\documentclass{article} ' C6 Y+ ]! J4 G- l( Z
\begin{document} ( X3 P3 f1 ^; Z" T
\tableofcontents % N: n' k! A7 ~( R& _ \section{Hello China} China is in East Asia. / A9 z2 R8 z m0 o
\subsection{Hello Beijing} Beijing is the capital of China. + U% U: e5 @6 c5 {' l0 P$ p7 K
\subsubsection{Hello Dongcheng District} $ s3 Y& j6 M, J7 U
\paragraph{Hello Tian'anmen Square}is in the center of Beijing 3 o: d( K" [, T- k/ E$ @
\subparagraph{Hello Chairman Mao} is in the center of Tian'anmen Square 5 h$ |; @, H3 H$ B) Z\end{document} 3 z( g) p+ d! C/ W9 B; | ) @6 W$ @2 H. O" X7 b9 Q& M6.换行 5 w# d# \ b6 K' S% I$ Y( O建立一个新文档,将以下内容复制进入文档中,保存,保存类型选择为UTF-8,编译并观察对比现象。 ( c3 Z5 P6 y/ l0 H
" n. H/ J" z ^, G# F+ m0 f& I
\documentclass{article} . B* k3 ]) N& I3 O( E# n/ u% P\begin{document} % ^! C: N1 {# D, C) d3 O Beijing is $ @: i5 @$ C, V* ^3 V ?! C8 u the capital 5 H! o+ l5 i! i4 D4 s of China. / S/ f8 Q, `1 K9 T% t+ w3 N# n8 x2 \6 `/ x, {8 m5 K/ y
Washington is , E! _$ ]7 L$ f, C7 m) U4 F" Y
the capital , N. s+ m2 T7 m5 o0 ^: _( U4 V0 M' z+ e; H
of America. . u c. k6 |7 h7 _2 m1 T0 @
/ U; n% ?( M0 x Amsterdam is \\ the capital \\ ( r7 b8 v3 r+ x, \8 r, @
of Netherlands. . e6 H; H4 \8 w/ r9 f# N- w5 \
\end{document}& n6 T5 x2 g, O9 r6 I* a9 N" j. E; |
% ]6 R9 p! b+ p# _. i空一行为另起一段,\\为段内强制换行。8 J. U2 f4 I! M9 j2 R( d
我对之前手滑写出New York is the capital of America这类低级错误表示非常抱歉。* ~- G6 ]/ h: g6 h0 D' X8 W# u1 d
X0 F: q B, \8 V/ [
7.数学公式 0 V7 I' k/ u( L; L
建立一个新文档,将以下内容复制进入文档中,保存,保存类型选择为UTF-8,编译并观察对比现象。 2 C0 X/ }1 K0 B9 d! J% s* b8 v# y6 I7 K$ w
\documentclass{article} 3 m( o% ?" T; T- b
\usepackage{amsmath} }' ~1 z- X# T7 c
\usepackage{amssymb} 0 I1 F8 }: i! |" W9 Z" s. K, }\begin{document} . T; c' {4 v4 S0 [ The Newton's second law is F=ma. ( ^* G" y. n! ?# n% _1 O$ b4 J$ l% W
) u7 s6 V% M5 z/ `# T' A, p) Y
The Newton's second law is $F=ma$. 9 }* c# W# l4 S" w* f8 Y) \8 ]% P+ v$ i1 }* e
The Newton's second law is 7 W# K* K% \; h) I7 b$ F3 A $$F=ma$$ # i9 R# _; F; {* F% Z2 C 4 q$ s7 _- G l. B The Newton's second law is : E4 l+ [8 \4 \7 f
\[F=ma\] 1 U1 T! e8 X ]: b8 w
( U- }( C* k3 g$ S3 Y' u Greek Letters $\eta$ and $\mu$ 1 L: m, E6 A ~: O6 W( I) U& w! u/ H5 Q: W5 X; c4 @! d- U4 d& |
Fraction $\frac{a}{b}$ & A8 F# Z8 N! L) q/ m
2 D" H. p+ }$ h5 [% A4 S8 ] Power $a^b$ 2 |7 _1 M1 X4 O o
1 _7 f c+ |3 a' e0 G2 t% v
Subscript $a_b$ * `9 U4 m7 \/ V- U. a5 R / o( v! L; K$ ]! J7 f Derivate $\frac{\partial y}{\partial t} $ 2 V5 x1 E E8 k; h6 ` " _; T' t# \6 A$ W Vector $\vec{n}$ , Y' ?6 r/ h( k- n. ^# [ R # \7 K& J5 t" b1 B, ^6 m Bold $\mathbf{n}$ - t9 ?) k5 N# p# L* @9 _9 n4 z' j$ w# w, _7 @! U
To time differential $\dot{F}$ 8 {! b) O1 k; T: E1 a ) d: R, n! h& {5 ^/ h' x Matrix (lcr here means left, center or right for each column) 6 L B. B, W* e7 r' Y
\[ ( i7 x: s( B- w, { \left[ 0 _. f% V" [2 R9 W0 D4 T' g \begin{array}{lcr} - l. U7 x, \5 {, H' F; \3 B
a1 & b22 & c333 \\ ( X3 X& l' m4 Q. q( I1 C d444 & e555555 & f6 1 k% i: E \7 T' m- k& T5 H; y \end{array} ( z0 o! I2 c9 c. O5 |4 F' ~/ k, m
\right] + c5 M; j. S4 z \] $ \$ Z5 p9 n: C" a$ d+ x. P
3 k0 H5 \; s9 r! |! A0 zEquations(here \& is the symbol for aligning different rows) * V n5 h4 l9 j1 h\begin{align} , w; Y! y8 Q! x2 j) Z a+b&=c\\ / W* L+ l2 i) g0 G% F+ h
d&=e+f+g ; K. X) B0 d' r8 G" [4 v\end{align} ) r: U, j2 N4 d) r# q
. W# D5 i# x; S8 a
\[ % R5 f5 K, s6 c0 J( @, k
\left\{ 6 ^% o% C8 |* b4 ?8 l- i* D2 _
\begin{aligned} . l3 W" W. g% t& b &a+b=c\\ # ]6 o1 l7 L4 K, X0 R6 J5 |7 F) i
&d=e+f+g . R {. l' a: @) E \end{aligned} : |! _: n0 W2 V z) F5 i
\right. # q% W* d" {+ A8 c
\] % B8 }+ [6 e. |. S