lout-users
[Top][All Lists]
Advanced

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

Re: Problem with @NoCite


From: Valeriy E. Ushakov
Subject: Re: Problem with @NoCite
Date: Wed, 17 Jan 2001 12:30:19 +0300
User-agent: Mutt/1.3.3i

On Wed, Jan 17, 2001 at 13:53:45 +1000, David Duffy wrote:

> Is this fixed in 3.24?

No.  E.g. see p108 of User's Guide (on the Lout home page).

See also <http://www.egroups.com/messagesearch/lout?query=%40NoCite>
for previous discussion of the matter (hint, hint!).

Since eGroups archives start only in 1998, here's also a reference to
an older message relevant to this problem (mailing list seq. no 362):
<http://www.ptc.spbu.ru/mail-archives/lout/latest/msg00122.html>



> When multiple citations were included in @NoCite, this left the
> commas where the citations would have been.

This is caused by a very subtle bug in environment resolution.  In
case anyone is curious, I'm attaching my analysis of the problem.

The two possible workarounds are:

. Don't use comma in @NoCite.  There's really no point to use it,
  since you generate this stuff.  I guess originally the intention was
  to support the ease of switching between @Cite <-> @NoCite and it's
  not relevant in your situation.

. If you need to use comma (e.g. because of @Cite <-> @NoCite),
  Change @NoCite (in include/dsf) to have

    def "," precedence 90 left x { x }
    def ";" precedence 90 left x { x }

  but then quote your labels, i.e.

    @NoCite{$ label {1} "jensen1975pascal", $ label {2} "meyer1992eiffel"}

  the reason why quoting makes a difference is explained in the
  attached message.

Hope this helps.

SY, Uwe
-- 
address@hidden                         |       Zu Grunde kommen
http://www.ptc.spbu.ru/~uwe/            |       Ist zu Grunde gehen
--- Begin Message --- Subject: Re: @NoCite Problem Date: Wed, 9 Dec 1998 05:42:47 +0300
Hi, Dominikus.

On Tue, Dec 08, 1998 at 07:48:35AM +0100, Dominikus Herzberg wrote:

> I think there is a minor bug in the definition of @NoCite (Lout 3.12), see
> the problem described.

Subtle a bug indeed.


> But if I change @Cite to @NoCite in the example the result is an "unordered"
> list; it looks like this:
> 
>               Balzert (1996b)
>               Balzert (1998)
>               Balzert (1996a)
> 

>     @Tag { MOOSA }
>     @Annote { 1996a }

>     @Tag { SWT1 }
>     @Annote { 1996b }

>     @Tag { SWT2 }
>     @Annote { 1998 }

Check lout.li file and you'll see that keys for SWT1 and SWT2 dont'
have comma in author's name, while an entry for MOOSA has, so MOOSA
sorts last.  Also note that printed references for SWT* has no commas
where they have them in the database.

The tricky question is where that comma is?!  WLOG, let's consider the
problem with sort key.

Running lout with -ddcr -ddst -ddsu -ddce -ddom is instructive (though
prepare yourself for few megs of trace).

Note the following line (formatted to fit better)

ce: AttachEnv(
 
<@Author<@RefListSortKey<@SortKey<@Key<@SendRef<@NoRef<@NoCite<@Text<@OrdinaryLayout<@DocumentLayout<>>>>>>>>>>
 
<@SortKey<@Key<@SendRef<@NoRef<@NoCite<@Text<@OrdinaryLayout<@DocumentLayout<>>>>>>>>>>,
 @Reference 
   @Tag { "SWT""1" }
   @Label { "Balzert" }
   @Annote { "1" ++5++ "b" }
   @Type { "Book" }
   @Title { "Lehrbuch" ++4++ "Software" ++3++ "Entwicklung" }
   @Author { "Balzert" ,"Helmut" }
   @Publisher { "Spektrum" ++3++ "Verlag" }
   @Address { "Heidelberg" , ++3++ "Oxford" }
   @Year { "1" ++4++ "6" } )

Note that comma in @Author is NOT QUOTED - so its a symbol name, not a
literal word.  The chain of environments suggests that it comes from a
@NoCite, where it's defined like

    def "," precedence 90 left x { x }

Now compare this with the trace for this same document, but this time
the tag in the @NoCite quoted (i.e. @NoCite{$"SWT1"}):

The corresponding line from the trace will now look:

ce: AttachEnv(
 <@Author<@RefListSortKey<@SortKey<@DocumentLayout<>>>>
 <@SortKey<@DocumentLayout<>>>>,
 @Reference
   @Tag { "SWT""1" }
   @Label { "Balzert" }
   @Annote { "1" ++5++ "b" }
   @Type { "Book" }
   @Title { "Lehrbuch" ++4++ "Software" ++3++ "Entwicklung" }
   @Author { "Balzert" ++3++ "Helmut" }
   @Publisher { "Spektrum" ++3++ "Verlag" }
   @Address { "Heidelberg" ++4++ "Oxford" }
   @Year { "1" ++4++ "6" } )

