Nicholas Clark | 20 Feb 2012 19:02
Picon

Trouble with paragraph duplication

Hi all,

I'm having  a little bit of trouble understanding some Lout behavior.
I'd like to be able to replicate a paragraph programmatically, so that
it can be placed in a document several times. I've noticed that Lout
deletes everything if I put any paragraph control characters in my
paragraph text. Why is this?

As an example, this works:

     <at> SysInclude{ doc }

    def  <at> Lorem{
    Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do
eiusmod tempor
    incididunt ut labore et dolore magna  aliqua. Ut enim ad minim veniam, quis
    nostrud exercitation  ullamco laboris nisi ut aliquip ex ea
commodo consequat.
    Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore
    eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non
proident, sunt in
    culpa qui officia deserunt mollit anim id est laborum.
    }

     <at> Document

     <at> Text  <at> Begin
     <at> PP
     <at> PP
     <at> Lorem
(Continue reading)

Martin Senft | 20 Feb 2012 20:14
Picon
Favicon

Re: Trouble with paragraph duplication

Hi Nicholas,

when I try your second example, I get the following error message from Lout:

"152.522c object deleted (too wide for 15.989c paragraph)"

Are you getting a similar error? If it is so, then it looks like your
second definition version is disabling paragraph breaking, but I am
not sure why. However, if I change your definition to a macro, it
works as it should.

Martin

Nicholas Clark | 20 Feb 2012 21:38
Picon

Re: Trouble with paragraph duplication

Yes, that's the error in question. Is this a Lout bug or an 'I'm
thinking about it wrong' bug? Declaring it as a macro fixes the
problem, but not my understanding of it!

On Mon, Feb 20, 2012 at 11:14 AM, Martin Senft <martinsenft <at> tiscali.cz> wrote:
> Hi Nicholas,
>
> when I try your second example, I get the following error message from Lout:
>
> "152.522c object deleted (too wide for 15.989c paragraph)"
>
> Are you getting a similar error? If it is so, then it looks like your
> second definition version is disabling paragraph breaking, but I am
> not sure why. However, if I change your definition to a macro, it
> works as it should.
>
> Martin
>

--

-- 
Nicholas Clark
L-3 Electrical Engineering
Email: nicholas.clark <at> gmail.com

Jeff Kingston | 20 Feb 2012 21:21
Picon
Picon

Re: Trouble with paragraph duplication

On Mon, Feb 20, 2012 at 10:02:49AM -0800, Nicholas Clark wrote:
> Hi all,
> 
> ...

You need to use either

     <at> Doc

or else

     <at> Document
    //

Forgetting the // is a well-known Lout gotcha.

Jeff

Martin Senft | 21 Feb 2012 20:31
Picon
Favicon

Re: Trouble with paragraph duplication

2012/2/20 Jeff Kingston <jeff <at> it.usyd.edu.au>:
> Forgetting the // is a well-known Lout gotcha.
>

Good point, I haven't noticed that. However, fixing this does not
remove the paragraph breaking issue in "def  <at> Lorem {  <at> PP ... }" for
me.

Martin

Jeff Kingston | 21 Feb 2012 21:34
Picon
Picon

Re: Trouble with paragraph duplication

OK, there is also a problem further down:

   <at> Text  <at> Begin
   <at> Lorem
   <at> Lorem
   <at> End  <at> Text

The writer of this has treated  <at> Lorem as though it is a macro
which returns a sequence of tokens rather than a definition
which returns an object.  This will produce two copies of
 <at> Lorem side by side within a paragraph, in the same way that

   <at> Text  <at> Begin
  lorikeet
  lorikeet
   <at> End  <at> Text

would produce two copies of lorikeet side by side within
a paragraph.  See the User's Guide, Section 1.3.

Jeff

