标题: LaTeX新人教程,30分钟从完全陌生到基本入门(转) [打印本页] 作者: 千門公子嘉 时间: 2013-1-21 14:59 标题: LaTeX新人教程,30分钟从完全陌生到基本入门(转) 对于真心渴望迅速上手LaTeX的人,前言部分可以跳过不看或只看粗体,直接跳到正文。' i L2 [5 v9 M; {, x, \& ]
2 o. |( h1 I- Y1 r$ p & V T2 f% E$ K0 Z @ u , g5 O. w& [0 L; P H, r# \# P9 |0 K这是一篇面向对LaTeX完全无认知无基础的新人的入门教程。 - u( ^9 t/ d( [" h, V
这一篇文章中,我追求的是极致的简短和实用。 + q, W _. _" S! D/ J. w我希望能够帮助新人能够用最简单快捷的方式,轻松入门,能够迅速使用LaTeX完成基本的文本编辑。 * g/ f+ t1 @6 \) c
在我初学LaTeX时,我自己有着很强烈的感受,对于新人来说,LaTeX其实不缺少长篇的系统论述的manual,但是缺少简短的step by step的一个example接一个example的有操作价值的tutorial。 ! Z2 X( R: y: T K+ {. x. l3 d3 {6 q
我想大多数人接触LaTeX的原因都和我一样,只是论文需要,并不是有多么想去当一个杂志编辑。0 n9 @$ M6 \) C) K. E
$ g% ?( v5 R; q y5 I. k6 E. O因此这一篇tutorial的起点为零,终点到满足写一个proposal就为止了。 / \* K$ K2 G6 ^3 b 4 H4 _+ I6 ~# d' K3 a$ P& [同时这一篇tutorial的内容只涉及信息的撰写和录入,不涉及排版美化。" i4 B" G# e' `7 a5 R, u3 w7 @
* b! W, m" W8 L% x1 J R6 H# I) {! k( M; Q1 O+ X" O) ~# ?- Q
4.章节和段落 . r( e- p7 i: K建立一个新文档,将以下内容复制进入文档中,保存,保存类型选择为UTF-8,编译并观察现象。 5 S5 d# j$ `9 o: ?' R! N$ Y3 @7 Q5 p3 X
7 X8 ]- n. b9 D& f, j4 {
\documentclass{article} # t7 r0 i/ g7 X5 ]9 L
\title{Hello World} 6 E+ F' t6 O6 Y* X. w+ Q' k
\begin{document} . F# p8 {, m7 H r0 P% u \maketitle : }& o' y5 O) a) ^
\section{Hello China} China is in East Asia. - b0 C# G( y; @1 L0 G* A9 u- A \subsection{Hello Beijing} Beijing is the capital of China. 4 h+ F7 I; Q! q8 g6 K8 F
\subsubsection{Hello Dongcheng District} + n8 q8 H+ o2 u/ ^7 G$ } \paragraph{Tian'anmen Square}is in the center of Beijing 1 M- T8 z* L6 K- J4 t5 V
\subparagraph{Chairman Mao} is in the center of Tian'anmen Square & S- m1 K. @( L7 b
\subsection{Hello Guangzhou} + n: ?6 D6 ^3 u. J' r4 Z3 q4 m0 t
\paragraph{Sun Yat-sen University} is the best university in Guangzhou. 1 I$ C2 [4 q; t! u% b* `5 Q\end{document} 7 R. x5 C0 \$ g# A3 g
. {: y; Y' G) E) z% d' S
退格只是我个人偏好,看起来层次清晰美观。实际操作上未必要如此,每一行之前的空格不影响编译生成PDF的排版结果。 5 V; Y: q l( G; ~$ ?- S
. b! u4 z2 X j9 K$ q1 W8 m( R0 Y: m3 z7 H
5.加入目录 " k( `1 i% k2 Q/ M S1 W# r建立一个新文档,将以下内容复制进入文档中,保存,保存类型选择为UTF-8,编译并观察现象。 4 R3 Y" i) C9 h9 E! P% w2 f# e: G2 k
$ Q8 o0 G8 F. t' N! I l% Y
\documentclass{article} ) c& U( E* J3 U7 T/ ]
\begin{document} # a- [" `) X# C( L
\tableofcontents 6 F4 K3 a" g- p. x* J \section{Hello China} China is in East Asia. - L/ \+ I, V! D1 N
\subsection{Hello Beijing} Beijing is the capital of China. 0 L" B6 I& @: \6 \# a. K8 t
\subsubsection{Hello Dongcheng District} + N" j7 N% [& h# i' p4 k" \ \paragraph{Hello Tian'anmen Square}is in the center of Beijing / W. y, l' [& n( W. Q
\subparagraph{Hello Chairman Mao} is in the center of Tian'anmen Square 3 r8 j8 n/ O$ ~! R) f, k5 n\end{document} T& F5 l. E8 t0 q8 v
+ `! b* `0 U3 `( v
6.换行 ( W# i9 _6 o" s1 }) R
建立一个新文档,将以下内容复制进入文档中,保存,保存类型选择为UTF-8,编译并观察对比现象。 - T5 D; v/ t+ K$ n) Y2 }\documentclass{article} 6 q6 F+ K# n0 R' b- c! s\begin{document} / ]; u4 i; }% T5 { Beijing is q4 k" L2 u _/ N
the capital * F, K! u2 E" \& r
of China. - a2 C. D# Y) x& U. d$ D# M! R3 o5 i
New York is ' o+ u9 t5 F5 i* g S
9 ?# B+ L- Y$ u: O) R* u4 G# l
the capital 5 e; s( Q% E9 ?4 p# \+ V+ V6 E/ v9 o5 k1 m: W: ~2 Y# k' k
of America. . g1 ]2 s& u1 v9 i/ x- ]! \# ?; H" W8 ~$ r! H' K: ?) c, n
Amsterdam is \\ the capital \\ / j. [- ? J) z. @) U' i
of Netherlands. ( ?6 e# D4 n. ]3 x I
\end{document}' g0 v7 c! @* S# B Y1 @
, a- X7 [" k3 `空一行为另起一段,\\为段内强制换行。 3 n& ~( Z. [- a7 O1 p2 l0 l. ^
4 Y9 I( B( v' ~ A/ e! K/ C( e7.数学公式 2 O( |0 l" ^% Z4 `0 l8 e: T建立一个新文档,将以下内容复制进入文档中,保存,保存类型选择为UTF-8,编译并观察对比现象。 * `; |' Z/ B8 m6 U; G
. }4 I _& K3 t( B' e* O) E1 v
\documentclass{article} & T* J! C7 @% Q3 H \usepackage{amsmath} z4 @& d; j, K. W, ]* Z$ w
\usepackage{amssymb} 3 j% d6 S. I5 L; b: B+ l$ v7 |+ b( w
\begin{document} 8 H/ z& G: d& o; t
The Newton's second law is F=ma. 5 i. t' v7 n) w! ^$ Z8 g: c # P4 P. ?7 p1 B, f) S' {" `5 r The Newton's second law is $F=ma$. ; O8 C0 X7 |$ ^. C/ P; r) A9 |- ]4 ^! z! k: R
The Newton's second law is / E" U+ r/ J' v, q4 X! `) }
$$F=ma$$ + g( P I6 N9 k! V$ c6 M/ t
8 l1 N* F: @: P5 `
The Newton's second law is 8 J+ h m3 o' @' }5 @' j \[F=ma\] + u' }6 R8 {! V$ b2 B6 a - H4 p% v& L; ?9 x" { Greek Letters $\eta$ and $\mu$ # X8 U, M a8 w8 W, F9 S
' G- J6 j7 a& z' V5 G Fraction $\frac{a}{b}$ ' m# }* I) u! a, }' y
# x" L, y7 Q) l% b2 r5 p$ Y
Power $a^b$ / A* J2 i1 g/ b9 H% p* X* V* C( r# [1 o$ H% f
Subscript $a_b$ 9 E/ x1 j3 u; i9 c' A9 h+ Q: T
- U, j( r0 _4 K& C/ U Derivate $\frac{\partial y}{\partial t} $ : b7 ~% z" q8 i$ n
2 M j9 O5 D( d7 [. s0 Q
Vector $\vec{n}$ 4 n; e/ w8 e* L- M9 V( H3 p4 M5 c s$ {3 U
Bold $\mathbf{n}$ 4 @8 X6 |1 q: P9 T: P2 _ ; Y% [) ?! {- b To time differential $\dot{F}$ 3 g, L( p3 S1 w4 u
" m7 w0 d+ {" S7 c7 E5 q- Z Matrix (lcr here means left, center or right for each column) $ s7 N7 Z2 g! M' `, W \[ # o* C# b& L& v0 a/ p! m
\left[ + F2 Q2 M2 o& y4 h" B' f \begin{array}{lcr} ' j3 r# ?9 _5 D" c a1 & b22 & c333 \\ : |" G+ c* s! ]" O1 u
d444 & e555555 & f6 P- n& l3 F; \( V; l \end{array} 2 z4 x5 J) V4 J1 [- ` \right] , V% z! D2 Y+ _
\] . T2 G6 A" [3 y" b) K( B. i1 y2 f' j6 D6 m
Equations(here \& is the symbol for aligning different rows) : V9 T# H2 e+ H( }" Z7 R& O\begin{align} 5 _' F* Z% r2 @ |0 r6 l' j* ~9 r: ?
a+b&=c\\ $ ~ z2 V3 y( X+ c d&=e+f+g ! s% _ x4 a [2 O4 P5 a/ F2 V; A\end{align} ! k2 A8 v- ]! w4 l/ S