Note how the chain of envs is much shorter and it doesn't contain the
@NoCite with it's internal definition for comma.

Let's check where the two cases (juxtaposed and quoted) depart.


Quoted case has (abridged):

om: [Manifest(closure @NoCite { @NoRef "SWT1" } )
om:   environment: <@Text<@OrdinaryLayout<@DocumentLayout<>>>>
om: [Manifest(closure cite )
om:   environment: <@NoCite<@Text<@OrdinaryLayout<@DocumentLayout<>>>>>
om: [Manifest(closure @NoRef "SWT1" )
om:   environment: <@NoCite<@Text<@OrdinaryLayout<@DocumentLayout<>>>>>


om:   [ manifesting closure @NoRef
ce: SearchEnv(<@NoCite<@Text<@OrdinaryLayout<@DocumentLayout<>>>>>, 
@DocumentLayout)
ce: SearchEnv returning @DocumentLayout   @InitialBreak { "ragged" ++3++ 
"nohyphen" }   @PageType { "Other" }   @PageWidth { "8" ++3++ "s" }   
@PageHeight { "6" ++3++ "f" }   @TopMargin { "1""f" }   @FootMargin { "1""f" }  
 @MakeReferences { "Yes" }   @RefCiteLabels { @Label"("@Annote }   
@RefCiteStyle { cite")" }   @RefListFormat { "DropLabels" }   @RefListLabels { 
@Label"(" ++3++ ")" }   @RefListSortKey { @Author ++3++ @Annote }
ce:   calling ClosureExpand from Manifest/CLOSURE
ce: ClosureExpand( @NoRef "SWT1", <@DocumentLayout<>>, TRUE, crs, res_env )
ce: AttachEnv( <@DocumentLayout<>>, @NoRef "SWT1" )
ce: AttachEnv returning.
ce: SetEnv( x, <nilobj> ), x =
@NoRef "SWT1"
ce: SetEnv returning <@NoRef<@DocumentLayout<>>>


Juxtaposed case has:

om: [Manifest(closure @NoCite { @NoRef "SWT""1" } )
om:   environment: <@Text<@OrdinaryLayout<@DocumentLayout<>>>>
om: [Manifest(closure cite )
om:   environment: <@NoCite<@Text<@OrdinaryLayout<@DocumentLayout<>>>>>
om: [Manifest(closure @NoRef "SWT""1" )
om:   environment: <@NoCite<@Text<@OrdinaryLayout<@DocumentLayout<>>>>>


om:   [ manifesting closure @NoRef
ce:   calling ClosureExpand from Manifest/CLOSURE
ce: ClosureExpand( @NoRef "SWT""1", 
<@NoCite<@Text<@OrdinaryLayout<@DocumentLayout<>>>>>, TRUE, crs, res_env )
ce: AttachEnv( <@NoCite<@Text<@OrdinaryLayout<@DocumentLayout<>>>>>, @NoRef 
"SWT""1" )
ce: AttachEnv returning.
ce: SetEnv( x, <nilobj> ), x =
@NoRef "SWT""1"
ce: SetEnv returning 
<@NoRef<@NoCite<@Text<@OrdinaryLayout<@DocumentLayout<>>>>>>


Which correspond to the following code in ManifestCl (z08.c):

    /*  now check z to see whether it is either a word or and ACAT of words */
    if( !is_word(type(z)) )
    { symbol_free = FALSE;
    }
  }

  /* if all parameters are free of symbols, optimize environment */
  if( symbol_free && imports(sym) == nilobj && enclosing(sym) != StartSym )


For the juxtaposed case (not is_word) this optimization fails.

Ordinary refs work since comma is defined as left x { x"," } in @Cite,
so this compensates for the wrong environment.

But in @NoCite comma defined to be left x { x }, so that user coould
write @NoCite{$ref1,$ref2,$ref3} and this definition of comma is
picked up by @Reference.

This seems definetly wrong to me.  @Reference should not be affected
by internal definitions of @Cite/@NoCite

It seems that Lout confuses environment for the right parameter to
@NoCite and environment for a call to @NoRef.

    @NoCite { $NoRef SWT1 }
            ^^^^^^^^^^^^^^^
This is body parameter, so it needs access to @NoCite internals (as
well as @Text's and so on, unwinding bodies).   But

    def @NoCite body x { @NoRef x }
                       ^^^^^^^^^^^^
this is lexically scoped so don't need to unwind the bodily chain.


Perhaps Jeff has more to say on this.


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


--- End Message ---

reply via email to

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