<html><head><meta name="color-scheme" content="light dark"></head><body><pre style="word-wrap: break-word; white-space: pre-wrap;">%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\setcounter{chapter}{4}
\newcommand{\graphicscompanion}{\emph{The \LaTeX{} Graphics Companion}~\cite{graphicscompanion}} 
\newcommand{\hobby}{\emph{A User's Manual for \MP{}}~\cite{metapost}}
\newcommand{\hoenig}{\emph{\TeX{} Unbound}~\cite{unbound}}
\newcommand{\graphicsinlatex}{\emph{Graphics in \LaTeXe{}}~\cite{ursoswald}}

\chapter{Tvorba matematickÃ© grafiky}
\label{chap:graphics}

\begin{intro}
PodobnÄ› jako zadÃ¡vÃ¡me text, mÅ¯Å¾eme \LaTeX u zadat pokyny pro vytvoÅ™enÃ­
grafickÃ©ho vÃ½stupu. MoÅ¾nosti, kterÃ© pÅ™i tom
mÃ¡me, jsou trochu omezenÃ©, ale existuje Å™ada \LaTeX ovÃ½ch
rozÅ¡Ã­Å™enÃ­, kterÃ© tato omezenÃ­ pÅ™ekonÃ¡vajÃ­. V~tÃ©to sekci se o~nÄ›kolika
z~nich dozvÃ­te.
\end{intro}

\section{ÃšvodnÃ­ pÅ™ehled}
ProstÅ™edÃ­ \ei{picture} umoÅ¾Åˆuje programovÃ¡nÃ­ obrÃ¡zkÅ¯ pÅ™Ã­mo prostÅ™ednictvÃ­m
\LaTeX u. PodrobnÃ½ popis lze nalÃ©zt v~\manual. ExistujÃ­ vÃ½raznÃ¡ omezenÃ­,
protoÅ¾e sklony ÃºseÄek stejnÄ› jako polomÄ›ry kruÅ¾nic jsou omezenÃ© na malou
skupinu hodnot. Na druhou stranu ale \LaTeXe\ prostÅ™edÃ­ \ei{picture} pÅ™inÃ¡Å¡Ã­
pÅ™Ã­kaz \ci{qbezier} (\uv{\texttt{q}} jako quadratic -- kvadratickÃ©).
KvadratickÃ½mi BÃ©zierovÃ½mi
kÅ™ivkami lze uspokojivÄ› aproximovat mnoho Äasto pouÅ¾Ã­vanÃ½ch kÅ™ivek (napÅ™.\
kruÅ¾nice, elipsy nebo Å™etÄ›zovky), i~kdyÅ¾ to mÅ¯Å¾e vyÅ¾adovat trochu
matematickÃ© dÅ™iny. JestliÅ¾e se navÃ­c pro generovÃ¡nÃ­ \ci{qbezier} blokÅ¯
\LaTeX ovÃ½ch vstupnÃ­ch souborÅ¯ pouÅ¾ije programovacÃ­ jazyk, napÅ™. typu Java, 
prostÅ™edÃ­ \ei{picture} se stÃ¡vÃ¡ docela mocnÃ½m.

PÅ™estoÅ¾e programovÃ¡nÃ­ obrÃ¡zkÅ¯ pÅ™Ã­mo v~\LaTeX u je vÃ½raznÄ› omezenÃ©
a~Äasto docela ÃºnavnÃ©, mÃ¡ svÃ© vÃ½hody. Dokumenty
vytvoÅ™enÃ© tÃ­mto zpÅ¯sobem zabÃ­rajÃ­ mÃ©nÄ› mÃ­sta
a~nenÃ­ tÅ™eba udrÅ¾ovat Å¾Ã¡dnÃ© grafickÃ© soubory.

BalÃ­ky, napÅ™. \pai{epic} a~\pai{eepic} (popsanÃ© napÅ™. v~\companion) nebo \pai{pstricks}
pomÃ¡hajÃ­ eliminovat omezenÃ­ pÅ¯vodnÃ­ho prostÅ™edÃ­ \ei{picture}
a~vÃ½raznÄ› posilujÃ­ grafickÃ© schopnosti \LaTeX u.

ZatÃ­mco prvnÃ­ dva balÃ­ky jen obohacujÃ­ prostÅ™edÃ­ \ei{picture}, balÃ­k \pai{pstricks}
mÃ¡ svÃ© vlastnÃ­ kreslÃ­cÃ­ prostÅ™edÃ­, \ei{pspicture}. SÃ­la \pai{pstricks} vychÃ¡zÃ­
z~toho, Å¾e tento balÃ­k intenzivnÄ› vyuÅ¾Ã­vÃ¡ moÅ¾nostÃ­ jazyka \PSi. Mnoho balÃ­kÅ¯ bylo
navÃ­c vytvoÅ™eno pro konkrÃ©tnÃ­ pouÅ¾itÃ­. Å˜ada z~tÄ›chto balÃ­kÅ¯ je detailnÄ› popsÃ¡na
v~\graphicscompanion, neplÃ©st si prosÃ­m s~\companion.

Asi nejsilnÄ›jÅ¡Ã­m grafickÃ½m nÃ¡strojem spÅ™Ã­znÄ›nÃ½m s~\LaTeX em je \MP, dvojÄe programu \MF{}
Donalda E. Knutha. \MP\ obsahuje sofistikovanÃ½ programovacÃ­ jazyk \MF u. Na rozdÃ­l
od \MF u~(kterÃ½ generuje bitmapy) generuje \MP\ zapouzdÅ™enÃ© \PSi{} soubory,
kterÃ© mohou bÃ½t importovÃ¡ny do \LaTeX u. Ãšvod do programu \MP\ naleznete v~\hobby\ nebo
v~tutoriÃ¡lu \cite{ursoswald}.

Velmi dÅ¯kladnÃ¡ diskuze \LaTeX ovÃ½ch a~\TeX ovÃ½ch strategiÃ­ pro zachÃ¡zenÃ­ s~grafikou
(a~fonty) je souÄÃ¡stÃ­ \hoenig.

\section{ProstÅ™edÃ­ \texttt{picture}}
\secby{Urs Oswald}{osurs@bluewin.ch}

\subsection{ZÃ¡kladnÃ­ pÅ™Ã­kazy}

ProstÅ™edÃ­ \ei{picture}\footnote{VÄ›Å™te nevÄ›Å™te, ale prostÅ™edÃ­ \texttt{picture} je k~dispozici
pÅ™Ã­mo ve standardnÃ­m \LaTeXe, nenÃ­ tedy tÅ™eba nahrÃ¡vat Å¾Ã¡dnÃ© speciÃ¡lnÃ­ balÃ­ky.} se vytvoÅ™Ã­
jednÃ­m z~nÃ¡sledujÃ­cÃ­ch dvou pÅ™Ã­kazÅ¯
\begin{lscommand}
\ci{begin}\verb|{picture}(|$x,y$\verb|)|\ldots\ci{end}\verb|{picture}|
\end{lscommand}
\noindent nebo
\begin{lscommand}
\ci{begin}\verb|{picture}(|$x,y$\verb|)(|$x_0,y_0$\verb|)|\ldots\ci{end}\verb|{picture}|
\end{lscommand}
ÄŒÃ­sla $x,\,y,\,x_0,\,y_0$ jsou odkazy na \ci{unitlength}, kterÃ© mohou bÃ½t kdykoliv nastaveny
na pÅ¯vodnÃ­ hodnoty (ale ne uvnitÅ™ prostÅ™edÃ­ \ei{picture}) napÅ™. pÅ™Ã­kazem 
\begin{lscommand}
\ci{setlength}\verb|{|\ci{unitlength}\verb|}{1.2cm}|
\end{lscommand}
ImplicitnÃ­ hodnota \ci{unitlength} je \texttt{1pt}. PrvnÃ­ pÃ¡r, $(x,y)$, zajistÃ­ v~rÃ¡mci
dokumentu vynechÃ¡nÃ­ obdÃ©lnÃ­kovÃ©ho mÃ­sta pro obrÃ¡zek. VolitelnÃ½ druhÃ½ pÃ¡r,
$(x_0,y_0)$, pÅ™iÅ™adÃ­ libovolnÃ© souÅ™adnice spodnÃ­mu levÃ©mu rohu vyhrazenÃ©ho obdÃ©lnÃ­ku.

VÄ›tÅ¡ina kreslÃ­cÃ­ch pÅ™Ã­kazÅ¯ mÃ¡ jednu ze dvou forem
\begin{lscommand}
\ci{put}\verb|(|$x,y$\verb|){|\emph{object}\verb|}|
\end{lscommand}
\noindent nebo
\begin{lscommand}
\ci{multiput}\verb|(|$x,y$\verb|)(|$\Delta x,\Delta y$\verb|){|$n$\verb|}{|\emph{object}\verb|}|\end{lscommand}
VÃ½jimkou jsou BÃ©zierovy kÅ™ivky, kterÃ© se kreslÃ­ pÅ™Ã­kazem
\begin{lscommand}
\ci{qbezier}\verb|(|$x_1,y_1$\verb|)(|$x_2,y_2$\verb|)(|$x_3,y_3$\verb|)|
\end{lscommand}
%\newpage



\subsection{Å˜Ã¡dkovÃ© segmenty}
\begin{example}
\setlength{\unitlength}{5cm}
\begin{picture}(1,1)
  \put(0,0){\line(0,1){1}}
  \put(0,0){\line(1,0){1}}  
  \put(0,0){\line(1,1){1}}  
  \put(0,0){\line(1,2){.5}}
  \put(0,0){\line(1,3){.3333}}
  \put(0,0){\line(1,4){.25}}  
  \put(0,0){\line(1,5){.2}}
  \put(0,0){\line(1,6){.1667}}
  \put(0,0){\line(2,1){1}}
  \put(0,0){\line(2,3){.6667}}
  \put(0,0){\line(2,5){.4}}
  \put(0,0){\line(3,1){1}}  
  \put(0,0){\line(3,2){1}}
  \put(0,0){\line(3,4){.75}}
  \put(0,0){\line(3,5){.6}}
  \put(0,0){\line(4,1){1}}
  \put(0,0){\line(4,3){1}}  
  \put(0,0){\line(4,5){.8}}
  \put(0,0){\line(5,1){1}}
  \put(0,0){\line(5,2){1}}
  \put(0,0){\line(5,3){1}}
  \put(0,0){\line(5,4){1}}
  \put(0,0){\line(5,6){.8333}}
  \put(0,0){\line(6,1){1}}
  \put(0,0){\line(6,5){1}}
\end{picture}
\end{example}
Å˜Ã¡dkovÃ© segmenty se kreslÃ­ pÅ™Ã­kazem
\begin{lscommand}
\ci{put}\verb|(|$x,y$\verb|){|\ci{line}\verb|(|$x_1,y_1$\verb|){|$length$\verb|}}|
\end{lscommand}
PÅ™Ã­kaz \ci{line} mÃ¡ dva argumenty:
\begin{enumerate}
  \item smÄ›rovÃ½ vektor,
  \item dÃ©lka (\emph{length}).
\end{enumerate}
Komponenty smÄ›rovÃ©ho vektoru jsou omezeny na celÃ¡ ÄÃ­sla
\[
  -6,\,-5,\,\ldots,\,5,\,6,
\]
a~musejÃ­ bÃ½t nesoudÄ›lnÃ© (nemajÃ­cÃ­ kromÄ› jedniÄky Å¾Ã¡dnÃ©ho spoleÄnÃ©ho dÄ›litele). ObrÃ¡zek
ukazuje vÅ¡ech dvacet pÄ›t moÅ¾nÃ½ch smÄ›rovÃ½ch hodnot v~prvnÃ­m kvadrantu. Argument dÃ©lka je
relativnÃ­ vzhledem k~\ci{unitlength}. DÃ©lka je vertikÃ¡lnÃ­ souÅ™adnice
v~pÅ™Ã­padÄ› vertikÃ¡lnÃ­ho Å™Ã¡dkovÃ©ho segmentu a~horizontÃ¡lnÃ­ souÅ™adnice ve vÅ¡ech ostatnÃ­ch
pÅ™Ã­padech.

\subsection{Å&nbsp;ipky}

\begin{example}
\setlength{\unitlength}{0.75mm}
\begin{picture}(60,40)
  \put(30,20){\vector(1,0){30}}
  \put(30,20){\vector(4,1){20}}
  \put(30,20){\vector(3,1){25}}
  \put(30,20){\vector(2,1){30}}
  \put(30,20){\vector(1,2){10}}
  \thicklines
  \put(30,20){\vector(-4,1){30}}
  \put(30,20){\vector(-1,4){5}}
  \thinlines
  \put(30,20){\vector(-1,-1){5}}
  \put(30,20){\vector(-1,-4){5}}
\end{picture}
\end{example}
Å&nbsp;ipky se kreslÃ­ pÅ™Ã­kazem
\begin{lscommand}
\ci{put}\verb|(|$x,y$\verb|){|\ci{vector}\verb|(|$x_1,y_1$\verb|){|$length$\verb|}}|
\end{lscommand}
Hodnoty smÄ›rovÃ½ch vektorÅ¯ Å¡ipek jsou omezeny jeÅ¡tÄ› vÃ­ce neÅ¾ u~Å™Ã¡dkovÃ½ch segmentÅ¯,
konkrÃ©tnÄ› se jednÃ¡ o~celÃ¡ ÄÃ­sla
\[
  -4,\,-3,\,\ldots,\,3,\,4.
\]
OpÄ›t platÃ­, Å¾e komponenty musÃ­ bÃ½t nesoudÄ›lnÃ©. VÅ¡imnÄ›te si efektu pÅ™Ã­kazu \ci{thicklines}
na Å¡ipky ukazujÃ­cÃ­ nahoru doleva.

\subsection{KruÅ¾nice}

\begin{example}
\setlength{\unitlength}{1mm}
\begin{picture}(60, 40)
  \put(20,30){\circle{1}}
  \put(20,30){\circle{2}}
  \put(20,30){\circle{4}}
  \put(20,30){\circle{8}}
  \put(20,30){\circle{16}}
  \put(20,30){\circle{32}}
  
  \put(40,30){\circle{1}}
  \put(40,30){\circle{2}}
  \put(40,30){\circle{3}}
  \put(40,30){\circle{4}}
  \put(40,30){\circle{5}}
  \put(40,30){\circle{6}}
  \put(40,30){\circle{7}}
  \put(40,30){\circle{8}}
  \put(40,30){\circle{9}}
  \put(40,30){\circle{10}}
  \put(40,30){\circle{11}}
  \put(40,30){\circle{12}}
  \put(40,30){\circle{13}}
  \put(40,30){\circle{14}}
  
  \put(15,10){\circle*{1}}
  \put(20,10){\circle*{2}}
  \put(25,10){\circle*{3}}
  \put(30,10){\circle*{4}}
  \put(35,10){\circle*{5}}
\end{picture}
\end{example}
PÅ™Ã­kaz
\begin{lscommand}
  \ci{put}\verb|(|$x,y$\verb|){|\ci{circle}\verb|{|\emph{diameter}\verb|}}|
\end{lscommand}
\noindent nakreslÃ­ kruÅ¾nici se stÅ™edem $(x,y)$ a~prÅ¯mÄ›rem (ano, nikoliv polomÄ›rem) \emph{diameter}.
MaximÃ¡lnÃ­ prÅ¯mÄ›r, kterÃ½ prostÅ™edÃ­ \ei{picture} akceptuje, je zhruba 14\,mm,
ale pouÅ¾Ã­t nelze ani nÄ›kterÃ© menÅ¡Ã­ prÅ¯mÄ›ry. PÅ™Ã­kaz \ci{circle*} nakreslÃ­ disky
(vyplnÄ›nÃ© kruÅ¾nice).

PodobnÄ› jako u~Å™Ã¡dkovÃ½ch segmentÅ¯ je moÅ¾no pouÅ¾Ã­t pÅ™Ã­davnÃ© balÃ­ky, napÅ™.
\pai{eepic} nebo \pai{pstricks}. Tyto balÃ­ky jsou dÅ¯kladnÄ› popsÃ¡ny
v~\graphicscompanion.

Kdo se nebojÃ­ provÃ¡dÄ›t (sÃ¡m nebo pomocÃ­ programu) nezbytnÃ© vÃ½poÄty, mÅ¯Å¾e
v~prostÅ™edÃ­ \ei{picture} z~kvadratickÃ½ch B\'ezierovÃ½ch kÅ™ivek sloÅ¾it dohromady
libovolnÃ© kruÅ¾nice a~elipsy. PÅ™Ã­klady a~zdrojovÃ© soubory v~JavÄ› jsou
uvedeny v~\graphicsinlatex.


\subsection{Text a~vzorce}

\begin{example}
\setlength{\unitlength}{0.8cm}
\begin{picture}(6,5)
  \thicklines
  \put(1,0.5){\line(2,1){3}}
  \put(4,2){\line(-2,1){2}}
  \put(2,3){\line(-2,-5){1}}
  \put(0.7,0.3){$A$}
  \put(4.05,1.9){$B$}
  \put(1.7,2.95){$C$}
  \put(3.1,2.5){$a$}
  \put(1.3,1.7){$b$}
  \put(2.5,1.05){$c$}
  \put(0.3,4){$F=
    \sqrt{s(s-a)(s-b)(s-c)}$}  
  \put(3.5,0.4){$\displaystyle
    s:=\frac{a+b+c}{2}$}
\end{picture}
\end{example}
Jak ukazuje tento pÅ™Ã­klad, text a~vzorce mohou bÃ½t obvyklÃ½m zpÅ¯sobem vepsÃ¡ny do prostÅ™edÃ­
\ei{picture} pomocÃ­ pÅ™Ã­kazu \ci{put}.

\subsection{\ci{multiput} a~\ci{linethickness}}

\begin{example}
\setlength{\unitlength}{2mm}
\begin{picture}(30,20)
  \linethickness{0.075mm}
  \multiput(0,0)(1,0){26}%
    {\line(0,1){20}}
  \multiput(0,0)(0,1){21}%
    {\line(1,0){25}}
  \linethickness{0.15mm}    
  \multiput(0,0)(5,0){6}%
    {\line(0,1){20}}
  \multiput(0,0)(0,5){5}%
    {\line(1,0){25}}
  \linethickness{0.3mm}    
  \multiput(5,0)(10,0){2}%
    {\line(0,1){20}}
  \multiput(0,5)(0,10){2}%
    {\line(1,0){25}}
\end{picture}
\end{example}
PÅ™Ã­kaz
\begin{lscommand}
  \ci{multiput}\verb|(|$x,y$\verb|)(|$\Delta x,\Delta y$\verb|){|$n$\verb|}{|\emph{object}\verb|}|
\end{lscommand}
\noindent mÃ¡ 4 argumenty: poÄÃ¡teÄnÃ­ bod, vektor pro pÅ™eklad z~jednoho objektu
do jinÃ©ho, poÄet objektÅ¯ a~objekt, kterÃ½ se mÃ¡ nakreslit. 

PÅ™Ã­kaz \ci{linethickness}
se vztahuje na horizontÃ¡lnÃ­ a~vertikÃ¡lnÃ­ linkovÃ© segmenty, ale ne na Å¡ikmÃ© linkovÃ© segmenty
ani kruÅ¾nice. \ci{linethickness} se takÃ© vztahuje na kvadratickÃ© B\'ezierovy kÅ™ivky!

\subsection{OvÃ¡ly}

\begin{example}
\setlength{\unitlength}{0.75cm}
\begin{picture}(6,4)
  \linethickness{0.075mm}
  \multiput(0,0)(1,0){7}%
    {\line(0,1){4}}
  \multiput(0,0)(0,1){5}%
    {\line(1,0){6}}
  \thicklines
  \put(2,3){\oval(3,1.8)} 
  \thinlines
  \put(3,2){\oval(3,1.8)} 
  \thicklines
  \put(2,1){\oval(3,1.8)[tl]} 
  \put(4,1){\oval(3,1.8)[b]} 
  \put(4,3){\oval(3,1.8)[r]} 
  \put(3,1.5){\oval(1.8,0.4)}     
\end{picture}
\end{example}
PÅ™Ã­kaz
\begin{lscommand}
  \ci{put}\verb|(|$x,y$\verb|){|\ci{oval}\verb|(|$w,h$\verb|)}|
\end{lscommand}
\noindent nebo
\begin{lscommand}
  \ci{put}\verb|(|$x,y$\verb|){|\ci{oval}\verb|(|$w,h$\verb|)[|\emph{position}\verb|]}|
\end{lscommand}
\noindent nakreslÃ­ ovÃ¡l se stÅ™edem $(x,y)$, Å¡Ã­Å™kou $w$ a~vÃ½Å¡kou $h$. VolitelnÃ© \emph{poziÄnÃ­}
argumenty \texttt{b}, \texttt{t}, \texttt{l}, \texttt{r} se vztahujÃ­
k~\uv{hornÃ­}, \uv{spodnÃ­}, \uv{levÃ©} a~\uv{pravÃ©} stranÄ› a~mohou bÃ½t kombinovÃ¡ny,
jak je ukÃ¡zÃ¡no na obrÃ¡zku. 

Å&nbsp;Ã­Å™ku Äar je moÅ¾no upravovat buÄ pÅ™Ã­kazem \ci{linethickness}\verb|{|\emph{length}\verb|}| nebo pÅ™Ã­kazy
\ci{thinlines} a~\ci{thicklines}. \ci{linethickness}\verb|{|\emph{length}\verb|}|
se vztahuje jen na horizontÃ¡lnÃ­ a~vertikÃ¡lnÃ­ ÄÃ¡ry (a~kvadratickÃ© B\'ezierovy kÅ™ivky),
zatÃ­mco \ci{thinlines} a~\ci{thicklines} lze navÃ­c pouÅ¾Ã­t na Å¡ikmÃ© ÄÃ¡rovÃ© segmenty, kruÅ¾nice a~ovÃ¡ly.

\subsection{VÃ­cenÃ¡sobnÃ© pouÅ¾itÃ­ pÅ™eddefinovanÃ½ch boxÅ¯ s~obrÃ¡zky}

\begin{example}
\setlength{\unitlength}{0.5mm}
\begin{picture}(120,168)
\newsavebox{\foldera}
\savebox{\foldera}
  (40,32)[bl]{% definition 
  \multiput(0,0)(0,28){2}
    {\line(1,0){40}}
  \multiput(0,0)(40,0){2}
    {\line(0,1){28}}
  \put(1,28){\oval(2,2)[tl]}
  \put(1,29){\line(1,0){5}}
  \put(9,29){\oval(6,6)[tl]}
  \put(9,32){\line(1,0){8}}
  \put(17,29){\oval(6,6)[tr]}
  \put(20,29){\line(1,0){19}}
  \put(39,28){\oval(2,2)[tr]}  
}
\newsavebox{\folderb}
\savebox{\folderb}
  (40,32)[l]{% definition 
  \put(0,14){\line(1,0){8}}
  \put(8,0){\usebox{\foldera}}
}
\put(34,26){\line(0,1){102}} 
\put(14,128){\usebox{\foldera}}
\multiput(34,86)(0,-37){3}
  {\usebox{\folderb}} 
\end{picture}
\end{example}
Box s~obrÃ¡zkem je moÅ¾no \emph{deklarovat} pÅ™Ã­kazem
\begin{lscommand}
  \ci{newsavebox}\verb|{|\emph{name}\verb|}|
\end{lscommand}
\noindent a~nÃ¡slednÄ› \emph{definovat} pomocÃ­
\begin{lscommand}
  \ci{savebox}\verb|{|\emph{name}\verb|}(|\emph{width,height}\verb|)[|\emph{position}\verb|]{|\emph{content}\verb|}|
\end{lscommand}
\noindent a~potom \emph{vykreslit} libovolnÄ› mnohokrÃ¡t pomocÃ­
\begin{lscommand}
  \ci{put}\verb|(|$x,y$\verb|){|\ci{usebox}\verb|{|\emph{name}\verb|}}|
\end{lscommand}
NepovinnÃ½ parametr \emph{position} specifikuje \emph{referenÄnÃ­ bod} saveboxu.
V~naÅ¡em pÅ™Ã­kladu je tento parameter specifikovÃ¡n hodnotou \texttt{bl}, coÅ¾
umÃ­stÃ­ referenÄnÃ­ bod do spodnÃ­ho levÃ©ho rohu saveboxu (\texttt{b}ottom -- spodnÃ­ ÄÃ¡st
a~\texttt{l}eft~\discretionary{--}{--}{--}~vlevo). ZbylÃ© hodnoty,
ze kterÃ½ch je moÅ¾no sloÅ¾it specifikaci pozice, jsou \texttt{t} (\texttt{t}op -- hornÃ­ ÄÃ¡st)
a~\texttt{r} (\texttt{r}ight -- vpravo).

Argument \emph{name} se odkazuje na \LaTeXe ovÃ© \uv{skladiÅ¡tÄ› materiÃ¡lu}
a~mÃ¡ proto charakter pÅ™Ã­kazu, proto jsou v~naÅ¡em pÅ™Ã­kladu zpÄ›tnÃ¡ lomÃ­tka. Boxy nesoucÃ­
obrÃ¡zky mohou bÃ½t vnoÅ™enÃ©: v~naÅ¡em pÅ™Ã­kladÄ› je pouÅ¾ito \ci{foldera} uvnitÅ™ definice
\ci{folderb}.

Museli jsme pouÅ¾Ã­t pÅ™Ã­kaz \ci{oval}, protoÅ¾e pÅ™Ã­kaz \ci{line} nefunguje, pokud je dÃ©lka
segmentu menÅ¡Ã­ neÅ¾ zhruba 3\,mm.

\subsection{KvadratickÃ© B\'ezierovy kÅ™ivky}

\begin{example}
\setlength{\unitlength}{0.8cm}
\begin{picture}(6,4)
  \linethickness{0.075mm}
  \multiput(0,0)(1,0){7}
    {\line(0,1){4}}
  \multiput(0,0)(0,1){5}
    {\line(1,0){6}}
  \thicklines
  \put(0.5,0.5){\line(1,5){0.5}}    
  \put(1,3){\line(4,1){2}} 
  \qbezier(0.5,0.5)(1,3)(3,3.5)
  \thinlines   
  \put(2.5,2){\line(2,-1){3}}
  \put(5.5,.5){\line(-1,5){.5}}
  \linethickness{1mm}
  \qbezier(2.5,2)(5.5,0.5)(5,3)
  \thinlines
  \qbezier(4,2)(4,3)(3,3)
  \qbezier(3,3)(2,3)(2,2)
  \qbezier(2,2)(2,1)(3,1)
  \qbezier(3,1)(4,1)(4,2)
\end{picture}
\end{example}
Jak tento pÅ™Ã­klad ukazuje, rozdÄ›lenÃ­ kruÅ¾nice na ÄtyÅ™i kvadratickÃ© B\'ezierovy kÅ™ivky
nevede k~uspokojivÃ©mu vÃ½sledku. KÅ™ivek je potÅ™eba alespoÅˆ osm. ObrÃ¡zek opÄ›t ukazuje
efekt pÅ™Ã­kazu \ci{linethickness} na horizontÃ¡lnÃ­ a~vertikÃ¡lnÃ­ ÄÃ¡ry a~pÅ™Ã­kazÅ¯
\ci{thinlines} a~\ci{thicklines} na Å¡ikmÃ© ÄÃ¡rovÃ© segmenty. Ukazuje takÃ©, Å¾e oba
typy pÅ™Ã­kazÅ¯ ovlivÅˆujÃ­ kvadratickÃ© B\'ezierovy kÅ™ivky, kaÅ¾dÃ½ z~pÅ™Ã­kazÅ¯ \uv{pÅ™episujÃ­cÃ­}
nastavenÃ­ toho pÅ™edchozÃ­ho.

NechÅ¥ $P_1=(x_1,\,y_1),\,P_2=(x_2,\,y_2)$ znaÄÃ­ koncovÃ© body a~$m_1,\,m_2$ 
pÅ™Ã­sluÅ¡nÃ© sklony kvadratickÃ© B\'ezierovy kÅ™ivky. StÅ™ednÃ­ kontrolnÃ­ bod
$S=(x,\,y)$ potom splÅˆuje rovnici
\begin{equation} \label{zwischenpunkt}
  \left\{
    \begin{array}{rcl}
      x &amp; = &amp; \displaystyle \frac{m_2 x_2-m_1x_1-(y_2-y_1)}{m_2-m_1}, \\
      y &amp; = &amp; y_i+m_i(x-x_i)\qquad (i=1,\,2).
    \end{array}
  \right.
\end{equation}
\noindent \graphicsinlatex\ obsahuje JavovÃ½ program, kterÃ½ generuje nezbytnou
pÅ™Ã­kazovou Å™Ã¡dku pro \ci{qbezier}.

\subsection{Å˜etÄ›zovka}

\begin{example}
\setlength{\unitlength}{1cm}
\begin{picture}%
   (4.3,3.6)(-2.5,-0.25)
\put(-2,0){\vector(1,0){4.4}}
\put(2.45,-.05){$x$}
\put(0,0){\vector(0,1){3.2}}
\put(0,3.35){\makebox(0,0){$y$}}
\qbezier(0.0,0.0)(1.2384,0.0)
  (2.0,2.7622) 
\qbezier(0.0,0.0)(-1.2384,0.0)
  (-2.0,2.7622)
\linethickness{.075mm}
\multiput(-2,0)(1,0){5}
  {\line(0,1){3}}
\multiput(-2,0)(0,1){4}
  {\line(1,0){4}}
\linethickness{.2mm}
\put( .3,.12763){\line(1,0){.4}}
\put(.5,-.07237){\line(0,1){.4}}
\put(-.7,.12763){\line(1,0){.4}}
\put(-.5,-.07237){\line(0,1){.4}}
\put(.8,.54308){\line(1,0){.4}}
\put(1,.34308){\line(0,1){.4}}
\put(-1.2,.54308){\line(1,0){.4}}
\put(-1,.34308){\line(0,1){.4}}
\put(1.3,1.35241){\line(1,0){.4}}
\put(1.5,1.15241){\line(0,1){.4}}
\put(-1.7,1.35241){\line(1,0){.4}}
\put(-1.5,1.15241){\line(0,1){.4}}
\put(-2.5,-0.25){\circle*{0.2}}
\end{picture}
\end{example}
KaÅ¾dÃ¡ ze symetrickÃ½ch polovin paraboly $y=\cosh x-1$ na tomto obrÃ¡zku lze pÅ™ibliÅ¾nÄ› zÃ­skat
pomocÃ­ B\'ezierovy kÅ™ivky. PravÃ¡ polovina kÅ™ivky konÄÃ­ v~bodÄ› \((2,\,2.7622)\), kde mÃ¡
sklon hodnotu \(m=3.6269\). Pokud opÄ›t pouÅ¾ijeme rovnici (\ref{zwischenpunkt}), mÅ¯Å¾eme
vypoÄÃ­tat stÅ™ednÃ­ kontrolnÃ­ body, kterÃ© v~naÅ¡em pÅ™Ã­padÄ› jsou $(1.2384,\,0)$ a~$(-1.2384,\,0)$. 
KÅ™Ã­Å¾ky znaÄÃ­ body \emph{skuteÄnÃ©} paraboly. Chyba, menÅ¡Ã­ neÅ¾ jedno procento, je stÄ›Å¾Ã­ postÅ™ehnutelnÃ¡.

V~nÃ¡sledujÃ­cÃ­m pÅ™Ã­kladu je u~\verb|\begin{picture}| pouÅ¾it nepovinnÃ½ parametr.
ObrÃ¡zek se definuje pomocÃ­ vhodnÃ½ch \uv{matematickÃ½ch} souÅ™adnic, zatÃ­mco pÅ™Ã­kazem
\begin{lscommand} 
  \ci{begin}\verb|{picture}(4.3,3.6)(-2.5,-0.25)|
\end{lscommand}
\noindent pÅ™iÅ™adÃ­me levÃ©mu dolnÃ­mu rohu (viz ÄernÃ½ kotouÄ) souÅ™adnice $(-2.5,-0.25)$. 

\subsection{Rychlost ve speciÃ¡lnÃ­ teorii relativity}

\begin{example}
\setlength{\unitlength}{0.8cm}
\begin{picture}(6,4)(-3,-2)
  \put(-2.5,0){\vector(1,0){5}}
  \put(2.7,-0.1){$\chi$}
  \put(0,-1.5){\vector(0,1){3}}
  \multiput(-2.5,1)(0.4,0){13}
    {\line(1,0){0.2}}
  \multiput(-2.5,-1)(0.4,0){13}
    {\line(1,0){0.2}}
  \put(0.2,1.4)
    {$\beta=v/c=\tanh\chi$}
  \qbezier(0,0)(0.8853,0.8853)
    (2,0.9640)
  \qbezier(0,0)(-0.8853,-0.8853)
    (-2,-0.9640)
  \put(-3,-2){\circle*{0.2}}
\end{picture}
\end{example}
KontrolnÃ­ body obou B\'ezierovÃ½ch kÅ™ivek byly zÃ­skÃ¡ny pomocÃ­ vzorcÅ¯ (\ref{zwischenpunkt}).
KladnÃ¡ ÄÃ¡st se urÄÃ­ pomocÃ­ $P_1=(0,\,0)$, $m_1=1$, $P_2=(2,\,\tanh 2)$ a~$m_2=1/\cosh^2 2$.
ObrÃ¡zek je opÄ›t definovÃ¡n pomocÃ­ vhodnÃ½ch souÅ™adnic a~levÃ©mu dolnÃ­mu rohu
jsou pÅ™iÅ™azeny matematickÃ© souÅ™adnice $(-3,-2)$, to je onen ÄernÃ½ kotouÄ.

\section{GrafickÃ½ balÃ­k Ti\emph{k}Z \&amp; PGF}
V~dneÅ¡nÃ­ dobÄ› umÃ­ kaÅ¾dÃ½ systÃ©m generujÃ­cÃ­ \LaTeX ovÃ½ vÃ½stup vytvoÅ™it pÄ›knou
vektorovou grafiku, jen rozhranÃ­ se ponÄ›kud liÅ¡Ã­. BalÃ­k PGF poskytuje abstraktnÃ­
vrstvu nad tÄ›mito rozhranÃ­mi a~umoÅ¾Åˆuje pouÅ¾Ã­vat jednoduchÃ© pÅ™Ã­kazy
pro vytvoÅ™enÃ­ sloÅ¾itÃ© vektorovÃ© grafiky pÅ™Ã­mo \uv{zevnitÅ™} \LaTeX ovÃ©ho dokumentu.
BalÃ­k PGF obsahuje vÃ­ce neÅ¾ sedmisetstrÃ¡nkovou dokumentaci~\cite{pgfplot}, 
my si vÅ¡ak dovolÃ­me bÃ½t v~tÃ©to sekci o~pÃ¡r set stran struÄnÄ›jÅ¡Ã­. 
%my proto v~tÃ©to sekci budeme struÄnÃ­.

Pro pÅ™Ã­stup k~funkcÃ­m \uv{vyÅ¡Å¡Ã­ ÃºrovnÄ›} balÃ­ku PGF byste si mÄ›li nahrÃ¡t
balÃ­k \pai{tikz}, s~kterÃ½m mÅ¯Å¾ete pouÅ¾Ã­vat vÃ½konnÃ© pÅ™Ã­kazy ke kreslenÃ­ grafiky
pÅ™Ã­mo ze svÃ©ho dokumentu. KreslÃ­cÃ­ instrukce vloÅ¾te dovnitÅ™ prostÅ™edÃ­ \ei{tikzpicture}.

\begin{example}
\begin{tikzpicture}[scale=3]
  \clip (-0.1,-0.2)
     rectangle (1.8,1.2);
  \draw
     [step=.25cm,gray,very thin]
     (-1.4,-1.4) grid (3.4,3.4);
  \draw (-1.5,0) -- (2.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}
\end{example}
Pokud jste obeznÃ¡meni s~dalÅ¡Ã­mi programovacÃ­mi jazyky, moÅ¾nÃ¡ si vÅ¡imnete
povÄ›domÃ©ho stÅ™ednÃ­ku (\texttt{;}) pouÅ¾itÃ©ho k~oddÄ›lenÃ­ pÅ™Ã­kazÅ¯. 

PomocÃ­
pÅ™Ã­kazu \ci{usetikzlibrary} v~preambuli mÅ¯Å¾ete aktivovat Å™adu rozÅ¡iÅ™ujÃ­cÃ­ch
rysÅ¯ pro kreslenÃ­ speciÃ¡lnÃ­ch tvarÅ¯, napÅ™. tento box, kterÃ½ je trochu prohnutÃ½.
\begin{example}
\usetikzlibrary{%
  decorations.pathmorphing}
\begin{tikzpicture}[
   decoration={bent,aspect=.3}]
 \draw [decorate,fill=lightgray]
        (0,0) rectangle (5.5,2);
 \node[circle,draw] 
        (A) at (.5,.5) {A};
 \node[circle,draw] 
        (B) at (5,1.5) {B};
 \draw[-&gt;,decorate] (A) -- (B);
 \draw[-&gt;,decorate] (B) -- (A);
\end{tikzpicture}
\end{example}

MÅ¯Å¾ete dokonce kreslit diagramy, kterÃ© jako by vypadly z~knihy o~programovÃ¡nÃ­
v~Pascalu. KÃ³d takovÃ©ho diagramu je rozsÃ¡hlejÅ¡Ã­ neÅ¾ v~pÅ™edchozÃ­m pÅ™Ã­kladu,
takÅ¾e ukÃ¡Å¾eme jenom vÃ½sledek. V~PGF dokumentaci je dÅ¯kladnÃ½ popis kresby
tohoto diagramu.

\begin{center}
\begin{tikzpicture}[point/.style={coordinate},thick,draw=black!50,&gt;=stealth',
                    tip/.style={-&gt;,shorten &gt;=1pt},every join/.style={rounded corners},
                    skip loop/.style={to path={-- ++(0,#1) -| (\tikztotarget)}},
                    hv path/.style={to path={-| (\tikztotarget)}},
                    vh path/.style={to path={|- (\tikztotarget)}},
                 terminal/.style={
            rounded rectangle,
            minimum size=6mm,
            thick,draw=black!50,
            top color=white,bottom color=black!20,
            font=\ttfamily\tiny},
                nonterminal/.style={
                       rectangle,
                       minimum size=6mm,
                       thick,
                       draw=red!50!black!50,         % 50% red and 50% black,
                       top color=white,              % a shading that is white at the top...
                       bottom color=red!50!black!20, % and something else at the bottom
                       font=\itshape\tiny}]
\matrix[column sep=3mm] {
  % First row:
  &amp; &amp; &amp; &amp; &amp; &amp; &amp; &amp; &amp; &amp; &amp; \node (plus) [terminal] {+};\\
  % Second row:
  \node (p1) [point] {}; &amp;     \node (ui1)    [nonterminal] {unsigned integer}; &amp;
  \node (p2) [point] {}; &amp;     \node (dot)    [terminal]    {.};                &amp;
  \node (p3) [point] {}; &amp;     \node (digit) [terminal]     {digit};            &amp;
  \node (p4) [point] {}; &amp;     \node (p5)     [point] {};                       &amp;
  \node (p6) [point] {}; &amp;     \node (e)      [terminal]    {E};                &amp;
  \node (p7) [point] {}; &amp;                                                      &amp;
  \node (p8) [point] {}; &amp;     \node (ui2)    [nonterminal] {unsigned integer}; &amp;
  \node (p9) [point] {}; &amp;     \node (p10)    [point]       {};\\
  % Third row:
  &amp; &amp; &amp; &amp; &amp; &amp; &amp; &amp; &amp; &amp; &amp; \node (minus)[terminal] {-};\\
};
{ [start chain]
  \chainin (p1);
  \chainin (ui1)   [join=by tip];
  \chainin (p2)    [join];
  \chainin (dot)   [join=by tip];
  \chainin (p3)    [join];
  \chainin (digit) [join=by tip];
  \chainin (p4)    [join];
  { [start branch=digit loop]
    \chainin (p3) [join=by {skip loop=-6mm,tip}];
  }
  \chainin (p5)    [join,join=with p2 by {skip loop=6mm,tip}];
  \chainin (p6)    [join];
  \chainin (e)     [join=by tip];
  \chainin (p7)    [join];
  { [start branch=plus]
    \chainin (plus) [join=by {vh path,tip}];
    \chainin (p8)    [join=by {hv path,tip}];
  }
  { [start branch=minus]
    \chainin (minus) [join=by {vh path,tip}];
    \chainin (p8)    [join=by {hv path,tip}];
  }
  \chainin (p8)    [join];
  \chainin (ui2)   [join=by tip];
  \chainin (p9)    [join,join=with p6 by {skip loop=-11mm,tip}];
  \chainin (p10)   [join=by tip];
}
\end{tikzpicture}
\end{center}

\pagebreak
PotÅ™ebujete-li kreslit grafy ÄÃ­selnÃ½ch hodnot nebo funkcÃ­, mÄ›li
byste se dÅ¯kladnÄ›ji seznÃ¡mit s~balÃ­ky \pai{pgfplots} a~\pai{pgfplotstable}, kterÃ© poskytujÃ­
vÅ¡echno potÅ™ebnÃ©. VyhodnocenÃ­ funkcÃ­, kterÃ© chcete zobrazit, umÃ­
dokonce udÄ›lat vyvolÃ¡nÃ­m externÃ­ho programu \texttt{gnuplot}, \url{http://www.gnuplot.info/}.

Pro jeÅ¡tÄ› nÃ¡roÄnÄ›jÅ¡Ã­ ÄtenÃ¡Å™e zmiÅˆujeme existenci jazyka~R -- vÃ½poÄetnÃ­ prostÅ™edÃ­ zamÄ›Å™enÃ© na statistiku, \url{http://www.r-project.org/}, a~pomocnÃ©ho balÃ­ku \textsf{Sweave}. 

Nelze opominout tÃ©Å¾ systÃ©m Sage -- prostÅ™edÃ­ zamÄ›Å™enÃ© na matematiku, \url{http://www.sagemath.org/}, a~pomocnÃ½ balÃ­k Sage\TeX, kde mÃ¡ naÅ¡inec na vÃ½voji a~testovÃ¡nÃ­ nemalÃ© zÃ¡sluhy (Robert MaÅ™Ã­k, Brno).

%%% Local Variables:
%%% TeX-master: "lshort.tex"
%%% mode: flyspell
%%% TeX-PDF-mode: t
%%% End:
</pre></body></html>