# {+ @" \# ^# Q! T/ g, g, q; a- ^1 H* ^; G7 T. g: Y1 l( } k
4.章节和段落 + s$ c2 T; C: h* i. q) [建立一个新文档,将以下内容复制进入文档中,保存,保存类型选择为UTF-8,编译并观察现象。 2 _2 G2 K! @% F: F0 B
/ l7 _6 s' D4 E4 f' F4 m
\documentclass{article} . U4 F9 L2 Y' z) ~% y7 K$ l% y( Y \title{Hello World} $ n& T* X ?/ L3 B- y
\begin{document} ) V' x: B/ R( m+ q# D \maketitle / C6 F# A3 @9 F# J' m: x7 B. a
\section{Hello China} China is in East Asia. 3 e- m6 b3 e/ K8 P x' |
\subsection{Hello Beijing} Beijing is the capital of China. 3 l* e9 ]2 F. _, f1 }; c I
\subsubsection{Hello Dongcheng District} / V2 L5 J8 L; o {4 b) M. F2 C \paragraph{Tian'anmen Square}is in the center of Beijing / y& ~" ?+ I5 W* J2 @7 H" b" T2 e6 D
\subparagraph{Chairman Mao} is in the center of Tian'anmen Square 6 N: _2 K* M7 W1 h' T: u# K \subsection{Hello Guangzhou} % E* q Q5 {. Q2 g, ] \paragraph{Sun Yat-sen University} is the best university in Guangzhou. - E+ U L. y6 r$ @
\end{document} / r: T$ o0 \& T) J, S) S, E8 I* q# U ; j( Z; Q/ Y; l退格只是我个人偏好,看起来层次清晰美观。实际操作上未必要如此,每一行之前的空格不影响编译生成PDF的排版结果。 * A5 O4 x* o8 I' Z$ H$ h$ K. o# {2 W) v6 R+ N
0 d, ^" F9 N Z; s1 B% F8 R5.加入目录 , X5 v7 r1 J$ { q; Y) [建立一个新文档,将以下内容复制进入文档中,保存,保存类型选择为UTF-8,编译并观察现象。 & C" I5 }, O) O/ N' { . `4 g) f1 q' {* b0 ^\documentclass{article} 5 k8 B% H7 t2 M+ c* i
\begin{document} 7 w1 H! i% j0 [9 \
\tableofcontents ! i7 N- b4 I# _- m; ]' D4 m2 n \section{Hello China} China is in East Asia. h2 R1 c+ P# H. K \subsection{Hello Beijing} Beijing is the capital of China. * e( _. i \9 ]% b% Q( I
\subsubsection{Hello Dongcheng District} 6 F1 w& e( {' d; |; S \paragraph{Hello Tian'anmen Square}is in the center of Beijing 5 e& w1 S6 N$ t; p7 X9 a
\subparagraph{Hello Chairman Mao} is in the center of Tian'anmen Square , e* C+ D0 ^0 n8 z* C. p\end{document} 5 c5 @' {3 {- q R/ `4 e/ C# k/ ]/ s" Q6 F
6.换行 I6 Q5 i" t* I9 i
建立一个新文档,将以下内容复制进入文档中,保存,保存类型选择为UTF-8,编译并观察对比现象。 8 B% [! X# q8 x. w\documentclass{article} ' w/ x. f1 F/ z' @4 r\begin{document} 8 U& d) u0 o( k) R
Beijing is 2 W# |+ ]5 P. X, |8 q+ X7 F
the capital 6 p/ g7 l$ Z7 L0 U of China. " W9 ~9 j0 V+ J5 c
7 Q! g3 W; Y$ N0 W/ r3 w
New York is - F2 u) V2 ~9 a* z# W. L
5 D* n: ^0 \" Q* m5 v9 a1 N
the capital * D. x" K1 f' R; B; w$ @! p6 F8 a. k
; ?7 U3 ?4 H. m9 \9 y of America. * E$ V7 X. l. E" v
0 L# `* c% B7 ^2 W: @
Amsterdam is \\ the capital \\ / O/ l+ o0 X1 f( f8 _
of Netherlands. $ @! u8 f* j# c! P' o\end{document} ( W- F2 O! }7 t. a) L! T( Q+ R( o& o" s
空一行为另起一段,\\为段内强制换行。 $ j, v4 n1 l( t! e $ {! h! B$ i" g- y. v' d 5 r7 @4 k* n& W4 x; N% e7.数学公式 3 `; k) C1 z4 Q1 B; g2 o建立一个新文档,将以下内容复制进入文档中,保存,保存类型选择为UTF-8,编译并观察对比现象。 9 B5 E/ _) B# O4 s" {( W- G ]3 P; d- T2 Q( w) h2 y/ X4 {
\documentclass{article} # @' @. }/ j8 X9 }9 b
\usepackage{amsmath} ( V# q8 T$ w& p; T; J% l# J \usepackage{amssymb} 2 n. c& O) S; P8 q\begin{document} 1 V9 k" R _ \5 t* |* s4 E8 h The Newton's second law is F=ma. 4 I6 s5 }7 [. ~; V9 | . b; a: S! I& P( l& U5 Z The Newton's second law is $F=ma$. & h! a) g& u4 f) Q+ [7 u4 n: ?+ N% t: g2 G% x
The Newton's second law is & {) }" {+ e: q t $$F=ma$$ 2 E* @7 H0 l& ?
2 w: _7 C5 _' `0 _ The Newton's second law is 5 S1 X( }0 ~8 U" z. P6 \
\[F=ma\] 8 G) M6 r) B, _6 N. `" G- i 2 Y! e v' B3 \4 j Greek Letters $\eta$ and $\mu$ 4 U0 V6 K* t% l( K- R0 [6 q7 r: Q( z6 [4 a9 ~$ l
Fraction $\frac{a}{b}$ : V% g& T$ Q! T , A2 D( Y, E) \' B& }6 [3 U( v7 | Power $a^b$ - [4 h7 V3 l1 i
; }8 T( f6 T6 [9 \% q
Subscript $a_b$ $ W" _" v; Y3 H. i j/ ]6 h
8 A( O" i! `* A f! R2 ~& y& p! T Derivate $\frac{\partial y}{\partial t} $ 8 L( k5 {, C! N( v" c/ Y! M ' a; F$ [; Q- G& D5 k! J Vector $\vec{n}$ 5 E$ j5 M$ V3 x
1 m8 A( r4 D* s( k
Bold $\mathbf{n}$ , r) ~# a/ U9 A' e; q& T: k9 ~( _' w% ]% l6 x" e
To time differential $\dot{F}$ & T7 e, \0 r7 D+ @7 H7 {
% e) |* e0 y+ I7 `0 h- l' B Matrix (lcr here means left, center or right for each column) ( y( ~; g$ N& F/ p* |' p
\[ ; x3 P- t7 N0 \( V \left[ b1 \. g& [$ c% A* W \begin{array}{lcr} ! u* w1 l! ^' A* r/ x# d8 @# u
a1 & b22 & c333 \\ ) |3 z% x% n1 U& Q8 A; F# u' J
d444 & e555555 & f6 0 \7 \. H% o. m
\end{array} " x1 p( _0 E3 F \right] 2 }) z; V/ L$ {- H \] 2 h2 K" t, _0 J8 C% H0 q r 0 A0 E; r- ]5 z# M* x0 k0 ZEquations(here \& is the symbol for aligning different rows) $ ^: o5 x& t& S\begin{align} . r2 o* `; E6 W
a+b&=c\\ 5 p3 @* d% T8 l2 @$ U$ {
d&=e+f+g ; Y1 f7 g2 E( U, Q& N( C1 T! N\end{align} 2 l7 t6 s5 E0 h) r( C$ ?
% B, r" z/ J% c8 @6 x8 _
\[ % C O% y. q' U% H) ~8 B1 j) Y& L# Q \left\{ $ A% V) K. w7 m; A! A$ ]
\begin{aligned} 7 h6 N2 c# f) J1 N& ]; J+ E9 k &a+b=c\\ 7 e! i9 i2 H# c% ^4 x q &d=e+f+g ' F! s- ^ k9 K& o5 M
\end{aligned} * L: z8 j8 E3 t9 {0 m; g( C
\right. ( B4 k- c% P/ n1 y4 S+ d\] % s% A, c v9 s5 s# T1 X$ M) d7 z8 l3 E3 d
\end{document} }- C0 A" j" f/ b# I4 W% Y1 b% s' R" g v9 f3 s+ X
具体细节可以自行搜索LaTeX的数学符号表或别人给的例子。$ E5 d! r+ N8 ^3 p* n$ H
2 A: M: ?% D" R" o r& d
' k% o0 n0 V9 s' d
4 O# B x7 S& s/ ^' }# L; C
$...$是开启行内数学模式,用于和文本合在一起使用。 1 d4 ~( ?3 j5 T$ } ; z( d- }0 n; x6 O0 ?2 h$$...$$和\[...\]是另起一行居中开启数学模式。& {7 o5 V5 ?; A* c, q9 B7 X6 F
& @! q s. U+ \8 r. Y ( Y' \1 l& _8 }* o3 G
9 C$ W* b: W( n有一些网站可以通过画图的方式来生成公式,有的编辑器集成了各种数学功能按钮。这对于公式需求少的人来说很方便,具体信息可以自己去搜索。但是如果你的文章中要出现大段的证明过程,就会发觉还是老老实实地google一篇latex数学符号表,然后不懂的去查代码,自己用手指敲来得干脆利索。再进阶一点,可以去搜一下有关LaTeX的自定义command的内容去看一下,在敲公式时能省很多力气。 0 t& I% f6 u g# M7 A4 u. s& F0 z: v3 `
6 g% |4 I1 l) a7 U) i" `7 V\documentclass{article} 3 z. A" w3 l/ D7 b" f" X6 E' J \usepackage{graphicx} # ~/ H/ }* x$ B. L\begin{document} 8 x B$ ~; ^, d# U9 z/ q \includegraphics[width=4.00in,height=3.00in]{figure1.jpg} . g, h0 ]* A8 w: v D- S" T3 R
\end{document} ( h' D% z& j; b' R( T 6 ^9 t& b( w3 J: @8 M+ W在老版本的LaTeX中是只支持eps图片格式的,现在的LaTeX对jpg、bmp、png等等常见图片都可以支持。 - N5 l/ [! _; J# F1 w' U" X( j% n$ Y1 x/ y1 g1 f" m
0 p5 v& D. K A9 p# v D) d Y/ k) G* ^) v1 @. b9.简单表格 $ W$ q, b" F( [2 y V8 V建立一个新文档,将以下内容复制进入文档中,保存,保存类型选择为UTF-8,编译并观察对比现象。 4 V& T0 z* y; y/ g4 [3 K8 C
8 U+ ]! x: I) E# U2 X/ V; @3 a
\documentclass{article} : @) E t) B1 F3 Y
\begin{document} : Y, a9 b; ]" s) w3 V+ p {" V \begin{tabular}{|c|c|} ! v- E: M, T. f9 Z% F$ V8 W aaa & b \\ 5 T" V7 r! I" J) ~ ]% R N
c & ddddd\\ & Y- z& H" Y p$ V. z4 a" i7 e0 E \end{tabular} ( i9 S/ i+ t' l: _; T/ ~# m
( ^+ I2 l. h, e3 G& X9 R \begin{tabular}{|l|r|} + ?0 h6 @5 W) [3 R7 v4 _- Q) v
\hline 3 M8 K9 ?7 a! q% A1 G* q
aaaa & b \\ 0 D# ^2 t& Z6 u8 e+ ]' T
\hline % `$ D$ s9 d7 p( O
c & ddddd\\ / h/ i ?3 t2 e- a! W8 a
\hline ! L) ~1 D' g" l+ n+ P/ ]* H
\end{tabular} ; Q- \- p! s6 W+ G
0 y/ K5 Q! P6 K4 N0 i2 |3 h1 k
\begin{center} , J2 R6 O/ E6 [8 X, U/ d g
\begin{tabular}{|c|c|} $ @# L" P* I- b
\hline H" d# o; ^$ _$ F4 y7 S- i
a & b \\ \hline 1 }; T3 M. ~- K" X- @( }2 t c & d\\ 6 a# A3 P* l4 {- C \hline / N+ ]! @' ~* E
\end{tabular} : e" ^+ l3 A, R* U# o \end{center} $ m9 W% G# I& B" O) q% c
\end{document} ' y$ j2 W$ H& w9 ~% `% z1 D" ~& x8 l2 |: [5 S+ Q
注意观察有无\hline和有无\begin{center}的区别。注意观察\begin{tabular}后的lcr的区别,分别是left对齐,center对齐和right对齐。 . d; a9 w1 c4 V0 Y$ Y& `( |- O
2 `3 h& m2 H& N/ m4 ^6 y
10.结尾 G# n9 K& u2 M: t2 A/ Y8 ?到目前为止,你已经可以用LaTeX自带的article模板来书写一篇基本的论文框架了,至少你已经能够借助搜索然后复制粘贴这些命令例子来开始用LaTeX编辑了。 ' \( g. X# U5 W8 M9 O. }& V: w
在论文从框架到完整的过程中,必然还存在许多的细节问题,比如字体字号,比如图片拼合,比如复杂的表格等等。 : f! O; s( ?/ w" v& c3 y那些问题,就请咨询google吧。通常来说我们作为初学者会提出的问题,早就已经有许多的先辈们在网络上提过同样的问题了,看看别人的回答就可以。 5 h- D. r8 k* a$ ]8 }
LaTeX在国内的普及率并不高,因此许多时候如果搜英文关键词,会获得更好的效果。 , O7 \, _0 g+ f: U0 h) E8 s' a9 G: L+ |. \