5 y( P& W0 [4 u2 U7 T |\documentclass{article} : [+ ]$ |$ {+ V; [% l2 Q# i+ t \author{My Name} " \/ E0 X. M7 u) `4 [: p s
\title{The Title} - ~) M/ S2 g# I5 x\begin{document} 9 m" N/ ?% g/ R$ K \maketitle : Q* r/ k7 c* w$ r0 x- `+ z
hello, world % This is comment + y( j# D4 O/ X' b& c8 X\end{document}2 S) j6 L7 N% g6 l
%意为本行右边所有内容被注释掉,在生成的pdf中不会显示。 ! S: R8 J- b/ m: s' d ! T0 u5 |- g& W# u4.章节和段落 . P* }( y6 F- s
建立一个新文档,将以下内容复制进入文档中,保存,保存类型选择为UTF-8,编译并观察现象。 8 Z7 @8 ], X, o
! [$ v0 @ h" E2 j" L- M0 n\documentclass{article} 0 k8 D* w' h/ F( U) @1 }4 U6 L$ W \title{Hello World} - `# \- @$ X9 N\begin{document} 0 ], j/ S) N; O v& C
\maketitle , F4 f: L! t6 S, i3 j. h& B9 l
\section{Hello China} China is in East Asia. 4 o- ? \% O2 H: J; J \subsection{Hello Beijing} Beijing is the capital of China. 0 r/ A3 i! a$ t" d' Y
\subsubsection{Hello Dongcheng District} 4 O i( K6 \( h/ @+ q) Z \paragraph{Tian'anmen Square}is in the center of Beijing 7 c9 P, X+ B! j ?: y! P# o
\subparagraph{Chairman Mao} is in the center of Tian'anmen Square 6 a0 ?/ e1 m0 m% [5 j# E \subsection{Hello Guangzhou} l# M+ h) d0 j& _7 y \paragraph{Sun Yat-sen University} is the best university in Guangzhou. ' Q4 ]" Z) J4 `9 j1 j: H x) U
\end{document} $ W7 p5 R1 O1 C7 E5 f
9 E- k5 ^+ z9 g3 E4 A- e. d# j7 R退格只是为了看起来层次清晰美观。实际操作上未必要如此,每一行之前的空格不影响编译生成PDF的排版结果。 $ m, O. c9 f7 f/ d' _: t% k# t$ s! z# v; k5 P& W% t
5.加入目录 + M, N) b3 Z- E/ R0 E' o- p: l
建立一个新文档,将以下内容复制进入文档中,保存,保存类型选择为UTF-8,编译并观察现象。 5 M6 i( L0 \( e& A& L7 j3 N 5 \0 a. `! o) a z Y" R I D) \/ h\documentclass{article} ; Y. u3 n8 @- O; v, Q+ {2 L- ~\begin{document} " a4 X: A9 e. E, I
\tableofcontents " M8 S9 }: t6 H
\section{Hello China} China is in East Asia. ) r8 f4 j+ _/ P \subsection{Hello Beijing} Beijing is the capital of China. 4 L9 l( ^5 t$ C3 x9 }3 Z/ M" ~
\subsubsection{Hello Dongcheng District} : _: w( _6 C& J; O
\paragraph{Hello Tian'anmen Square}is in the center of Beijing " R8 k, |6 [4 K \subparagraph{Hello Chairman Mao} is in the center of Tian'anmen Square * b% Z: L; j7 f; a% R4 W\end{document} 5 I5 ?0 E3 N! O6 x" d' Q4 N$ \$ `6 k% r
6.换行 . D3 ]' e% m- ^; V0 a$ |
建立一个新文档,将以下内容复制进入文档中,保存,保存类型选择为UTF-8,编译并观察对比现象。 8 Q9 G5 f+ p2 b# X: t 6 d; u. v0 W9 M0 t" e" J% [- }; l\documentclass{article} ( ]$ n r$ C9 _( T/ t\begin{document} 3 [' y7 B6 I- c/ f3 c) U
Beijing is ( }0 I! k( ?! V( c& I! K
the capital 1 J: S7 d$ }4 S# T of China. : V( M* E% Q+ W1 B+ V, g# w 1 o+ v; R, ?* J5 x. h g2 J Washington is 7 V) q9 V7 b" c+ `- t5 [2 e
8 ?; c8 Z- I u; o, b2 ?3 n8 ~( z. U5 ] the capital : I' f+ U3 W5 e2 r2 ?! W ^0 Y$ y3 } 6 n1 Z& F" x8 W) t' Z4 C! e9 D of America. / |* c; y2 P, O9 y
! K# l6 d& _8 q7 @4 E
Amsterdam is \\ the capital \\ 0 J, M$ o9 h8 ]4 p
of Netherlands. % N- [. |0 t1 v4 |1 w; S8 ?4 M
\end{document} " l; S% M9 J! ^/ ]" i1 @/ Y $ l9 I) L! [. a/ I3 k8 b+ F5 J空一行为另起一段,\\为段内强制换行。 ' b0 d! Z; }( v# J& ?& N我对之前手滑写出New York is the capital of America这类低级错误表示非常抱歉。 / g; A) h9 I, w3 E' S, X' N. p* P) E2 H* N* n
7.数学公式 # Q- A5 X. c* |
建立一个新文档,将以下内容复制进入文档中,保存,保存类型选择为UTF-8,编译并观察对比现象。 + \6 r4 J/ P% V& [+ G9 C8 h
$ K0 [& K: s& \+ j2 [, _\documentclass{article} . Y8 }" _) E# j' O, o% t1 P \usepackage{amsmath} % N6 {) f; c, M \usepackage{amssymb} - }1 A1 k1 S k; t- T! X2 y\begin{document} 3 C; Y( b* e! u8 `- j
The Newton's second law is F=ma. 7 S7 i w2 f. I: b. y- D, c, W: [0 E Q l8 M& H# @. B
The Newton's second law is $F=ma$. ' O" C1 [+ B$ E& P * |5 U# ^; @4 W The Newton's second law is - h* ?* d. a) ?( G8 q& E) T
$$F=ma$$ 5 x7 @0 ^# Q. a; n4 M
& f0 V" @, g: i Q5 H! X5 i The Newton's second law is 7 S5 ^1 O/ r% G; c1 b' \8 t- V' F) N \[F=ma\] $ Q: F9 n+ t) _" M# V M- j j A4 q1 D, }6 N
Greek Letters $\eta$ and $\mu$ 3 _4 n) i& X; G. E) ]; _: W/ U F$ h' v 5 H. K d, B; Y, ` Fraction $\frac{a}{b}$ + P O8 \2 ~: N8 L- n
6 y$ [6 A2 @9 { Power $a^b$ 3 B8 q8 V% ~+ o. b* O " m# l0 h$ A2 \7 f; e% p Subscript $a_b$ ' p# U3 J/ p, G2 a, T9 O* L& [. w
! w9 @ S0 l" a$ O e
Derivate $\frac{\partial y}{\partial t} $ 4 b- `9 b1 i! [) i i2 E8 T& m
! V, a( B* ~+ U& p- b) @
Vector $\vec{n}$ ' C* {- `; D8 O8 c3 a# H0 X# {/ W, M! f0 z( F( H% [/ I
Bold $\mathbf{n}$ 8 f" y2 F) C7 @" T, S' `) w+ z
$ f& S& f/ ^; `4 u
To time differential $\dot{F}$ , W% f! \1 {4 q' b
8 Y( d3 V4 W! u1 t- a" f Matrix (lcr here means left, center or right for each column) . q4 V" u" H2 @8 _
\[ 6 }# f- a2 Z4 k
\left[ + f. v0 e: f. U* T# s' G
\begin{array}{lcr} . z+ V9 }1 [3 C# Y
a1 & b22 & c333 \\ & J2 h* n6 v6 [
d444 & e555555 & f6 3 g1 x- k' V p" o+ E* K0 w* c \end{array} 6 r& C: R& Q& z" \
\right] , j; \. v( f6 o! \5 i \] 9 c( u* l( X5 ?8 F0 z' c1 b
, n- c5 E% T, k! v& d8 T
Equations(here \& is the symbol for aligning different rows) ' r8 X; ]7 w1 F
\begin{align} , ]: ]. |4 t& W0 n+ K0 c* E a+b&=c\\ ; E1 S: _. G5 s/ o$ C# o d&=e+f+g . i4 b; z3 P, M- P; L+ C
\end{align} 6 Y9 q. u4 @: X! ` " P% \( n* F* ^( K2 R; ~; C/ O\[ 3 Y& T1 O2 m' W# ~" y \left\{ 9 c1 _ x( z4 N/ K5 a
\begin{aligned} 0 T. P2 Y) s% L; C9 ?: Y! f9 ^/ { &a+b=c\\ , [3 ]5 B0 l: Q/ h/ o5 C
&d=e+f+g 1 F9 I) E7 B8 o: z \end{aligned} ! I V- o, r, s) s! h: v \right. # }% k3 ]" H p0 H\] 0 I+ _$ r+ }% L! T- q/ ~, w6 E' M
4 z4 g; M5 y r; h" ~
\end{document} 2 v3 M% g4 F/ S6 o
( n i6 o, O" j# \0 s具体细节可以自行搜索LaTeX的数学符号表或别人给的例子。 0 i! J' c7 \' L$...$是开启行内数学模式,用于和文本合在一起使用。5 X4 A. U) e4 M/ n& }
$$...$$和\[...\]是另起一行居中开启数学模式。通常用起来差别不是很大,不过$$会修改默认的公式行间距,有时可能会对文章的整体效果有影响。 3 F0 e6 f% J5 p" T 8 K6 W4 V; [$ t/ z! YPS:有一些网站可以通过画图的方式来生成公式,有的编辑器集成了各种数学功能按钮。这对于公式需求少的人来说很方便,具体信息可以自己去搜索。但是如果你的文章中要出现大段的证明过程,就会发觉还是要老老实实地google一篇latex数学符号表,然后不懂的去查代码,自己用手指敲来得干脆利索。再进阶一点,可以去搜一下有关LaTeX的自定义command的内容去看一下,在敲公式时能省很多力气。1 A+ k9 A; i# J9 M9 ^+ n2 C9 z; l