% Translation: VZ 2006-10-31
% Checking:    2006-11-15 zyka
\startcomponent ma-cb-cz-commands
\project ma-cb
\product ma-cb-cz
\environment ma-cb-env-cz

% \chapter{Defining commands / macros}
\chapter{Definov�n� p��kaz� / maker}

\index{definice+p��kaz� a maker}

% \CONTEXT\ is a set of macros based on \TEX. \TEX\ is a
% programming language as well as a typographical system. This
% means that you can do the programming yourself if you need
% that kind of flexability.
\CONTEXT{} je sada maker zalo�en� na \TEX u. \TEX{} je programovac�
jazyk a z�rove� typografick� syst�m. To znamen�, �e si m��eme sami
naprogramovat ur�it� vlastnosti, pokud takovou
flexibilitu pot�ebujeme.

% You can define a new command with:
Nov� p��kaz m��eme nadefinovat pomoc�

\shortsetup{define}

% The next example will explain its meaning.
N�sleduj�c� p��klad objasn� jeho pou�it�.

% You may have a well illustrated document and you are tired of
% typing:
M��eme m�t bohat� ilustrovan� dokument a pokud jsme ji� unaven� psan�m

% \startbuffer
% \placefigure
%   [here,force]
%   [fig:logical name]
%   {Caption.}
%   {\externalfigure[filename][width=5cm]}
% \stopbuffer
\startbuffer
\placefigure
  [here,force]
  [fig:logick� jm�no]
  {Popisek.}
  {\externalfigure[soubor][width=5cm]}
\stopbuffer

\typebuffer

% You could define your own command with a few variables like:
m��eme si definovat vlastn� p��kaz s~n�kolika prom�nn�mi:

% \startitemize[packed]
% \item logical name
% \item caption
% \item file name
% \stopitemize
\startitemize[packed]
\item logick� jm�no;
\item popisek;
\item soubor.
\stopitemize

% Your command definition and call could look something like
% this:
Na�e definice p��kazu a jeho vol�n� m��e vypadat takto:

% \startbuffer
% \define[3]\myputfigure
%   {\placefigure
%      [here,force][fig:#1]
%      {#2}{\externalfigure[#3][width=5cm]}}

% \myputfigure{lion}{The Dutch lion is a sentry.}{ma-cb-13}
% \stopbuffer
\startbuffer
\define[3]\mujobrazek
  {\placefigure
     [here,force][fig:#1]
     {#2}{\externalfigure[#3][width=5cm]}}

\mujobrazek{lev}{Holandsk� lev na str�i.}{ma-cb-13}
\stopbuffer

\typebuffer

% Between brackets \type{[3]} indicates that you want to use
% three variables \type{#1}, \type{#2} and \type{#3}. In the
% command call \type{\myputfigure} you have to input these
% variables between curly braces. The result would be:
V~hranat�ch z�vork�ch \type{[3]} stanovujeme, �e chceme t�i prom�nn�
\type{#1}, \type{#2} a~\type{#3}. P�i vol�n� p��kazu
\type{\mujobrazek} mus�me vlo�it tyto t�i prom�nn� hodnoty mezi
slo�en� z�vorky. V�sledkem bude:

\getbuffer

% Very sophisticated commands can be programmed but this is
% left to your own inventiveness.
Programov�n� sofistikovan�j��ch p��kaz� je ponech�no na �ten��i.

% In addition to defining commands you can also define
% \type{\start} $\cdots$ \type{\stop} command pairs.
Krom� definov�n� p��kaz� m��eme tak� nav�c definovat dvojici
\type{\start} $\cdots$ \type{\stop}.

\shortsetup{definestartstop}

% For example:
Nap��klad:

% \startbuffer
% \definestartstop
%    [stars]
%    [commands={\inleft{\hbox to \leftmarginwidth
%                     {\leaders\hbox{$\star$}\hfill}}},
%     before=\blank,
%     after=\blank]
%
% \startstars
% {\em Hasselter Juffers} are sweet cookies but the name is no
% coincidence. On July 21 in 1233 the {\em Zwartewaterklooster}
% (Blackwater Monastery) was founded. The monastery was meant
% for unmarried girls and women belonging to the nobility of
% Hasselt. These girls and women were called {\em juffers}.
% \stopstars
% \stopbuffer
\startbuffer
\definestartstop
   [hvezdicky]
   [commands={\inleft{\hbox to \leftmarginwidth
                 {\leaders\hbox{$\star$}\hfill}}},
    before=\blank,
    after=\blank]

\starthvezdicky
{\em Hasselter Juffers} jsou sladk� kol��ky, ale jejich
n�zev nen� h���ka n�hody. V~�ervenci roku 1233 byl zalo�en
kl�ter {\em Zwartewaterklooster} (�ern� voda). Kl�ter byl
zam��len pro neprovdan� d�vky a~�eny pat��c� k~�lecht� Hasseltu.
Tyto d�vky a~�eny byly naz�v�ny {\em juffers}.
\stophvezdicky
\stopbuffer

\typebuffer

% This will result in:
V�sledkem bude:

\getbuffer

\stopcomponent
