%% ConTeXt template class for technical report
%% for subject NRP in Czech Technical University in Prague (CTU)
%%
%% (c) 2008 Vit Zyka
%%
%% History:
%% 0.1 2008-09-21 new

\startenvironment nrp-cont-report

% ----------------------------------------------- Title

% --- Layout
\setuplayout[%
  backspace=15mm,
  topspace=18mm,bottomspace=10mm,
  %columndistance=10mm,
  header=0pt,footer=7mm,footerdistance=8mm,
  width=middle,height=middle,grid=yes]
\setupcolumns[distance=10mm]

\setuppagenumbering[alternative=singlesided,location=]

%\showframe

% --- Font
\setupbodyfont[10pt]
\setupindenting[medium,yes]

% --- Header
\setupheadertexts[]
\setupfootertexts[pagenumber]

\setupfooter[style=\tfa]

% --- Title
\def\startTitle{%
  \startalignment[middle]
}
\def\stopTitle{%
  \blank[halfline]
  {\tfa\date}%
  \blank[3*big]
  \stopalignment
}

\def\Title#1{{\ss\bfc\setupinterlinespace#1\blank[halfline]}}
\def\Author#1{{\tfb#1}\blank[halfline]}
\def\Inst#1{\high{#1}}

\def\Institute#1{{\let\\\crlf\tfa#1}}
\def\Email#1{{\tta#1}}

% --- Body
\def\startBody{\blank\startcolumns}
\def\stopBody{\stopcolumns}

% --- Abstract
\def\startAbstract
  {\startnarrower
   {\bf Abstract. }%
  }
\def\stopAbstract
  {\stopnarrower
  }

% --- Heads
\setuphead
  [section]
  [style=\ss\bfa,before=\blank,after=\blank,grid={4pt}]

\setuphead
  [subsection]
  [style=\subsectioStyle,before=\blank,after=,grid=high]
\def\subsectioStyle{\ss\bf\switchtobodyfont[11pt]}

\setuphead % bibliography
  [title]
  [page=no,style=\ss\bfb,before=\blank,after=\blank,grid={4pt}]

\setuphead
  [subject]
  [page=no,style=\ss\bf,before=\blank,after=,alternative=text,textcommand=\putDot]
\def\putDot#1{#1.}

% --- Center
\def\startcenter{\par\leftskip=0pt plus1fill\rightskip=0pt plus1fill }
\def\stopcenter{\par}

% --- Figs
\setupexternalfigures[location={local,global,default},factor=fit]

\setupcaptions[align={lohi,middle},width=\textwidth,stopper=.]

% --- Tables
\setupcaption[table][location=top,align={lohi,middle}]

\setupfloats[ntop=3,nbottom=3]

% --- URL
\def\urlHack{%
  \let\urlOrig=\url
  \def\gotoURL##1{\useURL[foo][##1]\from[foo]}%
  \def\url##1{\bgroup\let\url=\urlOrig\gotoURL{##1}\egroup}%
}

% --- Bibliography
\usemodule[bib]
\usemodule[bibltx]
\setuppublications[alternative=num,autohang=yes]
\setuppublicationlist[before=\urlHack]

% --- Misc
\newdimen\tmpD

%\def\LaTeX{La\TeX{}}
%\def\MetaPost{METAPOST}

\stopenvironment

% end of nrp-cont-report.tex
