lout-users
[Top][All Lists]
Advanced

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

Re: @Diag question


From: Joerg van den Hoff
Subject: Re: @Diag question
Date: Wed, 3 Sep 2008 00:29:28 +0200
User-agent: Mutt/1.5.7i

On Sep 02 2008 (Tue, 13:23), Mark Summerfield wrote:
> On 2008-09-02, j. van den hoff wrote:
> > Jeff Kingston <jeff <at> it.usyd.edu.au> writes:
> > > > I was not able to find out how to freely position start and
> > > > end point of links on the object boundary in @Diag.
> > >
> > > Sounds like you need a bit of algebra, as in Section 9.11 of
> > > the User's Guide.
> > >
> > > > I tried verbatim the example on page 209 of the manual, ...
> > > > this does _not_ produce the diagram as in the manual.
> > >
> > > It's all a question of how much space is made available to
> > > the diagram by its context.  If you had used @CD @Diag ...
> > > instead of @Diag ... for example, you would have got what
> > > you see in the manual, because only the minimum amount of
> > > horizontal space is made available to a centred display.
> > > Lout is basically keen to give as much space as possible
> > > to everything, on the principle that it is easy to elec
> > > not to use it if you don't want it.
> > >
> > > Jeff
> >
> > thanks for this explanation. this (the necessity for @CD) was not obvious
> > to a beginner (me, anyway)
> > from the context of the example. maybe a remark could be added to the
> > manual (which is overall very good, by the way!)? --
> >
> > concerning my initial aim of drawing two (three, four, ...) boxes aligned
> > on a "grid" and connected by 'off-center' arrows like this:
> >
> >      ______   k1 ______
> >
> >      |    | ---->|    |
> >      |
> >      | c1 |      | c2 |   ,
> >      |
> >      |    | <----|    |
> >
> >      ------   k2 ------
> >
> > I'm still not happy. using low level alignment with white space like this:
> >
> > @CD
> > @Diag vsize {5f} hsize {5f} arrowwidth {.5f}
> > margin {0f}
> > {
> > A::@Box
> > address@hidden {c sub 1}}
> > &5f
> > B::@Box address@hidden {c sub 2}}
> >
> > C::@Box address@hidden {c sub 3 = k sub 3 cdot int from 0 to t c sub 2 }}
> >
> > @Line from address@hidden 1.25f}} to address@hidden 1.25f}}
> >    ylabel address@hidden  {K sub 1}}
> > @Arrow from address@hidden 1.25f}} to address@hidden 1.25f}}
> >
> > @Line from address@hidden 1.25f}} to address@hidden 1.25f}}
> >    ylabelprox {below}
> >    ylabel address@hidden  {k sub 2}}
> > @Arrow from address@hidden 1.25f}} to address@hidden 1.25f}}
> >
> > }
> >
> > worked OK. I only noted that th `ylabel' on an arrow is not centered on the
> > arrow as a whole but rather on the line excluding the arrowhead. this
> > necessitates the awkward double drawing of lines (with labels) and arrows
> > to get the vertical alignment of k1 and k2 right. question: is this as it
> > should be or am I missing something?
> >
> > but trying to actually use the positioning scheme proposed in the manual I
> > ended up with (positions of arrows are not the same as above
> > intentionally):
> >
> > @CD @Diag
> > margin {0c} arrowwidth {.5f}
> >
> > {
> >
> > 6c @Wide 2c @High
> > //
> > A:: @Box
> >    translate { W to 0, 0.5 }
> >    2c @Wide 2c @High
> >    { @CD @Eq { c sub 1 } }
> >
> > B:: @Box
> >    translate { E to 1, 0.5 }
> >    2c @Wide 2c @High
> >    { @CD @Eq { c sub 2 } }
> >
> > @Arrow from address@hidden 0.333c}} to address@hidden 0.333c}}
> > ylabel address@hidden  {K sub 1}}
> > @Arrow from address@hidden 0.333c}} to address@hidden 0.333c}}
> > ylabel address@hidden  {k sub 2}}
> >
> > (note that here the arrow labels are actually not aligned as already noted
> > above). what's more of a problem to me is that now the boxed text is no
> > longer centered in the boxes. question: how do I do this right?
> >
> > joerg
> > }
> 
> I think you need to mix @Tbl with @Diag; also you can add ylabels to
> arrows, no need for extra lines. The lout below keeps the boxes
> vertically centred and keeps everything lined up nicely.
> 
> @SysInclude{tbl}
> @SysInclude{diag}
> @SysInclude{eq}
> @SysInclude{doc}
> @Doc
> @Text @Begin
> 
> @CD
> @Diag
> {
>     @Tbl
>         marginhorizontal{1.5f}
>         address@hidden A| @Cell B| @Cell C|}
>     {
>         @Rowa
>         A{A:: @Box address@hidden sub 1}}}
>         B{B:: @Box address@hidden sub 2}}}
>         C{C:: @Box vsize{2.5f}
>             address@hidden sub 3 = k sub 3 cdot int from 0 to t c sub 2}}}
>     }
> //
> @Arrow address@hidden 1.25f}} address@hidden 1.25f}} address@hidden sub 1}}
> @Arrow address@hidden 1.25f}} address@hidden 1.25f}}
>     ylabelprox{below} address@hidden sub 2}}
> @Arrow address@hidden 1.25f}} address@hidden 1.25f}}
> @Arrow address@hidden 1.25f}} address@hidden 1.25f}}
> }
> 
> @End @Text
> 
> 
> 
> -- 
> Mark Summerfield, Qtrac Ltd, www.qtrac.eu
>     C++, Python, Qt, PyQt - training and consultancy
>         "Rapid GUI Programming with Python and Qt" - ISBN 0132354187
> 

mark,

this looks better, thanks for this. maybe the use of @Tbl is the way to go.

but with regards to the ylabel's I think you are wrong: in your
solution, too, the labels k1 and k2 are not aligned vertically: k1 is
shifted slightly to the left, k2 to the right (depending on the arrow
direction): the labels are centered on the line segments excluding the
arrowheads. this becomes clearly visible if one increases the
`arrowlength' sufficiently. `groff's `pic', e.g., handles this differently, but
on second thought `lout's approach might be better since the labels will
never overlap with the arrowheads (which can otherwise happen if the
heads are too long _and_ wide). but it sure comes in the way in the
present example. 

so, it would be nice, if one could
control whether the label is centered on the arrow as a whole or on
the line segment only. at least in my case I want the labels on both
arrows to perfectly align vertically.


best regards,

joerg


reply via email to

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