ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
From: Hans Hagen <pragma@wxs.nl>
Subject: Re: Gridsetting
Date: Sun, 15 Jun 2003 22:40:13 +0200	[thread overview]
Message-ID: <5.2.0.9.1.20030615200550.02710188@localhost> (raw)
In-Reply-To: <5.1.0.14.2.20030614133416.00c73a00@pop.onlinehome.de>

At 14:55 14/06/2003 +0200, Matthias Vogel wrote:

>normaltext text text text text text text text text texttext text
>text texttext texttext texttext texttext texttext text
>---in 9dd, line: 10dd
>text text text texttext texttext texttext texttext text
>text texttext texttext texttext texttext texttext text
>
>\startcitation
>
>smalltext text text texttext texttext texttext texttext text
>text text text texttext texttext texttext texttext text
>---text in 8dd, line: 9dd
>text texttext texttext texttext texttext texttext text
>
>\stopcitation
>
>normaltext text text texttext texttext texttext texttext text
>text texttext texttext texttext texttext texttext text
>---in 9dd line 10dd
>text texttext texttext texttext texttext texttext text...
>
>we are loosing the grid because of the smaller lineskip
>in citation. I would like to modify the definition of
>citation (and other stuff, that causes deviations from the
>grid (headings)) in a way that the following text will
>adjust to the grit again. Is that possible?  As far
>as I can see "\moveongrid" does not work in cases like
>the given example.

ah ... grid and automated typesetting ... only to be used by those who are 
aware of the problems -)

one wat of dealing with this is:

\snaptogrid\vbox\bgroup

your smaller text

\egroup

but this does not break across pages. One way out is the following (put the 
macro defs in your local cont-new.tex)

\unprotect

\newcounter\currentgridsync

\def\gridsynctag{grs:\currentgridsync}

\def\synchronizegrid
   {\doglobal\increment\currentgridsync
    \par\prevdepth\zeropoint
    \nointerlineskip
    \hpos\gridsynctag{\strut}\par
    \vskip-\lineheight
    \nointerlineskip
    % top of text
    \scratchdimen\MPy{\v!tekst:\MPp\gridsynctag}%
    \advance\scratchdimen\MPh{\v!tekst:\MPp\gridsynctag}%
    % move to first baseline
    \advance\scratchdimen-\topskip
    % subtract wrong baseline
    \advance\scratchdimen-\MPy\gridsynctag
    % get minimal number of lines
    \advance\scratchdimen\lineheight
    \getnoflines\scratchdimen
    % calculate difference
    \advance\scratchdimen-\noflines\lineheight\relax
    \scratchdimen-\scratchdimen
    \ifdim\scratchdimen>\zeropoint
      \nointerlineskip
      \advance\scratchdimen-\lineheight
      \vskip\scratchdimen \strut
      \par
    \fi}

\protect

% test

\setuplayout[grid=yes,lines=42] \showgrid \showstruts

\starttext

\input tufte

\snaptogrid\vbox{\switchtobodyfont[small] \input tufte \par}

\input tufte

{\switchtobodyfont[small] \input tufte \par}

\synchronizegrid \input tufte

\stoptext

beware: this is tricky and if it starts oscillating, try to force page 
breaks here and there

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

  reply	other threads:[~2003-06-15 20:40 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20030614094151.27963.47244.Mailman@ref.ntg.nl>
2003-06-14 12:55 ` Gridsetting Matthias Vogel
2003-06-15 20:40   ` Hans Hagen [this message]
2003-06-16 18:01     ` Gridsetting Maarten Sneep
2003-06-14 12:59 ` Improving the Documentation of Context Matthias Vogel
2003-06-15  4:20   ` Matthew Huggett
2003-06-15 17:59     ` Hans Hagen
2003-06-14 13:21 ` centered Chapter-Headings Matthias Vogel

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=5.2.0.9.1.20030615200550.02710188@localhost \
    --to=pragma@wxs.nl \
    --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).