- U: U3 n1 ~. _9 S7 ?
注:文章里的代码我自己测试是可以直接复制进winedt编译成功的。但是有朋友反馈说编译不成功,检查后的结果大概是在发帖的时候,排版系统自主“智能”增添了一些换行符制表符等类似物。因此如果直接复制编译不成功的时候,请尝试手打一遍。(*^__^*) 嘻嘻…… + v* e/ E s) x% R+ N/ z4 e) g. j0 D: u9 k" S9 ~/ y
1.LaTeX软件的安装和使用 , J2 B6 p$ U9 O+ C# h- ^% {4 C: Y+ G- E- A# {
方法A(自助):在MikTeX的官网下载免费的MikTeX编译包(150Mb)并安装。下载WinEdt(9.5Mb)(收费)或TexMaker(32Mb)(免费)等编辑界面软件并安装。 4 M$ l5 D6 W' P方法B(打包):在ctex.org下载ctex套装(203Mb或1.3Gb)(含MikTeX及WinEdt) 7 i1 R, T. ?* [, z新人不必纠结软件问题,随便什么软件随便什么版本只要下载下来能编译出pdf来就可以,先下载了装上来试试再说。我推荐winedt也是方便我在介绍按钮样子的时候可以统一描述。 6 D9 e* m# O/ {9 e ^0 e: d , P% h' f1 k% g: ~/ m- y% N' j5 ?4 l2.第一个文档 1 A6 r6 S6 U1 g2 t4 p& x$ y
打开WinEdt,建立一个新文档,将以下内容复制进入文档中,保存,保存类型选择为UTF-8。 & U" r" e, q. p+ }/ f& V & j* A4 \- e# c" ~7 w\documentclass{article} 1 x! ]. k) C4 `8 H\begin{document} ' ?4 |" t2 O& r1 J! l7 ]
hello, world 6 \8 k# a' s1 i
\end{document} ; k& u0 L/ w0 O# Z
, m& g1 b- v5 b) ~
然后在WinEdt的工具栏中找到编译按钮(在垃圾桶和字母B中间),在下拉菜单中选择XeLaTeX,并点击编译。 如果顺利的话,我们就可以顺利生成出第一个pdf文件,点击工具栏中的放大镜按钮就可以快速打开生成的pdf文件。 ) h7 a" b" V* A% g( |
. w/ K! J2 D, R# r2 i3.标题、作者和注释 ) q) z* x/ ^# l9 ^) A2 N4 c4 C
建立一个新文档,将以下内容复制进入文档中,保存,保存类型选择为UTF-8,编译并观察现象。 : {) D$ t$ V0 l, N. O & i9 Y4 f0 Q" T5 a\documentclass{article} # w, S6 A+ N+ E0 W8 v4 b+ o \author{My Name} * P! f! }' Z* v+ c) d( A \title{The Title} 7 C% a( x# c' f1 j" X1 M& E\begin{document} , G R( q* y- ~! R3 ?1 w
\maketitle 0 [5 B0 L4 k% J hello, world % This is comment 2 @ W5 D; Y, l: N# X
\end{document} 5 Q% K. i3 S+ u6 ?' l%意为本行右边所有内容被注释掉,在生成的pdf中不会显示。 3 \5 _. B- |, ^- f" A X- c5 ~2 C8 W$ y4 [: z
4.章节和段落 : n$ E" W2 x9 x! @& W
建立一个新文档,将以下内容复制进入文档中,保存,保存类型选择为UTF-8,编译并观察现象。 * L0 }: W9 `7 L5 D. J; ~# l- |+ {& H2 b c, p5 `
\documentclass{article} 4 P( V+ \1 w1 k. N+ T0 t \title{Hello World} , b! e6 n2 A- a" a6 e4 h* e
\begin{document} 4 s" R7 V- P9 [: r% _. V2 b$ G+ c
\maketitle " N# x- O: V; L% Y# V# B \section{Hello China} China is in East Asia. ) {2 \9 D& j# T) m* c, G( @ \subsection{Hello Beijing} Beijing is the capital of China. 7 L: y+ K7 `9 n7 g6 k \subsubsection{Hello Dongcheng District} * Q& R1 [3 K* o, O) p6 k3 { \paragraph{Tian'anmen Square}is in the center of Beijing " h U7 B8 u8 J! @
\subparagraph{Chairman Mao} is in the center of Tian'anmen Square . Z: M2 L! Y- r1 f/ }( C
\subsection{Hello Guangzhou} 1 g: l# O. B, N/ V4 e
\paragraph{Sun Yat-sen University} is the best university in Guangzhou. ) w; g. Z0 m b1 |+ {
\end{document} " m8 P3 _$ O$ O4 l3 S6 x* _8 e
2 u/ J" h# G2 d$ t9 q. {! a退格只是为了看起来层次清晰美观。实际操作上未必要如此,每一行之前的空格不影响编译生成PDF的排版结果。 " v6 l# q# @- @
6 K9 _7 S+ i6 q1 h; n
5.加入目录 & F$ _5 E- S9 P建立一个新文档,将以下内容复制进入文档中,保存,保存类型选择为UTF-8,编译并观察现象。 5 r7 F& x+ B7 `( R( ~; ^ : v; w1 {, K. H& U2 G9 P" E\documentclass{article} , I/ q2 Y* C7 x8 ~ r
\begin{document} 7 g3 t/ L7 M. J5 r$ p- e; W
\tableofcontents - P8 H" i$ q, J# T1 ]
\section{Hello China} China is in East Asia. ) I$ k; P2 P/ y8 L; ~! S \subsection{Hello Beijing} Beijing is the capital of China. - k$ L7 x- R- w { {3 ^6 e: n \subsubsection{Hello Dongcheng District} - {/ @* @' t& G h- {+ }, E \paragraph{Hello Tian'anmen Square}is in the center of Beijing : z" v+ G% }) N, `6 _ \subparagraph{Hello Chairman Mao} is in the center of Tian'anmen Square , y5 l X0 k" @& a* x. X\end{document} - m) I q @# B: ~% R" ^1 W $ Y$ X5 _- B$ ^, m S* v6.换行 / c' I9 d& j; R8 Q0 N: M
建立一个新文档,将以下内容复制进入文档中,保存,保存类型选择为UTF-8,编译并观察对比现象。 3 H& H3 V4 u( l; W7 C) I5 v 4 @3 }& E# @7 v7 Y\documentclass{article} 2 ?- r0 C7 I I$ f( C% [+ y
\begin{document} " T# V, C1 ]2 e5 B# \
Beijing is % @1 w1 G8 m6 F0 q2 ?: _" F) g1 C
the capital , `4 C, `; @$ d: l
of China. 1 M* R* u; n- B
0 S' J: I% c8 g) L9 i4 ?# m9 \; j$ d* ?
Washington is 6 f- F0 O3 S9 K. _% H
* Y# U c8 g, @ A
the capital & a3 Z; Z. W) N4 C- [7 M
1 W% C$ L6 X; a0 m
of America. ; F9 K9 n1 m' N5 @9 ~0 [
: a8 ]/ h( g3 G$ v Amsterdam is \\ the capital \\ 7 D7 r: W+ @% q
of Netherlands. - ]# B3 h/ H1 a. D! N) q\end{document} 7 H$ o; s" h3 V+ [( b* V! z3 F' ~1 N0 k
空一行为另起一段,\\为段内强制换行。8 z0 s2 H5 p1 o8 Z& }
我对之前手滑写出New York is the capital of America这类低级错误表示非常抱歉。3 x* s- _/ u5 Z; `; s1 H
: d( ~, |+ O: g) ~1 X
7.数学公式 # H( W/ g7 L2 ?$ S建立一个新文档,将以下内容复制进入文档中,保存,保存类型选择为UTF-8,编译并观察对比现象。 , r) {2 }1 h" n* @0 d : ~( A5 m$ H0 E5 W\documentclass{article} : u( g7 Q$ U2 s' [/ C
\usepackage{amsmath} W1 R# `, C$ ?/ N \usepackage{amssymb} ) Z0 A) r0 o$ i: p- e( G
\begin{document} 9 y/ Y- o9 E Y# Z5 G* [
The Newton's second law is F=ma. 9 n6 M% Y! f4 [7 Q. M % t8 a9 }. h+ f3 M! n The Newton's second law is $F=ma$. + m1 d! C/ M/ K; R5 Z4 ]9 W- J5 i . @. _5 x8 d7 T" o5 u The Newton's second law is 6 O7 k8 b% }2 Q* X; C8 T: b( B; S$ r $$F=ma$$ . W/ D' J% U! h: M! d1 b& B& g5 l, K# P- J6 y
The Newton's second law is , _6 V. }) m* P' e/ T* c: Y
\[F=ma\] $ |& w5 H' c/ l$ f / z" W: v! T9 ~6 x" m Greek Letters $\eta$ and $\mu$ * q7 z; f4 \9 X( m% T9 x0 T, W ; \1 E8 T1 s Y# F7 a1 Z Fraction $\frac{a}{b}$ % ?5 b. u: N- R# }9 U
7 {4 J3 f# J! s+ B: B; M" G Power $a^b$ + N5 r& B% |. l# h7 `
3 o- k/ y& |$ e- y Subscript $a_b$ 0 w* N. G1 Y7 s0 c- e # I& H# v. X8 W- x8 ^ K8 Q" o Derivate $\frac{\partial y}{\partial t} $ & j6 C, M6 N* Y, j6 ?! R, h
/ p! Y7 ?+ ~, t, w Vector $\vec{n}$ : @& y- c/ V r+ o) d" V! ]: u
" z8 c& M, I5 _8 q
Bold $\mathbf{n}$ 5 K$ o4 | e* ?6 z9 r$ m' Q' `+ ?9 H+ z
To time differential $\dot{F}$ $ ?1 N) E+ n/ X& F) ?4 F( @4 ?! i. k7 h/ j" M% h) V; p
Matrix (lcr here means left, center or right for each column) 6 |+ T6 I' N: Y
\[ 0 r: v" O) x' A3 d) P
\left[ 4 l8 J& U8 r1 p6 O" D. F
\begin{array}{lcr} # `6 n0 f# k$ A) _0 P
a1 & b22 & c333 \\ ; I! [1 d* W; K( f3 V d444 & e555555 & f6 $ @. e! s, l I( u. r! ?
\end{array} 1 o4 \- p+ c" Y \right] ; J; M9 V% e. t/ B, C0 y# l/ z: g
\] 1 ~! F- g# K& {9 `* N/ K6 f% w" b F' p$ ?+ k, o
Equations(here \& is the symbol for aligning different rows) ; s+ E5 b1 E" J, ? l0 ?, S, H\begin{align} / d0 `! i! L4 d- E* e
a+b&=c\\ " |: t3 p) N+ G% e( S
d&=e+f+g 1 Z, U/ F( |5 x$ M: J\end{align} _( {1 n/ m% }3 `! S) D# q; M) f, J2 E) o( h& R/ I* Z& ?8 A0 g
\[ 7 Y3 M/ K! \# ]3 A X. ~ f \left\{ " b% k: e8 o0 A4 Q. n* t7 @
\begin{aligned} % i4 X1 d" D3 P+ ~
&a+b=c\\ 0 }2 g! _) a0 U7 |& }
&d=e+f+g 3 Y; ?& f$ ~9 l; ? \end{aligned} " F. Z# g H0 b. l$ e \right. 8 Y' R1 f0 V% B$ p* N# a\] 1 N a4 J$ t$ o$ ~7 b& D
b5 n1 t. O% o) U$ y\end{document} k" Q$ g! U [( s! U* c d4 X3 _