ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
From: "Peter Münster" <pmlists@free.fr>
Subject: Re: typearea
Date: Sun, 11 Jan 2004 22:02:47 +0100 (CET)	[thread overview]
Message-ID: <Pine.LNX.4.44.0401112130080.3583-100000@gaston.free.fr> (raw)
In-Reply-To: <8CC16623-4052-11D8-987C-0030659899AA@fiee.net>

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/

  reply	other threads:[~2004-01-11 21:02 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-01-04 18:24 typearea Peter Münster
2004-01-04 21:03 ` typearea Hans Hagen
2004-01-06  7:21   ` typearea Peter Münster
2004-01-06 14:13     ` typearea Henning Hraban Ramm
2004-01-11 21:02       ` Peter Münster [this message]
2004-01-14 18:33         ` typearea Peter Münster
2004-01-15 10:23           ` typearea Hans Hagen
2004-01-19 19:06             ` typearea Peter Münster
2004-01-20  9:12               ` typearea Hans Hagen
2004-01-15 12:23 typearea Hans Hagen
2004-01-15 13:45 ` typearea Willi Egger

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=Pine.LNX.4.44.0401112130080.3583-100000@gaston.free.fr \
    --to=pmlists@free.fr \
    --cc=ntg-context@ntg.nl \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).