Documentos de Académico
Documentos de Profesional
Documentos de Cultura
Mc lc
1 Nhng iu c bn
1.1 Hnh v cho sinh vin ca thy Karl . . . . . . . . . .
1.1.1 Vn cn gii quyt . . . . . . . . . . . . . .
1.1.2 Ci t mi trng Tik Z trong LATEX . . . . .
1.1.3 V ng thng . . . . . . . . . . . . . . . . .
1.1.4 V ng cong . . . . . . . . . . . . . . . . .
1.1.5 V ng trn v elip . . . . . . . . . . . . . .
1.1.6 V hnh ch nht . . . . . . . . . . . . . . . .
1.1.7 V hnh li . . . . . . . . . . . . . . . . . . .
1.1.8 S dng Style qun l cc thng s iu chnh
1.1.9 Cc thng s ty chn v . . . . . . . . . . .
1.1.10 V cung . . . . . . . . . . . . . . . . . . . . .
1.1.11 Biu din mt phn ca hnh v . . . . . . . .
1.1.12 V parabol, ng cong sin v cosin . . . . . .
1.1.13 T mu v v lin nt . . . . . . . . . . . . . .
1.1.14 To hiu ng shading . . . . . . . . . . . . . .
1.1.15 Xc nh to . . . . . . . . . . . . . . . . .
1.1.16 V cc ng giao nhau . . . . . . . . . . . .
1.1.17 V mi tn . . . . . . . . . . . . . . . . . . . .
1.1.18 Mi trng Scope . . . . . . . . . . . . . . . .
1.1.19 S thay i v tr . . . . . . . . . . . . . . . .
1.1.20 Vng lp . . . . . . . . . . . . . . . . . . . . .
1.1.21 Thm ch trong hnh v . . . . . . . . . . . .
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
2
2
2
3
3
3
4
5
6
7
8
8
9
10
11
12
13
14
15
15
16
17
18
Li ni u
v hnh, ngi dng LATEX c th s dng PSTrick, MetaPost . . . nhng t khi gi PGF
c vit bi Till Tantau (2006), mt phn ln chuyn sang dng Tik Z v qu trnh g
nhanh chng vi c php lnh n gin. Trong qu trnh t hc, ti bin son ti liu ny
t pgfmanual, v dng kin thc va hc v mt s hnh lin quan n cng vic. Do
, ti liu ny c th s hu ch vi nhng ai mi tm hiu Tik Z, hc theo cch Learning
by doing, hoc hc qua vic phn tch m lnh. Khi quen, chng ta tm hiu Tik Z s d
dng v nhanh chng hn.
Mi kin ng gp v ti liu ny vui lng gi v a ch email: gialuannb@gmail.com.
Xin trn trng cm n s gp ca bn!
No, mnh cng chi vi Tik Z. . .
Chng 1
Nhng iu c bn
Phn ny cp n nhng iu c bn nht, khng i su vo chi tit, ch yu l cc hng
dn cch v mt hnh cho trc thng qua cc d n n gin. Qua cc d n ny, chng
ta s quen dn v t v c nhng hnh v u tin vi Tik Z.
1.1
1.1.1
sin = 1/2.
1
2
tan =
sin
cos
12
sin
cos
x
21
Theo nh l Pitago, ta c
cos2 + sin2 = 1. Do
di ca ng mu xanh l gi
tr ca cosin , phi l
p
cos = 1 1/4 = 12 3.
iu ny cho ta di ng
mu cam tan c gi tr l
tan =
1.1.2
sin
= 1/ 3.
cos
\documentclass{article}
\usepackage{tikz}
\begin{document}
We are working on
\begin{tikzpicture}
\draw (-1.5,0) -- (1.5,0);
\draw (0,-1.5) -- (0,1.5);
\end{tikzpicture}
\end{document}
Khi bin dch bi pdflatex hay latex, ta s c kt qu nh sau:
We are working on
Tt nhin y cha phi l hnh v m Karl cn nhng chng ta v c hai ng thng
vung gc vi nhau cn thit to h trc ta .
Nghin cu chi tit hn v code. Trc ht, gi tikz c loaded. Sau l hai lnh v \draw
nhm v mt ng thng t ta (-1.5,0) ti ta (1.5,0) v v mt ng thng khc
t ta (0,-1.5) ti ta (0,1.5). Kt thc mi lnh lun l du chm phy (;)
1.1.3
V ng thng
1.1.4
V ng cong
Tik Z cung cp mt c php lnh c bit v ng cong: mt hoc hai "control point"
(im iu chnh s cong) cn phi c xc nh ng cong . Thut ton n gin
v ng cong: gi s bn bt u im x v im iu chnh control point y u tin.
3
\begin{tikzpicture}
\filldraw [gray] (0,0) circle (2pt)
(1,1) circle (2pt)
(2,1) circle (2pt)
(2,0) circle (2pt);
\draw (0,0) .. controls (1,1) and (2,1) .. (2,0);
\end{tikzpicture}
C php lnh v ng cong:
\draw (ta u) .. controls (control point1) and (control point2) ..(ta cui);
Lu : c th b phn: and (control point2) trong cu trc lnh nu control point1
chnh l control point2.
Karl c th v na vng trn bng lnh v ng cong vo h trc ta nh sau:
\begin{tikzpicture}
\draw (-1.5,0) -- (1.5,0);
\draw (0,-1.5) -- (0,1.5);
\draw (-1,0) .. controls (-1,0.555) and (-0.555,1) .. (0,1)
.. controls (0.555,1) and (1,0.555) .. (1,0);
\end{tikzpicture}
Kt qu c th lm Karl hi lng nhng v ng trn theo cch ny tng i di dng.
C cch khc ngn gn hn l dng lnh v ng trn ring.
1.1.5
V ng trn v elip
\begin{tikzpicture}
\draw (0,0) circle (30pt);
\end{tikzpicture}
Tng t ng trn, v mt hnh elip ta cn bit ta tm (x,y) v hai bn knh a, b.
Do vy c php lnh v elip l:
4
\begin{tikzpicture}
\draw (0,0) ellipse (30pt and 10pt);
\end{tikzpicture}
v mt hnh elip lch mt gc so vi trc ta , ta dng thm ty chn rotate nh sau:
\begin{tikzpicture}
\draw[rotate=30] (0,0) ellipse (30pt and 15pt);
\end{tikzpicture}
Quay tr li vi hnh v ca Karl, ta dng lnh v ng trn c bn knh 1cm thay v dng
lnh v ng cong. M lnh Tik Z l:
\begin{tikzpicture}
\draw (-1.5,0) -- (1.5,0);
\draw (0,-1.5) -- (0,1.5);
\draw (0,0) circle (1cm);
\end{tikzpicture}
c hnh v cui cng vi ln ph hp, Karl cn dng thm mt tham s ty chn
n gin nhng chng ta s khng s dng y nhm trnh by hnh v cng vi m Tik Z
ngn gn, hp vi kh giy hn.
1.1.6
V hnh ch nht
C mt vi cch v hnh li nn trong hnh v ca Karl. Theo cch nhn n gin hnh
li nn l tp hp nhiu hnh ch nht. Hnh ch nht l mt trong nhng hnh ph bin
trong hnh hc s cp nn c mt lnh ring. Lnh ny bt u t v tr gc 1 c ta
(x1,y1) ca hnh ch nht v v tr gc c ta (x2,y2) i din vi gc 1.
C php lnh v hnh ch nht l:
\draw (x1,y1) rectangle (x2,y2);
V d:
\begin{tikzpicture}
\draw (-1.5,0) -- (1.5,0);
\draw (0,-1.5) -- (0,1.5);
\draw (0,0) circle (1cm);
\draw (0,0) rectangle (0.5, 0.5);
\draw (-0.5,-0.5) rectangle (-1,-1.4);
\end{tikzpicture}
Trong nhiu trng hp lnh v hnh ch nht rt hu dng, nhng khng nn dng lnh
5
1.1.7
V hnh li
Lnh grid l lnh v hnh li. C th dng lnh ny v mt hnh ch nht li theo cch
bt u t ta mt gc v gc cn li ca hnh ch nht li c xc nh theo c php
ca lnh grid.
V d:
1.1.8
Thay v s dng cc ty chn iu chnh trong lnh \draw phn 1.1.7 nh: xstep, ystep,
step, color, width vi cc ty chn nh gray, very thin . . . , chng ta c th t tt c cc
iu chnh ny vo mt Style. Mt Style l mt tp hp nhng ty chn iu chnh c s
dng quy nh chi tit cch v trc khi chng ta v hnh.
V d: m lnh vi Styles help lines:
\begin{tikzpicture}
% Styles
[help lines/.style={step=0.5cm,color=blue,very thin}]
\draw[help lines] (-1.4,-1.4) grid (1.4,1.4);
\draw (-1.5,0) -- (1.5,0);
\draw (0,-1.5) -- (0,1.5);
\draw (0,0) circle (1cm);
\end{tikzpicture}
Vic s dng Style c tc dng lm cho m lnh v ca bn ngn gn, linh hot. Hn na,
t vic chnh sa thng s trong Style c th to ra s thay i ng lot vi cc lnh v c
s dng Style . Thng thng, cc Style c t phn u ca mi hnh v nhng nu
bn mun tt c mi hnh v trong vn bn ca bn s dng chung mt Style th cn t
lnh \tikzset phn u ca vn bn tng t nh v d sau:
\begin{document}
\tikzset{help lines/ .style={step=0.5cm,color=blue,very thin}}
\begin{tikzpicture}
\draw[help lines] (0,0) - - (2,2);
\draw[help lines] (0,0) circle (1cm)
\end{tikzpicture}
\begin{tikzpicture}
\draw[help lines] (0,0) rectangle (1,2);
\draw[help lines] (0,0) grid (10pt,10pt)
\end{tikzpicture}
\end{document}
mc cao hn na, bn c th to h thng cc Style. Cc Style sau c th bao gm cc
Style trc.
V d:
\tikzset{help lines/.style=very thin}
\tikzset{Karls grid/.style={help lines, color=blue}}
...
\tikz \draw[Karls grid] (0,0) grid (5,5);
Vi s mm do trong vic chnh sa cc thng s nn cc Style rt hu dng. iu ny th
hin ch c th dng Style iu chnh mt thng s trong mt hnh v ring, trong khi
cc hnh v khc vn tun theo mc nh chung ca Style .
V d:
\tikzset{help lines/.style=ultra thick,step=0.5cm}
\tikzset{Karls grid/.style={help lines, color=#1!50}, Karls grid/.default=blue}
\tikz \draw[Karls grid] (0,0) grid (4,2);\hspace{2cm}
\tikz \draw[Karls grid=red] (0,0) grid (4,2);
Trong v d ny, Karl t thng s mu cho hnh li nn l blue vi mi hnh v nhng c
mt hnh v Karl mun mu ca hnh li nn l red do iu chnh thng s mu red
lnh \draw th hai.
1.1.9
Cc thng s ty chn v
1.1.10
V cung
Mt cung (arc) l mt phn ca ng trn hoc elip. Lnh v cung trn nh sau:
\draw (x,y) arc (a:b:r);
\begin{tikzpicture}[scale=3]
\draw[step=.5cm,gray,very thin]
(-1.4,-1.4) grid (1.4,1.4);
\draw (-1.5,0) -- (1.5,0);
\draw (0,-1.5) -- (0,1.5);
\draw (0,0) circle (1cm);
\draw (3mm,0mm)arc (0:30:3mm);
\end{tikzpicture}
1.1.11
V d:
Lnh \clip di y to ra mt hnh bao l hnh ch nht vi gc u tin l (-0,1,-0.2), gc
i din l (1.1, 0.75). Hnh v hin th sau khi bin dch bi LATEX l mt phn c ct
bi hnh bao y.
\begin{tikzpicture}[scale=3]
\clip (-0.1,-0.2) rectangle (1.1,0.75);
\draw[step=.5cm,gray,very thin] (-1.4,-1.4) grid (1.4,1.4);
\draw (-1.5,0) -- (1.5,0);
\draw (0,-1.5) -- (0,1.5);
\draw (0,0) circle (1cm);
\draw (3mm,0mm) arc (0:30:3mm);
\end{tikzpicture}
iu th v l c th coi clip l thng s ty chn ca lnh draw hoc ngc li. ng thi
c clip v draw u l thng s ty chn ca lnh \path.
V d:
\clip[draw] ...
\draw[clip] ...
\path[clip] ...
\path[draw] ...
\path[clip,draw] ...
Chng ta dng draw lm thng s ty chn cho lnh \clip nh sau:
\begin{tikzpicture}[scale=3]
\clip[draw] (0.5,0.5) circle (0.6cm);
\draw[step=.5cm,gray,very thin] (-1.4,-1.4) grid (1.4,1.4);
\draw (-1.5,0) -- (1.5,0);
\draw (0,-1.5) -- (0,1.5);
\draw (0,0) circle (1cm);
\draw (3mm,0mm) arc (0:30:3mm);
\end{tikzpicture}
1.1.12
Mc d hnh ca Karl khng cn v ton b ng cong sin, cosin hoc parabol nhng c
th dng lnh v mt phn cc loi ng cong ny.
10
1.1.13
T mu v v lin nt
t mu xanh nht phn gc tm hnh v ca Karl, ta dng lnh \fill thay cho lnh
\draw. M lnh nh sau:
\begin{tikzpicture}[scale=3]
\clip (-0.1,-0.2) rectangle (1.1,0.75);
\draw[step=.5cm,gray,very thin] (-1.4,-1.4) grid (1.4,1.4);
\draw (-1.5,0) -- (1.5,0);
\draw (0,-1.5) -- (0,1.5);
\draw (0,0) circle (1cm);
\fill[green!20!white] (0,0) -- (3mm,0mm)
arc (0:30:3mm) -- (0,0);
\end{tikzpicture}
Trong green!20!white c ngha 20% green + 80% white. Xem thm cch pha mu gi
xcolor ca Uwe Kern.
Trong m lnh trn, ti dng lnh cui ta s dng |(0,0)| kt thc ng v, s tt
hn nu ta thay th bng |cycle| v |cycle| c tc dng v lin nt khp kn t im u
n im cui. Hy so snh s khc bit sau:
\begin{tikzpicture}[line width=5pt]
\draw (0,0) -- (1,0) -- (1,1) -- (0,0);
\draw (2,0) -- (3,0) -- (3,1) -- cycle;
\useasboundingbox (0,1.5); % make bounding box higher
\end{tikzpicture}
Bn cng c th va v ng va t mu vi ch mt lnh l \filldraw, ban u s v ng
bao sau l t mu. Vi lnh ny chng ta c th dng mu t khc vi mu ca ng
v nh sau:
11
\begin{tikzpicture}[scale=3]
\clip (-0.1,-0.2) rectangle (1.1,0.75);
\draw[step=.5cm,gray,very thin] (-1.4,-1.4) grid (1.4,1.4);
\draw (-1.5,0) -- (1.5,0);
\draw (0,-1.5) -- (0,1.5);
\draw (0,0) circle (1cm);
\filldraw[fill=green!20!white, draw=green!50!black]
(0,0) -- (3mm,0mm) arc (0:30:3mm) -- cycle;
\end{tikzpicture}
1.1.14
To hiu ng shading
\begin{tikzpicture}[scale=3]
\clip (-0.1,-0.2) rectangle (1.1,0.75);
\draw[step=.5cm,gray,very thin] (-1.4,-1.4) grid (1.4,1.4);
\draw (-1.5,0) -- (1.5,0);
\draw (0,-1.5) -- (0,1.5);
\draw (0,0) circle (1cm);
\shadedraw[left color=gray,right color=green, draw=green!50!black]
(0,0) -- (3mm,0mm) arc (0:30:3mm) -- cycle;
\end{tikzpicture}
12
1.1.15
Xc nh to
13
\begin{tikzpicture}[scale=3]
\clip (-0.1,-0.2) rectangle (1.1,0.75);
\draw[step=.5cm,gray,very thin] (-1.4,-1.4) grid (1.4,1.4);
\draw (-1.5,0) -- (1.5,0);
\draw (0,-1.5) -- (0,1.5);
\draw (0,0) circle (1cm);
\filldraw[fill=green!20,draw=green!50!black] (0,0) -- (3mm,0mm)
arc (0:30:3mm) -- cycle;
\draw[red,very thick] (30:1cm) -- +(0,-0.5);
\draw[blue,very thick] (30:1cm) ++(0,-0.5) -- (0,0);
\end{tikzpicture}
Lu s khc bit gia cc k hiu + v ++.
Khi s dng k hiu ++
\begin{tikzpicture}
\def\rectanglepath
{-- ++(1cm,0cm) -- ++(0cm,1cm) -- ++(-1cm,0cm) -- cycle}
\draw (0,0) \rectanglepath;
\draw (1.5,0) \rectanglepath;
\end{tikzpicture}
V s dng k hiu +
\begin{tikzpicture}
\def\rectanglepath
{-- +(1cm,0cm) -- +(1cm,1cm) -- +(0cm,1cm) -- cycle}
\draw (0,0) \rectanglepath;
\draw (1.5,0) \rectanglepath;
\end{tikzpicture}
Hoc m lnh tt hn nn vit nh sau:
\tikz \draw (0,0) rectangle +(1,1) (1.5,0) rectangle +(1,1);
1.1.16
V cc ng giao nhau
14
1.1.17
V mi tn
1.1.18
Mi trng Scope
15
\begin{tikzpicture}[ultra thick]
\draw (0,0) -- (0,1);
\begin{scope}[thin]
\draw (1,0) -- (1,1);
\draw (2,0) -- (2,1);
\end{scope}
\draw (3,0) -- (3,1);
\end{tikzpicture}
Mi trng scope cn c tnh cht c bit: tu chn thay i c t bt k ch no trong
mi trng scope. Bi vy thay v vit \draw[thin] (0,0) - - (1,1) c th vit l \draw (0,0)
[thin] - - (1,1) hoc \draw (0,0) - - (1,1) [thin]. Nu dng hai tu chn khc nhau l [thin]
v [thick] th tu chn no ng cui cng s c p dng.
1.1.19
S thay i v tr
16
1.1.20
Vng lp
17
2,5
3,5
4,5
5,5
7,5
8,5
1,4
2,4
3,4
4,4
5,4
7,4
8,4
1,3
2,3
3,3
4,3
5,3
7,3
8,3
1,2
2,2
3,2
4,2
5,2
7,2
8,2
1,1
2,1
3,1
4,1
5,1
7,1
8,1
\foreach \x in {1,2,...,5,7,8,...,12}
\foreach \y in {1,...,5}
{
\draw (\x,\y) +(-.5,-.5) rectangle ++(.5,.5);
\draw (\x,\y) node{\x,\y};
}
1.1.21
Text 1
\begin{tikzpicture}
\draw (-2,-2) rectangle (2.5,2.5);
\draw (0.5,0.5)
node [fill=examplefill, below=2pt]
{Text 1} -- (1.5,1.5)
node [fill=blue!20,above=2pt]{Text 2};
\end{tikzpicture}
18
Trong mi vng lp, lnh th nht c thc hin sau n lnh th hai. Nu khng
c lnh th 2 th lnh th nht s c lp li ngay.
1
1
2
12
\begin{tikzpicture}[scale=3]
\clip (-0.6,-0.2) rectangle (0.6,1.51);
\draw[step=.5cm,help lines] (-1.4,-1.4) grid (1.4,1.4);
\filldraw[fill=green!20,draw=green!50!black]
(0,0) -- (3mm,0mm) arc (0:30:3mm) -- cycle;
\draw[->] (-1.5,0) -- (1.5,0); \draw[->] (0,-1.5) -- (0,1.5);
\draw (0,0) circle (1cm);
\foreach \x/\xtext in {-1, -0.5/-\frac{1}{2}, 1}
\draw (\x cm,1pt) -- (\x cm,-1pt) node[anchor=north] {$\xtext$};
\foreach \y/\ytext in {-1, -0.5/-\frac{1}{2}, 0.5/\frac{1}{2}, 1}
\draw (1pt,\y cm) -- (-1pt,\y cm) node[anchor=east] {$\ytext$};
\end{tikzpicture}
1
19
1
1
2
tan =
sin
1
12
cos
sin
cos
12
\begin{tikzpicture}[scale=3]
\clip (-2,-0.2) rectangle (2,0.8);
\draw[step=.5cm,gray,very thin] (-1.4,-1.4) grid (1.4,1.4);
1
\filldraw[fill=green!20,draw=green!50!black]
(0,0) -- (3mm,0mm) arc
(0:30:3mm) -- cycle;
\draw[->] (-1.5,0) -- (1.5,0) coordinate (x axis);
\draw[->] (0,-1.5) -- (0,1.5) coordinate (y axis);
\draw (0,0) circle (1cm);
\draw[very thick,red]
(30:1cm) -- node[left=1pt,fill=white] {$\sin \alpha$} (30:1cm |- x axis);
\draw[very thick,blue]
(30:1cm |- x axis) -- node[below=2pt,fill=white] {$\cos \alpha$} (0,0);
\path [name path=upward line] (1,0) -- (1,1);
\path [name path=sloped line] (0,0) -- (30:1.5cm);
\draw [name intersections={of=upward line and sloped line, by=t}]
[very thick,orange] (1,0) -- node [right=1pt,fill=white]
{$\displaystyle \tan \alpha \color{black}=
\frac{{\color{red}\sin \alpha}}{\color{blue}\cos \alpha}$} (t);
\draw (0,0) -- (t);
\foreach \x/\xtext in {-1, -0.5/-\frac{1}{2}, 1}
\draw (\x cm,1pt) -- (\x cm,-1pt) node[anchor=north,fill=white] {$\xtext$};
\foreach \y/\ytext in {-1, -0.5/-\frac{1}{2}, 0.5/\frac{1}{2}, 1}
\draw (1pt,\y cm) -- (-1pt,\y cm) node[anchor=east,fill=white] {$\ytext$};
\end{tikzpicture}
Bn cng c th t v tr cc node text dc theo ng cong v iu chnh cong ca
node vi tu chn sloped, near start, very near end nh v d di y:
midway
near start
very
near
end
\begin{tikzpicture}
\draw (0,0) .. controls (6,1) and (9,1) ..
node[near start,sloped,above] {near start}
node {midway}
node[very near end,sloped,below] {very near end} (12,0);
\end{tikzpicture}
Phn cui cng l v mt node text mu hng bn phi i km hnh v ca Karl.
t c rng cn thit ca node, s dng tu chn text with=6cm. Ton b m lnh s l:
20
\begin{tikzpicture}
[scale=3,line cap=round,
% Styles
axes/.style=,
important line/.style={very thick},
information text/.style={rounded corners,fill=red!10,inner sep=1ex}]
% Local definitions
\def\costhirty{0.8660256}
% Colors
\colorlet{anglecolor}{green!50!black}
\colorlet{sincolor}{red}
\colorlet{tancolor}{orange!80!black}
\colorlet{coscolor}{blue}
% The graphic
\draw[help lines,step=0.5cm] (-1.4,-1.4) grid (1.4,1.4);
\draw (0,0) circle (1cm);
\begin{scope}[axes]
\draw[->] (-1.5,0) -- (1.5,0) node[right] {$x$};
\draw[->] (0,-1.5) -- (0,1.5) node[above] {$y$};
\foreach \x/\xtext in {-1, -.5/-\frac{1}{2}, 1}
\draw[xshift=\x cm] (0pt,1pt) -- (0pt,-1pt) node[below,fill=white] {$\xtext$};
\foreach \y/\ytext in {-1, -.5/-\frac{1}{2}, .5/\frac{1}{2}, 1}
\draw[yshift=\y cm] (1pt,0pt) -- (-1pt,0pt) node[left,fill=white] {$\ytext$};
\end{scope}
\filldraw[fill=green!20,draw=anglecolor] (0,0) -- (3mm,0pt) arc(0:30:3mm);
\draw (15:2mm) node[anglecolor] {$\alpha$};
\draw[important line,sincolor]
(30:1cm) -- node[left=1pt,fill=white] {$\sin \alpha$} +(0,-.5);
\draw[important line,coscolor]
(0,0) -- node[below=2pt,fill=white] {$\cos \alpha$} (\costhirty,0);
\draw[important line,tancolor] (1,0) -node [right=1pt,fill=white]
{
$\displaystyle \tan \alpha \color{black}=
\frac{{\color{sincolor}\sin \alpha}}{\color{coscolor}\cos \alpha}$
} (intersection of 0,0--30:1cm and 1,0--1,1) coordinate (t);
\draw (0,0) -- (t);
\draw[xshift=2cm] node [right,text width=6cm,information text]
{Gc {\color{anglecolor} $\alpha$} l $30^\circ$ trong v d ($\pi/6$ nu n v o l radian).
Gi tr {\color{sincolor}sin $\alpha$} l:
\[{\color{sincolor} \sin \alpha} = 1/2.\]
Theo nh l Pitago, ta c ${\color{coscolor}\cos^2 \alpha} +
{\color{sincolor}\sin^2\alpha} =1$.
Do di ca ng mu xanh l gi tr ca {\color{coscolor}cosin $\alpha$}, phi l
\[{\color{coscolor}\cos\alpha} = \sqrt{1 - 1/4} = \textstyle \frac{1}{2} \sqrt 3. \]%
iu ny cho ta di ng mu cam {\color{tancolor}$\tan \alpha$} c gi tr l
\[{\color{tancolor}\tan\alpha} = \frac{{\color{sincolor}\sin \alpha}}
{\color{coscolor}\cos \alpha} = 1/\sqrt 3.\] };
\end{tikzpicture}
21