\startenvironment ma-cb-bulletin

% This setups sets typesetting environment for the Bulletin
% of Czechchoslovac TeX User Group:
%   paper A5

\unprotect

\setuppapersize[A5][A5]

\setuplayout
  [
   \c!location=\v!middle,
   \c!width=fit,
   \c!height=fit,
%   \c!location=\v!singlesided,
   \c!location=\v!doublesided,
%   \c!width=fit,\c!backspace=10.2mm,\c!cutspace=15.1mm, % wrong print
   \c!width=fit,\c!backspace=12.2mm,\c!cutspace=13.1mm,
%   \c!margin=0pt,\c!margindistance=0pt,
   \c!margin=1.25cm,\c!margindistance=.25cm,
   \c!height=fit,\c!topspace=11mm,\c!bottomspace=7mm,
%   \c!header=0pt,\c!headerdistance=0pt,\c!footer=12pt,\c!footerdistance=9mm,
   \c!header=0pt,\c!headerdistance=0pt,\c!footer=20pt,\c!footerdistance=18.5pt,
  ]

\setupbodyfont[palatino,9pt]

\setupsectionblock
  [\v!frontmatter]
  [\c!page=no,doublesided=no]

\setupsectionblock
  [\v!bodymatter]
  [\c!page=no]

\setupsectionblock
  [\v!appendix]
  [\c!page=no]

\setupsectionblock
  [\v!backmatter]
  [\c!page=no]

\startsetups introduction
  \setuphead[\v!chapter][\c!page=no]
  \setuphead[\v!title][\c!page=no]
\stopsetups

\startsetups bodymatter
  \setuphead[\v!chapter][\c!page=]
\stopsetups

\startsetups appendix
  \setuphead[\v!chapter][\c!page=yes]
\stopsetups

\setuphead
  [\v!title]
  [\c!page=yes]

\setupmakeup[standard][page=no,doublesided=no]

% --- narrow typing
%\usemodule[narrowtt]
%\definetypeface
%  [narrowtt] [tt]
%  [mono] [modern-cond] [default] [encoding=\defaultencoding]

%\setuptyping[style=\narrowtt]
%\setuptype  [style=\narrowtt]
\setuptyping[style={\switchtobodyfont[8pt]\tt}]
\setuptype  [style={\switchtobodyfont[8pt]\tt}]

% --- numbering
\setuppagenumbering[\c!alternative=\v!doublesided]

% --- chapter
\setuphead
  [\v!chapter]
  [\c!before=\vskip24pt plus 4pt minus 4pt,
   \c!after=\vskip16pt]

\def\TitlePage#1#2#3%
  {\setupbackgrounds
     [\v!rightpage]
     [\c!background=geintje]
   \setuptexttexts
     [\TitleButton]
     []
   \startmakeup
     [\v!standard]
     [\c!doublesided=\v!no,
      \c!page=\v!no,
      \c!headerstate=\v!none,
      \c!footerstate=\v!none]
   \hbox to \hsize
     {\hss
      \definedfont[SansBold at 36pt]% \setfont lsb at 40pt    % change this into something available
      \framed
        [\c!background=TitelAchtergrond,
         \c!width=\v!fit,
         \c!height=\v!fit,
         \c!align=\v!middle,
         \c!frame=\v!off,
         \c!offset=40pt]
        {#1}}
   \vfill
   \hbox to \hsize
     {\definedfont[SansBold at 12pt]% \setfont lsb at 14pt    % change this into something available
      \framed
        [\c!background=AuteurAchtergrond,
         \c!frame=\v!off,
         \c!width=\v!fit,
         \c!height=\v!fit,
         \c!align=\v!middle,
         \c!offset=20pt]
        {#2}
      \hss}
   \hbox to \hsize
     {\hss
      \definedfont[SansBold at 18pt]% \setfont lsb at 20pt    % change this into something available
      \framed
        [\c!background=AuteurAchtergrond,
         \c!frame=\v!off,
         \c!width=\v!fit,
         \c!height=\v!fit,
         \c!align=\v!middle,
         \c!offset=35pt]
        {#3\\PRAGMA ADE}}
   \stopmakeup
   %\setuplayout[\c!marking=\v!off]
   \setuptexttexts
   \setupbackgrounds
     [\v!rightpage]
     [\c!background=]
   \doifmode{screen}
     {\setupbackgrounds
        [\v!page]
        [\c!background=\v!screen,
         \c!backgroundscreen=.95]
      \setupbackgrounds
        [\v!text][\v!text]
        [\c!backgroundoffset=.25cm,
         \c!depth=.125cm,
         \c!background=\v!color,
         \c!backgroundcolor=white]}}

\def\HeadCommand#1#2%
  {\alignedline{\v!outer}{\v!left}
     {\framed
        [\c!background=KopAchtergrond,
         \c!width=\v!fit,
         \c!height=\v!fit,
         \c!frame=\v!off,
         \c!strut=\v!no,
         \c!offset=20pt,
         \c!align=\v!middle]
        {\doifmode{*sectionnumber}
           {#1\kern.5em% strut niet geset, zou wel moeten
            \hbox{\color[headrule]{\vrule\!!width1pt\!!height1.5\ht\strutbox\!!depth1.25\dp\strutbox}}%
            \kern.5em}%
         #2}}}


\unexpanded\def\PlaatschapterStatus
  {\determineheadnumber[\v!chapter]%
   \ifnum\currentheadnumber>0
     \vbox to \makeupheight
       {\scratchcounter=\lastpage
        \advance\scratchcounter by -\realpageno
        \vskip1.5cm
        \vskip0pt plus \realpageno cm
        \edef\StatusAchtergrond
          {StatusAchtergrond%
%           \ifodd\realpageno R\else\ifdubbelzijdig L\else R\fi\fi}%
           \ifodd\realpageno R\else\ifdoublesided L\else R\fi\fi}%
        \framed
          [\c!background=\StatusAchtergrond,
           \c!width=30pt,
           \c!height=60pt,
           \c!frame=\v!off]
          {\lower.5\dp\strutbox\hbox
             {\bfb\getmarking[\v!chapter\v!number]}}
        \vskip0pt plus \scratchcounter cm
        \vskip1.5cm}
   \fi}

% --- colors
\setupcolors[state=stop]

% --- misc
\def\Fr#1{\bgroup\rm\tfx(\from[#1])\egroup}

\protect

\stopenvironment
