[NTG-context] typearea
Hans Hagen
ntg-context@ntg.nl
Thu, 15 Jan 2004 11:23:35 +0100
At 19:33 14/01/2004, you wrote:
>On Sun, 11 Jan 2004, Peter M=FCnster wrote:
>
> > %%%%%% Here is the problem: dividing one length by another. %%%%%%
[code skipped]
Some days ago Willy Egger sent me a translation/summary of this koma page=20
size adventure.
Since I opt for a more contexty solution i want to follow a stepwise=20
approach in getting this done. As a start:
(1) the ratio: this is the most efficient and (on average) accurate=20
solution that also handles large paper sizes:
%edef\layoutratio{\withoutpt{\the\dimexpr(8\paperheight/\dimexpr(\paperwidth=
/=20
8192))}}
%edef\layoutratio{\withoutpt{\the\dimexpr(4\paperheight/\dimexpr(\paperwidth=
/16384))}}
%edef\layoutratio{\withoutpt{\the\dimexpr(2\paperheight/\dimexpr(\paperwidth=
/32768))}}
\edef\layoutratio{\withoutpt{\the\dimexpr(2\paperheight/(\paperwidth/32768))=
}}
(2) for the moment this way, will be handled slightly different (because in=
=20
context we can mix layouts and layouts can be dynamic
\def\layoutwidth
{10cm}
\unprotected \def\layouthfheight
{\dimexpr(\layoutparameter\c!hoofd+\layoutparameter\c!hoofdafstand+
\layoutparameter\c!voet +\layoutparameter\c!voetafstand )}
\def\layoutheight
{\dimexpr(\layoutratio\dimexpr(\layoutwidth)+\layouthfheight)}
(3) this brings us:
\definelayout
[koma] % actually i want a better name since it's one of a set of=20
calculations
[backspace=3D\dimexpr((\paperwidth-\layoutwidth)/2),
width=3Dmiddle, % less rounding errors than \layoutwidth,
cutspace=3D\dimexpr((\paperwidth-\layoutwidth)/2),
header=3D2\lineheight,
headerdistance=3D\lineheight,
height=3Dmiddle, % less rounding errors than \layoutheight
footerdistance=3D\lineheight,
footer=3D2\lineheight,
=
topspace=3D\dimexpr(1\dimexpr(\paperheight-(\layoutheight+\layouthfheight))=
/3),
=
bottomspace=3D\dimexpr(2\dimexpr(\paperheight-(\layoutheight+\layouthfheigh=
t))/3)]
\setuplayout
[koma]
(4) the 'number of chars per line' .. i'll come back to that
Hans