Hello, I'm just switching from LaTeX to ConTeXt. Is there already a module with similar functionalities as the typearea¹ package that comes with LaTeX? ¹ typearea comes with KOMA-Script and permits to automatically calculate the right margins with respect to some typographic rules. Cheers, Peter -- http://pmrb.free.fr/contact/ ------------------------------------ Film Search site: http://f-s.sf.net/
At 19:24 04/01/2004, you wrote:
Hello, I'm just switching from LaTeX to ConTeXt. Is there already a module with similar functionalities as the typearea¹ package that comes with LaTeX?
¹ typearea comes with KOMA-Script and permits to automatically calculate the right margins with respect to some typographic rules.
it's not to hard to implement (predefine) a few layout like that, if someone figures out the dimensions and rules ... Hans
On Sun, 4 Jan 2004, Hans Hagen wrote:
I'm just switching from LaTeX to ConTeXt. Is there already a module with similar functionalities as the typearea¹ package that comes with LaTeX?
¹ typearea comes with KOMA-Script and permits to automatically calculate the right margins with respect to some typographic rules.
it's not to hard to implement (predefine) a few layout like that, if someone figures out the dimensions and rules ...
Ok, I'm going to try it, perhaps it'll be my first ConTeXt module ;) Cheers, Peter -- http://pmrb.free.fr/contact/ ------------------------------------ Film Search site: http://f-s.sf.net/
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. Grüßlis vom Hraban! -- http://www.fiee.net/texnique/
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/
On Sun, 11 Jan 2004, Peter Münster wrote:
%%%%%% Here is the problem: dividing one length by another. %%%%%%
Hello, I've found a solution. Here is now the full environment: % 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)} \unprotect \begingroup \catcode`P=12 \catcode`T=12 \lowercase{\def\x@x{% \def\rem@pt##1.##2PT{##1.##2}% \def\rem@@pt##1.##2PT{##1}}} \expandafter\endgroup\x@x \def\strip@Pt{\expandafter\rem@pt\the} \def\strip@PT{\expandafter\rem@@pt\the} \edef\Ratio{\strip@Pt\dimexpr(10\paperheight/\strip@PT\dimexpr(10\PageWidth))} \protect \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 Cheers, Peter -- http://pmrb.free.fr/contact/ ------------------------------------ Film Search site: http://f-s.sf.net/
At 19:33 14/01/2004, you wrote:
On Sun, 11 Jan 2004, Peter Münster 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 size adventure. Since I opt for a more contexty solution i want to follow a stepwise approach in getting this done. As a start: (1) the ratio: this is the most efficient and (on average) accurate solution that also handles large paper sizes: %edef\layoutratio{\withoutpt{\the\dimexpr(8\paperheight/\dimexpr(\paperwidth/ 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 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 calculations [backspace=\dimexpr((\paperwidth-\layoutwidth)/2), width=middle, % less rounding errors than \layoutwidth, cutspace=\dimexpr((\paperwidth-\layoutwidth)/2), header=2\lineheight, headerdistance=\lineheight, height=middle, % less rounding errors than \layoutheight footerdistance=\lineheight, footer=2\lineheight, topspace=\dimexpr(1\dimexpr(\paperheight-(\layoutheight+\layouthfheight))/3), bottomspace=\dimexpr(2\dimexpr(\paperheight-(\layoutheight+\layouthfheight))/3)] \setuplayout [koma] (4) the 'number of chars per line' .. i'll come back to that Hans
On Thu, 15 Jan 2004, Hans Hagen wrote:
Since I opt for a more contexty solution i want to follow a stepwise approach in getting this done. As a start:
Thank you, Hans, for your efforts!
\edef\layoutratio{\withoutpt{\the\dimexpr(2\paperheight/(\paperwidth/32768))}}
Very strange, it works, but I don't understand how 2 * a / (b / 32768) == a/b
\unprotected \def\layouthfheight {\dimexpr(\layoutparameter\c!hoofd+\layoutparameter\c!hoofdafstand+ \layoutparameter\c!voet +\layoutparameter\c!voetafstand )}
Ok ok, I'm going to learn Dutch... ;-)
[backspace=\dimexpr((\paperwidth-\layoutwidth)/2), cutspace=\dimexpr((\paperwidth-\layoutwidth)/2),
Do I understand it right, backspace is the inner margin, and cutspace the outer one? Are both needed? Greetings, Peter -- http://pmrb.free.fr/contact/ ------------------------------------ Film Search site: http://f-s.sf.net/
At 20:06 19/01/2004, you wrote:
\edef\layoutratio{\withoutpt{\the\dimexpr(2\paperheight/(\paperwidth/32768))}}
Very strange, it works, but I don't understand how 2 * a / (b / 32768) == a/b
one can divide a dimen by a dimen in which case the dimen is cast on a counter (internally a dimen is just a number, with a sp unit); we need to compensate by 64K then; i multiply by two first to get rid of inaccuracy etc etc
Do I understand it right, backspace is the inner margin, and cutspace the outer one? Are both needed?
no, but it permits width=middle Hans
participants (3)
-
Hans Hagen
-
Henning Hraban Ramm
-
Peter Münster