On Tue, Feb 21, 2012 at 08:31:10PM +0100, Martin Senft wrote:
> 2012/2/20 Jeff Kingston <jeff <at> it.usyd.edu.au>:
> > Forgetting the // is a well-known Lout gotcha.
> >
> 
> Good point, I haven't noticed that. However, fixing this does not
> remove the paragraph breaking issue in "def  <at> Lorem {  <at> PP ... }" for
> me.
(Continue reading)

Martin Senft | 22 Feb 2012 20:50
Picon
Favicon

Re: Trouble with paragraph duplication

That is true, but I am still confused that no paragraph breaking takes
place in this case. Also, when I use the  <at> Wide command inside the
 <at> Lorem definition or around its invocation, It breaks as expected.
However, when I use  <at> Wide around  <at> Lorem  <at> Lorem, I get the same error
as without using  <at> Wide. What is the rule here that decides when to
break lines in the contents of the  <at> Lorem definition?

Martin

2012/2/21 Jeff Kingston <jeff <at> it.usyd.edu.au>:
> OK, there is also a problem further down:
>
>   <at> Text  <at> Begin
>   <at> Lorem
>   <at> Lorem
>   <at> End  <at> Text
>
> The writer of this has treated  <at> Lorem as though it is a macro
> which returns a sequence of tokens rather than a definition
> which returns an object.  This will produce two copies of
>  <at> Lorem side by side within a paragraph, in the same way that
>
>   <at> Text  <at> Begin
>  lorikeet
>  lorikeet
>   <at> End  <at> Text
>
> would produce two copies of lorikeet side by side within
> a paragraph.  See the User's Guide, Section 1.3.
>
(Continue reading)

Pierre | 22 Feb 2012 21:08
Picon

Re: Trouble with paragraph duplication


Martin Senft :
> That is true, but I am still confused that no paragraph breaking takes
> place in this case. Also, when I use the  <at> Wide command inside the
>  <at> Lorem definition or around its invocation, It breaks as expected.
> However, when I use  <at> Wide around  <at> Lorem  <at> Lorem, I get the same error
> as without using  <at> Wide. What is the rule here that decides when to
> break lines in the contents of the  <at> Lorem definition?
> 

The way I understand it, you are trying to put 2 objects side by side.
They are too large for that, causing the error. If now you resize them,
individually, using  <at> Wide, they might fit (depending on the width you
specify).
Putting  <at> Wide _around_ the dual invocation of  <at> Lorem is reducing the
width available to the already too large juxtaposition. Why should it
get rid of the error? If anything it would create a problem if there
wasn't already one.

> Martin
> 
> 2012/2/21 Jeff Kingston <jeff <at> it.usyd.edu.au>:
> > OK, there is also a problem further down:
> >
> >   <at> Text  <at> Begin
> >   <at> Lorem
> >   <at> Lorem
> >   <at> End  <at> Text
> >
> > The writer of this has treated  <at> Lorem as though it is a macro
(Continue reading)

Jeff Kingston | 22 Feb 2012 23:39
Picon
Picon

Re: Trouble with paragraph duplication

Martin,

Paragraph breaking is done top-down, and it is done when there
is not enough horizontal space for an object as it stands.  So
when breaking your document Lout first looks at the paragraph

     <at> Lorem  <at> Lorem

which is a paragraph of two very wide objects, and decides to
break it.  But as a consequence of deciding to break this
paragraph, Lout also decides not to break paragraphs within
the individual elements of this paragraph (unless they
contain  <at> Wide, which starts the whole thing off again).

Lout does not apply paragraph breaking to the individual
elements of a paragraph, because it considers that the
horizontal space available to them is effectively infinite,
which is not really true I admit, but that's what it does.
In practice no-one wants broken paragraphs inside paragraphs.

Alternatively, if you remove the paragraph symbols from
within the definition of  <at> Lorem, making it return just
a sequence of adjacent objects, Lout will merge the paragraph
inside each  <at> Lorem with the two-object paragraph above and
you will get two copies of the content of  <at> Lorem run together
into a single paragraph.

Alternatively, if you write

    <at> Lorem |1c  <at> Lorem
(Continue reading)


Gmane