lout-users
[Top][All Lists]
Advanced

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

@PageSplit symbol


From: Jeff Kingston
Subject: @PageSplit symbol
Date: Wed, 19 Jun 2013 18:39:29 +1000
User-agent: Mutt/1.4i

Dear Lout list,

A while ago (actually it was a year ago, but I'm too ashamed to
admit it) there were a few postings on the list about how to print
an object in one form if it was all able to fit on the current page,
but in a different form if it was partly on one page and partly on
the next.  I promised to write something.  Here it is.  I have no
plans to put the implementation in the next release, but you can
find it at the end of this email.

I've called the function @PageSplit and you can call it like this:

    @PageSplit { anything you like here }

If the object immediately after the @PageSplit symbol fits on one
page, it appears as is.  Otherwise you get "See next page" on the
first page and the object on the second.

More generally, if the object splits you can make the two pieces
be whatever you want, like this:

    @PageSplit
       splita { anything here 1 }
       splitb { anything here 2 }
    { anything you like here }

If it splits you'll get "anything here 1" on the first page and
"anything here 2" on the second page.  The default value of the
splita option is "See next page", and the default value of the
splitb option is the following object.

All these objects will be enclosed in @OneRow so you need to
make sure that they are not too big for one page.

Cross-referencing is used, i.e. it takes more than one run to
converge, and will not work with lout -s.

You need to precede and follow @PageSplit with @DP or similar,
it is not integrated in any way with displays or lists.

Jeff


Here is a test file, assuming @PageSplit is defined in file mydefs:
------------------------------------------------------------------
@SysInclude { doc }

def @PageSplitTest
{
  @PageSplit
    splita { @Box 1.5i @High 3i @Wide { Split me (first bit)! } }
    splitb { @Box 1.5i @High 3i @Wide { Split me (second bit)! } }
  { @Box 3i @High 3i @Wide { Split me! } }
}

@Doc @Text @Begin
@CD { Test of page split symbol }
Blah blah blah
@DP @PageSplitTest
@DP @PageSplitTest
@DP @PageSplitTest
@DP @PageSplitTest
@DP @PageSplitTest
@DP @PageSplitTest
@End @Text
------------------------------------------------------------------

And here is the definition of @PageSplit:
------------------------------------------------------------------
import @BasicSetup
def @PageSplit
    named @Tag {}
    named splita { See next page }
    named splitb { dft }
    right x
{
  def @Unsplit
  {
    @PageMark @Tag".prev"
    // @OneRow x //
    @PageMark @Tag".next"
  }

  def @SplitA
  {
    @OneRow {
      @PageMark @Tag".prev"
      //
      splita
    }
  }

  def @SplitB
  {
    @OneRow
    {
      splitb @Case {
        dft @Yield x
        else @Yield splitb
      }
      //
      @PageMark @Tag".next"
    }
  }

  address@hidden @Tag".prev"} @Case
  {
    address@hidden @Tag".next"} @Yield @Unsplit
    else                  @Yield { @SplitA @DP @SplitB }
  }
}
------------------------------------------------------------------



reply via email to

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