lout-users
[Top][All Lists]
Advanced

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

Re: LOUT - how to do variable length arrows with labels?


From: Valeriy E. Ushakov
Subject: Re: LOUT - how to do variable length arrows with labels?
Date: Mon, 7 Sep 1998 17:03:40 +0400

On Mon, Sep 07, 1998 at 11:31:22AM +0100, Paul A Blampied wrote:

> Without having to use the diagram package, I want to produce diagrams
> involving horizontally composed arrows, possibly with labels above them,

But why not use @Diag?  Am I right that you need an ASCII art arrows
as I can guess from your definition below?


> My problem is how to make the arrows the correct length.  This is how far
> I have got with the definition:
> 
> extend        @Eq
> def   @Arrow
>   named       label   {}      # Label to go along top of arrow
> {
>   @OneRow {
>     @OneCol { ||0.5f label ||0.5f }   # Put some space either side of label
>   ^/
>     @OneCol {-->}
>   }
> }
> 
> Is it possible to extend the arrow to cover the full width of the label?
> I have tried various combinations of @Wide and @Scale, but I can't seem
> to get the right effect!

If you indeed need an ASCII art arrow, tough luck.  In a postscript
backend you would use @Graphic and draw from (0, 0) to (xsize, 0) -
see @HLine for details.  However for an ASCII art you need to use
recursion, but recursion will consume all available width.  So you can
use the following definition

    def @HArrow
      right label
    {
        def @arrow {
            def @line { "-"@line }
            @line">"
        }
    
        @HContract @VContract {
            |.5rt @OneCol label
            ^// @arrow
        }
    }
    
But you'll need to constraint the width of your diagrams with @Wide,
unless you need a full width diagram (e.g. in a display) where
recursion will apportion available width between all arrows.


Hope that helps.

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]