ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
From: "Peter Münster" <pmlists@free.fr>
Subject: Re: typearea
Date: Wed, 14 Jan 2004 19:33:51 +0100 (CET)	[thread overview]
Message-ID: <Pine.LNX.4.44.0401141928230.25316-100000@gaston.free.fr> (raw)
In-Reply-To: <Pine.LNX.4.44.0401112130080.3583-100000@gaston.free.fr>

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/

  reply	other threads:[~2004-01-14 18:33 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       ` typearea Peter Münster
2004-01-14 18:33         ` Peter Münster [this message]
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.0401141928230.25316-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).