$ n( @4 F2 [& V2 s* N4 _! W5 y9 F - L/ Z, @* v! r, `8 |: B! K4.章节和段落 , f, g# S6 n( ~% _: o n
建立一个新文档,将以下内容复制进入文档中,保存,保存类型选择为UTF-8,编译并观察现象。 5 ] T2 d$ S- m, _ }9 h: u+ r
, Z/ v6 J# ^" y x
\documentclass{article} : {5 c( J" V( f2 g3 R \title{Hello World} 5 p: f) `# }& R: |; h V
\begin{document} ! E0 w$ [( x0 N1 \. k \maketitle 6 m! X5 p& e! R$ z5 K! Q \section{Hello China} China is in East Asia. [* F2 Z0 [8 I* `- ]2 z \subsection{Hello Beijing} Beijing is the capital of China. 5 A2 S( U2 x0 a V- m$ y
\subsubsection{Hello Dongcheng District} 2 d+ p" a+ ~5 c) U \paragraph{Tian'anmen Square}is in the center of Beijing ; O1 c( U0 b2 e0 E! ^$ {8 H
\subparagraph{Chairman Mao} is in the center of Tian'anmen Square $ R. ^0 o" w# x" S) Z/ w) J
\subsection{Hello Guangzhou} # D, @& W4 |4 _( C* I8 j& J& { \paragraph{Sun Yat-sen University} is the best university in Guangzhou. # w _/ H+ U% y5 s\end{document} ) n9 ^/ _$ Q& M$ n) x1 `, @; `
- ]2 @0 Z+ c0 m0 S6 v5 {) E
退格只是我个人偏好,看起来层次清晰美观。实际操作上未必要如此,每一行之前的空格不影响编译生成PDF的排版结果。 ( R0 ?5 A9 r& X. c2 v3 k
/ _6 a' ^! Y7 C1 n2 M6 c9 ^4 q7 k! ]% |3 H
5.加入目录 $ ?: f- c! X6 o: {) Y
建立一个新文档,将以下内容复制进入文档中,保存,保存类型选择为UTF-8,编译并观察现象。 2 ^* v$ h1 u, s0 Y `+ g
( g) @2 Y0 T) b- d8 o6 a$ T( t\documentclass{article} # V3 w% e2 I5 c: H2 M& a. @
\begin{document} % C# x( Q8 c4 |1 x( h' Z \tableofcontents ; O: r3 g. t q$ l \section{Hello China} China is in East Asia. 5 u) S, \% Z2 d; v' T5 h3 A$ s \subsection{Hello Beijing} Beijing is the capital of China. % p/ t+ T- V. ]' e7 }7 q J0 a
\subsubsection{Hello Dongcheng District} ' k; ]6 [' H1 C1 A3 _+ k! V
\paragraph{Hello Tian'anmen Square}is in the center of Beijing 5 ]: B1 h% [' a3 U" f9 W' A \subparagraph{Hello Chairman Mao} is in the center of Tian'anmen Square - b& c! h: K1 Z' p\end{document} 6 `3 l7 v# ?9 f* q% N# [5 ^
1 b" y" B4 p& Q5 O( b
6.换行 ' y9 P/ v# R5 h: ~+ `) h" [建立一个新文档,将以下内容复制进入文档中,保存,保存类型选择为UTF-8,编译并观察对比现象。 9 H: \9 G; y$ H, K
\documentclass{article} 5 x. k1 f7 H8 G, w4 @
\begin{document} 9 K: R6 C3 I, P
Beijing is ' Y) E" b4 l- V. z the capital 6 r' E' g$ d4 M2 R0 ~5 G
of China. - L* C/ l/ h% M0 c2 c C! k8 p% [& Q4 ]4 ]0 V3 @
New York is 8 U; g: O4 c8 N0 ?7 ?7 R: m& h2 d
1 v1 K: c1 O/ \8 Q. Q! Z
the capital 2 S# U7 u- h' t& T. l. H2 p0 i. J, G. r: z# V. C8 |. q0 k
of America. ( X. g5 j5 b- ~- S% Y' E5 h: N
# d3 J% Y8 \3 F
Amsterdam is \\ the capital \\ $ w; y5 l3 u9 [ of Netherlands. # H' g5 o0 G1 @2 h2 L\end{document}9 o1 ^1 I0 o1 o4 o$ K$ g
) E, u" @- G4 e) o$ x- E( g/ b0 z空一行为另起一段,\\为段内强制换行。 , P* f' |( w9 P- Z* i( R
% h7 Z/ j3 [1 L8 p# {" C q/ Q, ]0 {4 Q2 [+ r6 d+ M2 ?2 H3 k
7.数学公式 & N9 \, z5 `# Q) C3 b
建立一个新文档,将以下内容复制进入文档中,保存,保存类型选择为UTF-8,编译并观察对比现象。 % E2 b, H4 I; Z+ W5 S2 L" p* ^0 d9 c1 D l; U2 [. m
\documentclass{article} 2 b7 X; I {0 F) W \usepackage{amsmath} 6 d( O, o1 E/ N* s/ U% f0 a
\usepackage{amssymb} 9 x& e4 h0 H$ H$ e3 _- M0 K\begin{document} * O& |8 J/ c1 F. `- T
The Newton's second law is F=ma. ) |' o( e4 g, r9 Z1 z7 a, [+ q
4 W5 {; V6 ?; @3 u ~ The Newton's second law is $F=ma$. 8 Y0 S& Q3 x# ^$ C+ M& {5 B5 o ' ^- P; U4 F6 u4 o( R$ J) t; V b8 o The Newton's second law is & H- P7 ~5 j, ~- f
$$F=ma$$ & ]7 a, x% ]/ J9 A% `0 \) | $ e% ~% a0 p; P$ }" } The Newton's second law is 0 ^, A: X8 F6 Q' q/ A2 j \[F=ma\] 4 O. @3 z+ B: U6 x. K8 ~5 a1 h
+ b, l% }3 e' X
Greek Letters $\eta$ and $\mu$ ) `$ N3 H3 l( q4 R6 x+ P! h + K3 Z: `) A. B" X3 t8 f Fraction $\frac{a}{b}$ 9 {4 D+ a& H2 B! n1 E : D/ ]# N4 W4 f" w Power $a^b$ ' D! r5 [- W7 I* a; l4 b& d/ @' \. ^) O" n
Subscript $a_b$ : P5 s5 v" L2 D7 K% n' m2 [
- h0 C: n0 k. K( @- X1 C Derivate $\frac{\partial y}{\partial t} $ 5 ~+ O5 i, c9 I% [
5 Y3 m3 Z, \" _$ L7 ?* p Vector $\vec{n}$ ; ?0 D! s5 v* d) ]8 | . V! m5 V4 a! B% I! Z" E. T Bold $\mathbf{n}$ 8 E0 ]! H* g$ N9 m0 p X" g
5 p& B. u* N0 L4 S, n3 x$ n
To time differential $\dot{F}$ 6 [6 _4 k' D9 I& I6 X
" u: e7 G% m' m: C7 e Matrix (lcr here means left, center or right for each column) " K- v- P( J- f
\[ 1 x+ L" `+ f/ P8 N) f
\left[ ' e1 u9 b4 A5 z q& A# e# ~
\begin{array}{lcr} , B) a s0 _1 J9 k/ w/ {0 n
a1 & b22 & c333 \\ 8 a' [) Z( i+ Z
d444 & e555555 & f6 ! ~, r* v: e2 _$ s3 T: Z |; w
\end{array} , B. ~# b/ v' l6 q/ L \right] 3 f+ v# ^- o, [: x- t
\] 3 q ?1 [( I' J6 t. G6 s' g2 E2 A& e' U5 l. ~
Equations(here \& is the symbol for aligning different rows) 8 Z7 H& a2 P! Z. O! I' R/ ?
\begin{align} ) ?. \# g, z, ^) V+ H4 u" l a+b&=c\\ 4 q' e' @6 B9 h! V+ Y9 c H; q$ O d&=e+f+g : @& r5 ^: O, x7 s; h
\end{align} & O5 u& E* |5 N2 U9 A
9 m- C5 o6 @, R5 [# ^5 I6 @3 O/ G3 y
3.模板 2 C! p. J/ v3 o: i9 [7 K) R0 X7 F+ {模板就是在\documentclass{}后面的大括号里的内容。 % `2 l0 B6 W4 S- O: Y4 G在这一份教程中,我们使用的是LaTeX默认自带的模板article,以及中文模板ctexart。 9 Z2 G1 S- C4 C! V+ R7 s5 K
模板就是实现我之前所介绍的LaTeX的经验总结的第二点的实现方式。 7 z; l, X0 o, X, M! W; c3 ^7 x& M( l
一篇文章,我们定义了section,定义了paragraph,就是没有定义字体字号,因为字体字号这一部分通常来说是在模板中实现的。 + R2 V S4 ~0 T% ?$ `2 f; n
一个模板可以规定,section这个层级都用什么字体什么字号怎么对齐,subsection这个层级用什么字体什么字号怎么对齐,paragraph又用什么字体什么字号怎么对齐。 ! n' U. @' W4 p q/ E% ^. s- M7 R
当然模板里还可以包含一些自定义的口令,以及页眉页脚页边距一类的页面设置。 7 A- `- g6 b1 M9 {$ w. t4 \) _由于模板的使用,在我的使用经验里来看,绝对不可能算是基本入门级的内容,所以在正文里当然不会提及。 ; t4 Y0 D, I6 {/ F4 I3 h# B如果有人实在想学,如果LaTeX已经接触到这个程度上了,那么再去翻其他厚一些的教材,也不亏了。+ }4 f7 W/ Y0 b' r9 T
' y( c, M# \ l+ s1 a2 u% [7 P: c1 h+ W( [) g5 u
) X1 M; }6 G/ m+ A
4.参考文献和制作幻灯片 + d4 g3 ]7 s; T3 t, ]! ~- s4 O) S& A z7 a, h- g
做参考文献的时候,文章也已经快写到尾声了。这一部分内容有点复杂,一言难尽。对这个功能有需求的LaTeX user,使用LaTeX也已经相当熟练了,自己去google一下或查阅其他厚教程是很理所当然的,一点也不冤枉。 . Z6 D; ?$ M! R" ~8 t 7 E) B# b0 t- X7 \$ F8 `在此我就只提供两个搜索关键词,参考文献可以搜bibtex,制作幻灯片可以搜beamer。7 J3 V8 u; W( i6 \
) u) \: Q' F' {2 M) v: p不过说到有关用LaTeX做幻灯片,我和几个精通LaTeX的朋友聊到最后共识趋于一点,就是除非真的对LaTeX实在太有爱,除非内容涉及到太多太多的数学公式,否则还是用powerpoint吧。毕竟有导师要求论文必须用LaTeX做,但是没导师要求presentation也必须用LaTeX做。选择LaTeX做幻灯片,对比一下其学习和使用成本,和能做出的超出powerpoint的美观程度,性价比不是很高。