On Tue, 6 Jan 2004, Henning Hraban Ramm wrote:

> Am Dienstag, 06.01.04, um 08:21 Uhr (Europe/Zurich) schrieb Peter
> Münster:
> > Ok, I'm going to try it, perhaps it'll be my first ConTeXt module ;)
>
> It shouldn't be a module, but an environment.

All right. Here is my first try, where you can see, that I've still a
problem to be solved, so I would be lucky about any help:

% this environment works a little bit like \usepackage[DIVcalc]{typearea}
% in LaTeX as explained in detail in scrguien.pdf (KOMA-Script documentation)
\startenvironment e-test
\def\BCOR{3mm}% eventual binding correction
\setbox\scratchbox\hbox{\dorecurse{26}{\character\recurselevel}}
\newdimen\PageWidth
\PageWidth=\paperwidth
\doifmode{BCOR}{\PageWidth=\dimexpr(\PageWidth-\BCOR)}

%%%%%% Here is the problem: dividing one length by another. %%%%%%
% the following is not working for 2 reasons:
% * there is still the "pt" behind the numbers
% * one cannot divide by a real number, only integer
%\edef\Ratio{\the\numexpr(\the\paperheight / \the\PageWidth)}
\edef\Ratio{1.5}% to make the rest work...
\newdimen\Width
\newdimen\Height
\newdimen\Back
\Width=\dimexpr(2.5\wd\scratchbox)
\Height=\dimexpr(\Ratio\Width)
\headerheight=2.75\baselineskip
\edef\Top{\the\dimexpr((\paperheight - \Height) / 3 - \headerheight)}
\doifmodeelse{oneside}{%
  \Back=\dimexpr((\PageWidth - \Width) / 2)
}{%
  \Back=\dimexpr((\PageWidth - \Width) / 3)
  \setuppagenumbering[alternative=doublesided]}
\doifmode{BCOR}{\Back=\dimexpr(\Back + \BCOR)}
\Height=\dimexpr(\Height + \headerheight + \footerheight)
\setuplayout[header=\the\headerheight,height=\the\Height,
  width=\the\Width,topspace=\Top,backspace=\the\Back]
\stopenvironment

Peter

-- 
http://pmrb.free.fr/contact/
------------------------------------
Film Search site: http://f-s.sf.net/

_______________________________________________
ntg-context mailing list
[EMAIL PROTECTED]
http://www.ntg.nl/mailman/listinfo/ntg-context

Reply via email to