ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
* typearea
@ 2004-01-04 18:24 Peter Münster
  2004-01-04 21:03 ` typearea Hans Hagen
  0 siblings, 1 reply; 11+ messages in thread
From: Peter Münster @ 2004-01-04 18:24 UTC (permalink / raw)


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/

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: typearea
  2004-01-04 18:24 typearea Peter Münster
@ 2004-01-04 21:03 ` Hans Hagen
  2004-01-06  7:21   ` typearea Peter Münster
  0 siblings, 1 reply; 11+ messages in thread
From: Hans Hagen @ 2004-01-04 21:03 UTC (permalink / raw)


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  

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: typearea
  2004-01-04 21:03 ` typearea Hans Hagen
@ 2004-01-06  7:21   ` Peter Münster
  2004-01-06 14:13     ` typearea Henning Hraban Ramm
  0 siblings, 1 reply; 11+ messages in thread
From: Peter Münster @ 2004-01-06  7:21 UTC (permalink / raw)


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/

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: typearea
  2004-01-06  7:21   ` typearea Peter Münster
@ 2004-01-06 14:13     ` Henning Hraban Ramm
  2004-01-11 21:02       ` typearea Peter Münster
  0 siblings, 1 reply; 11+ messages in thread
From: Henning Hraban Ramm @ 2004-01-06 14:13 UTC (permalink / raw)



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/

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: typearea
  2004-01-06 14:13     ` typearea Henning Hraban Ramm
@ 2004-01-11 21:02       ` Peter Münster
  2004-01-14 18:33         ` typearea Peter Münster
  0 siblings, 1 reply; 11+ messages in thread
From: Peter Münster @ 2004-01-11 21:02 UTC (permalink / raw)


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/

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: typearea
  2004-01-11 21:02       ` typearea Peter Münster
@ 2004-01-14 18:33         ` Peter Münster
  2004-01-15 10:23           ` typearea Hans Hagen
  0 siblings, 1 reply; 11+ messages in thread
From: Peter Münster @ 2004-01-14 18:33 UTC (permalink / raw)


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/

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: typearea
  2004-01-14 18:33         ` typearea Peter Münster
@ 2004-01-15 10:23           ` Hans Hagen
  2004-01-19 19:06             ` typearea Peter Münster
  0 siblings, 1 reply; 11+ messages in thread
From: Hans Hagen @ 2004-01-15 10:23 UTC (permalink / raw)


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

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: typearea
  2004-01-15 10:23           ` typearea Hans Hagen
@ 2004-01-19 19:06             ` Peter Münster
  2004-01-20  9:12               ` typearea Hans Hagen
  0 siblings, 1 reply; 11+ messages in thread
From: Peter Münster @ 2004-01-19 19:06 UTC (permalink / raw)


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/

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: typearea
  2004-01-19 19:06             ` typearea Peter Münster
@ 2004-01-20  9:12               ` Hans Hagen
  0 siblings, 0 replies; 11+ messages in thread
From: Hans Hagen @ 2004-01-20  9:12 UTC (permalink / raw)


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  

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: typearea
  2004-01-15 12:23 typearea Hans Hagen
@ 2004-01-15 13:45 ` Willi Egger
  0 siblings, 0 replies; 11+ messages in thread
From: Willi Egger @ 2004-01-15 13:45 UTC (permalink / raw)


[-- Attachment #1: Type: text/plain, Size: 1416 bytes --]

Hi Hans,

I was surfing the internet looking for "Häufigkeitstabelle"  frequncy 
and alike for letters. Please have a look at the attached file with some 
links.
Apparently nobody does care about capitals - which is rather strange 
when considering our purposes. On the other hand it is quite 
understandable realizing that such info is used in cryptography...

Kind regards
Willi

Hans Hagen wrote:

> Hi,
>
> I need the more or less official character frequency tables of 
> languages other than dutch (for german probably including capitals)
>
>   http://www.pragma-pod.com/downloads/koma/komacalc.pdf
>
> (we may find a few more methods)
>
> Hans
>
>
>
> -------------------------------------------------------------------------
>                                   Hans Hagen | PRAGMA ADE | pragma@wxs.nl
>                       Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
>  tel: +31 (0)38 477 53 69 | fax: +31 (0)38 477 53 74 | www.pragma-ade.com
> -------------------------------------------------------------------------
>                        information: http://www.pragma-ade.com/roadmap.pdf
>                     documentation: http://www.pragma-ade.com/showcase.pdf
> -------------------------------------------------------------------------
>
> _______________________________________________
> ntg-context mailing list
> ntg-context@ntg.nl
> http://www.ntg.nl/mailman/listinfo/ntg-context



[-- Attachment #2: Letterverdeling --]
[-- Type: text/plain, Size: 494 bytes --]


http://520046051430-0001.bei.t-online.de/krypt.htm

Analyse van tekst over verdeling letter frequentie
http://www.informatik.fh-muenchen.de/~schieder/programmieren-1-ws96-97/uebung-lettercount.html

Tellen frequentie met perl
http://www.ims.uni-stuttgart.de/~zinsmeis/Perl/material/Musterloesung6.pdf

Artikel over toetsenborden, bevat tabel met 4 talen
http://goebel-consult.de/de-ergo/rohmert/Rohmert.html

Duits - Engels vergeleken
http://www.blankenburg.de/gat/pages/fach/info/analyse2.htm

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: typearea
@ 2004-01-15 12:23 Hans Hagen
  2004-01-15 13:45 ` typearea Willi Egger
  0 siblings, 1 reply; 11+ messages in thread
From: Hans Hagen @ 2004-01-15 12:23 UTC (permalink / raw)


Hi,

I need the more or less official character frequency tables of languages 
other than dutch (for german probably including capitals)

   http://www.pragma-pod.com/downloads/koma/komacalc.pdf

(we may find a few more methods)

Hans



-------------------------------------------------------------------------
                                   Hans Hagen | PRAGMA ADE | pragma@wxs.nl
                       Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
  tel: +31 (0)38 477 53 69 | fax: +31 (0)38 477 53 74 | www.pragma-ade.com
-------------------------------------------------------------------------
                        information: http://www.pragma-ade.com/roadmap.pdf
                     documentation: http://www.pragma-ade.com/showcase.pdf
-------------------------------------------------------------------------

^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2004-01-20  9:12 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
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         ` 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

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).