[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Lout for dictionaries

From: Valeriy E. Ushakov
Subject: Re: Lout for dictionaries
Date: Thu, 25 Nov 1999 22:54:20 +0300

On Tue, Nov 23, 1999 at 03:10:07PM +0300, Valeriy E. Ushakov wrote:

> PS: Hmm, I believe I still has an old code of mine for doing running
>     headers for dictionaries (frist/last words on page) around.  Will
>     dig through my archives.

Here's the simplest one (resolved in two runs):

  # Marker for your entries
  export @Mark
  def @EntryMark
    named @Tag {}
    right @Mark
  { @Null }

  # Tag the first (last) entry on page
  export @Tag
  def @MarkFirstEntry
    named @Tag {}
  { @EntryMark&&following @Tagged @Tag }
  export @Tag
  def @MarkLastEntry
    named @Tag {}
  { @EntryMark&&preceding @Tagged @Tag }

  # Retrive the mark of the first (last) entry on this page
  def @FirstEntry
  { @EntryMark&&address@hidden&&preceding @Open { @Tag }} @Open { @Mark } }
  def @LastEntry
  { @EntryMark&&address@hidden&&following @Open { @Tag }} @Open { @Mark } }

Then you have to arrange for @MarkFirstEntry (Last) to appear at the
very beginning (end) of each page (for testing purposes you can abuse
headers/footers for this) and for @EntryMark to appear at the
beginning and at the end of your entries.  Note that having a mark at
the end of entry means that the entry that is finished on the page
(but starts on some previous page) will be listed as the first entry
of this page.

Use @FirstEntry/@LastEntry to obtain the marks.  If you use them in
the running header make sure that the height of the header is
independent from the @FirstEntry/@LastEntry (e.g. use a strut),
otherwise the changed height of header may push last entry on to the
next page, thus invalidating the xrefs from the previous run.

There are some interesting ramifications in the case when you need to
handle multiple-page entries and do NOT want to count tail of an entry
as the first entry on the page.  In this case things will be more

How it works:

. @MarkFirstEntry at the beginning of the page is automatically
  asssigned unique @Tag by Lout. 

. @MarkFirstEntry attaches its @Tag to the first "following" @EntryMark.

. To look up the first entry on the page you invoke @FirstEntry.

. @FirstEntry first looks for the @MarkFirstEntry at the beginning of
  the page the @FirstEntry is invoked for and retrives its tag.

. Then @FirstEntry simply looks, which @EntryMark is marked with that
  tag and retrives the @Mark from that @EntryMark

SY, Uwe
address@hidden                         |       Zu Grunde kommen
http://www.ptc.spbu.ru/~uwe/            |       Ist zu Grunde gehen

reply via email to

[Prev in Thread] Current Thread [Next in Thread]