% Makra pro sazbu zapisku z prednasky
-\input mjmac.tex
+\input ucwmac.tex
+\input ucw-verb.tex
+\input ucw-ofs.tex
\input epsf.tex
-%%\input btxmac.tex
\language=\czech
\chyph
\lefthyphenmin=2
\righthyphenmin=2
-
-% A4 s 0.5in okraji
-%\hsize=184.6mm
-%\vsize=271.6mm
-%\parindent=0.25in
+\inlineverbon
% A5 s 1cm okraji, dolni rozsiren o 10pt, aby se tam veslo cislo stranky
-\hsize=128mm
-\vsize=190mm
-\advance\vsize by -10pt
+\setmargins{1cm}
+\advance\bottommargin by 10pt
+\setpaper{a5}
\parindent=0.8cm
% Zacatek prednasky {cislo prednasky}{jmeno prednasky}{jmeno zapisovatele}
\def\prednaska#1#2#3{%
-\line{{\Large\bf #1. #2} \hfil {\it #3}}
+\line{{\setfonts[/14]\bf #1. #2} \hfil {\it #3}}
\vskip 4pt
\hrule
\medskip
\def\h#1{\medbreak\leftline{\bf #1}\nobreak\smallskip\nobreak}
% Zvyrazneny zacatek odstavce coby podnadpis (napr. vety apod.)
-\def\s#1{\noindent {\bo #1}}
+\def\s#1{\smallskip\noindent {\bo #1}}
% A kdyz stoji samostatne (aby se naodlamoval)
-\def\ss#1{\noindent {\bo #1}\par\nobreak}
+\def\ss#1{\smallskip\noindent {\bo #1}\par\nobreak}
% Dùkaz
-\def\proof{\noindent {\sl Dùkaz:} }
+\def\proof{\nobreak\noindent {\sl Dùkaz:} }
% Srdicko na konci dukazu
\def\qed{{\parfillskip=0pt\allowbreak\hfill\nobreak $\heartsuit$\par}}
-% pokud je v seznamu:
+% ... pokud je v seznamu:
\def\qeditem{{\parfillskip=0pt\hfill\rlap{\hskip\rightskip\llap{$\heartsuit$}}\par}}
+% Zvyrazneni pojmu
+\def\em#1{{\it #1\/}}
+
% Poznamky pod carou
\newcount\footcnt
\footcnt=0
% \noindent se casto hodi, tak na nej mame zkratku
\let\>=\noindent
-% Sazba algoritmu:
-% \algo
+%%% Sazba algoritmu %%%
+
+% \algon{jmeno algoritmu}
% \algin popis vstupu
% \:krok
% \:krok
% \::vnoreny krok
-% \algout pop
+% \algout popis vystupu
% \endalgo
-\def\algo{
-\interlistskip
+\def\typedalgo#1#2{
+\vskip\preitemizeskip
\begingroup
\let\:=\algoitem
\parskip=1pt plus 1pt minus 0.3pt
\rightskip=2em
\itemcount=0
+{\bo #1\/} \alg{#2}%
}
-\def\endalgo{\interlistskip\endgroup}
+\def\algo#1{\typedalgo{Algoritmus}{#1}}
+\def\proc#1{\typedalgo{Procedura}{#1}}
+\def\endalgo{\vskip\postitemizeskip\endgroup}
+\let\endproc=\endalgo
\def\algopar{\par
\parindent=2em
\hangindent=4em
\hangafter=1
\leavevmode
}
-\def\algoitem{\algopar\advance\itemcount by 1
+\def\algoitem{
+\ifnum\itemcount=0\smallskip\fi
+\algopar\advance\itemcount by 1
\hbox to 2em{\hss \the\itemcount. }%
\futurelet\next\algoitemh}
\def\algoitemh{\ifx\next:\let\next=\algohang\else\let\next=\relax\fi\next}
\def\algohang:{\advance\hangindent by 2em \hskip 2em\futurelet\next\algoitemh}
-\def\algin{\:{\I Vstup:} }
-\def\algout{\:{\I Výstup:} }
+\def\algin{\par{\it Vstup:\/} }
+\def\algout{\par\smallskip{\it Výstup:\/} }
+
+% Jmeno algoritmu v textu nebo ve formuli
+\def\alg#1{\hbox{\csc #1}}
+
+%%% Konstrukce pouzivane v algoritmech %%%
+
+% Priraditko
+\def\={\leftarrow}
+
+% Komentar
+\def\cmt#1{~~{\sl (#1)}}
% Nekolikapismenkova promenna (mozno pouzit v textovem i math modu)
\def\<#1>{\leavevmode\hbox{\it #1\/}}
\def\O{{\cal O}}
% Vlozeni obrazku {obrazek}{popisek}{sirka}
-\def\figure#1#2#3{\midinsert
-\vbox{\centerline{\epsfxsize=#3\epsfbox{#1}}\smallskip\centerline{#2}}
-\endinsert}
+\def\figure#1#2#3{\bigskip\vbox{\centerline{\epsfxsize=#3\epsfbox{#1}}\smallskip\centerline{#2}}\bigskip}
% Varianta bez popisku
\def\fig#1#2{\medskip\centerline{\epsfxsize=#2\epsfbox{#1}}\medskip}
% Dva obrazky vedle sebe s popiskami
-\def\twofigures#1#2#3#4#5#6{\bigskip\centerline{\vbox{\halign{\hfil##\hfil\hskip 4em&\hfil##\hfil\cr
-\epsfxsize=#3\epsfbox{#1}&\epsfxsize=#6\epsfbox{#4}\cr
-\noalign{\smallskip}
-#2\cr}}}\bigskip}
+\def\twofigures#1#2#3#4#5#6{\bigskip\valign{\vfil##\vfil\cr
+ \halign{\hfil##\hfil\cr
+ \epsfxsize=#3\epsfbox{#1} \cr
+ \noalign{\smallskip}
+ #2\cr}
+ \cr
+ \noalign{\hskip 2em}
+ \halign{\hfil##\hfil\cr
+ \epsfxsize=#6\epsfbox{#4} \cr
+ \noalign{\smallskip}
+ #5\cr}
+ \cr
+}\bigskip}
% Obrazek vlozeny do praveho okraje odstavce {obrazek}{sirka}
% Pouzit na zacatku odstavce a nejlepe celou konstrukci zavrit do vboxu, aby se nerozlomila
% Todo
\def\todo#1{{\bf TODO: \it #1}}
-% Blackboard bold font
-\newfam\bbfam
-\font\bbten=bbold10
-\font\bbseven=bbold7
-\font\bbfive=bbold5
-\textfont\bbfam=\bbten
-\scriptfont\bbfam=\bbseven
-\scriptscriptfont\bbfam=\bbfive
-\def\bb{\bbten\fam\bbfam}
-
-% Reference na konci kapitoly
-%\bibliographystyle{abbrv}
-%\def\references{\h{Literatura}\dumprefs}
-%\def\dumprefs{
-%\def\bblhook{\parskip=2pt plus 1pt minus 0.5pt}
-%\bibliography{../ga}
-%}
-
-% Predefinujeme odsazovani odrazek z mjmacu
-\def\itemspacingrules{\ifitem\advance\leftskip by \parindent\parindent=0pt\itemfalse\else
-\advance\leftskip by 2.5em\fi\rightskip=\leftskip}
-
% Matematicke symboly
\def\symdiff{\mathop{\Delta}}
+
+% Slozitostni tridy
+\def\cc#1{\hbox{\setfonts[CMSans/]\bf #1}}
+\def\P{\cc{P}}
+\def\NP{\cc{NP}}
+
+%%% Cislovani verzi %%%
+
+\def\currentversion{%
+\the\year
+-\ifnum\month<10\relax 0\fi\the\month
+-\ifnum\day<10\relax 0\fi\the\day
+}
+
+\footline={\hfil {\tenrm\the\count0}\hfil \llap{\sevenrm\currentversion}}
+
+%%% Cviceni %%%
+
+\newcount\excount
+
+\def\exercises{\medskip
+\begingroup
+\h{Cvièení}
+\nobreak
+\excount=0
+\advance\leftskip by 1.5em
+\parindent=0pt
+}
+
+\def\endexercises{\endgroup}
+
+\long\def\exwith#1#2{\par
+\advance\excount by 1
+\>\llap{\hbox to 1.5em{\the\excount\rlap{#1}.\hfil}}%
+#2}
+
+% Cviceni obycejne a tezsi
+\def\ex{\exwith{}}
+\def\exx{\exwith{*}}
+\def\exxx{\exwith{*\kern-0.1em*}}
+
+% Napovedy (pise se pod cviceni, sazi se samostatne pomoci \hints)
+
+\newwrite\hintaux
+\immediate\openout\hintaux=hints.aux
+
+\long\def\hint#1{
+% \par\>\em{Hint:} #1
+\immediate\write\hintaux{\noexpand\realhint{\the\excount}{\unexpanded{#1}}
+}}
+
+\def\realhint#1#2{\par
+\>\llap{\hbox to 1.5em{#1.\hfil}}%
+#2}
+
+\def\hints{
+\immediate\closeout\hintaux
+\h{Nápovìdy ke cvièením}
+\nobreak
+{
+\advance\leftskip by 1.5em
+\parindent=0pt
+\input hints.aux
+\par
+}
+\immediate\openout\hintaux=hints.aux
+}
+
+% Reseni cviceni, pise pod cviceni (a pripadne pod \hint)
+%\long\def\solution#1{\par
+%\>\em{Øe¹ení:} #1}
+
+%%% Odkazy na kapitoly a jine objekty %%%
+
+% Poridime si soubor, do ktereho budeme zapisovat identifikatory
+\newwrite\ids
+\def\writeid#1#2{\immediate\write\ids{\string\def\expandafter\string\csname id#1\endcsname{#2}}}
+
+\immediate\openin\ids=ids.aux
+\ifeof\ids
+\else
+\input ids.aux
+\fi
+\immediate\closein\ids
+\immediate\openout\ids=ids.aux
+
+\def\ref#1{\expandafter\ifx\csname id#1\endcsname\relax
+{\bo ??}%
+\immediate\write16{*** Warning: Reference #1 undefined ***}%
+\else
+\csname id#1\endcsname
+\fi
+}