Hi,

Martin A. Hansen wrote (27.10.2005 10:50):
> excellent! that did it!

Good to know ;-)

> i had this feeling that tweaking of the bst file was required, since
> there unfortunately isnt a way to fix this in the makebst dbj file -
> at least i havnt been able to figure it out.

I don't know a way to rebuild a .bst file from a .dbj file, either. But 
I could imagine there is a way...

> i am impressed that you found the spot in the bst file (so fast).

Well, actually, I am myself working on a .bst for the finnish political 
science association. So I have tried to "tame the beast"...

But, the .bst file has some logic in it. How I figured out the solution 
for Your problem was as follows:

1) E.g. the function "article" is defined from the line #843 onwards. 
The _author-date_ (!!) block is formatted as follows:
FUNCTION {article}
{ output.bibitem
  format.authors "author" output.check
  author format.key output
  format.date "year" output.check
  date.block

The function "output.bibitem" sets the output.state variable to a value 
representing the beginning of a block. The function "date.block" sets 
this variable to a value representing the end of a block. 

2) When compared with the function "output.check" (because it "closes" 
the formatting of the authors) defined as follows (lines 115-121):
FUNCTION {output.check}
{ 't :=
  duplicate$ empty$
    { pop$ "empty " t * " in " * cite$ * warning$ }
    'output.nonnull
  if$
}

we can see, if there are authors, the function "output.nonnull" will be 
executed.

3) This function is defined from the line 89 onwards:
FUNCTION {output.nonnull}
{ 's :=
  output.state mid.sentence =
    { ". " * write$ }
    { output.state after.block =
        { add.period$ write$
          newline$
          "\newblock " write$
        }
        { output.state before.all =
            'write$
            { add.period$ " " * write$ }
          if$
        }
      if$
      mid.sentence 'output.state :=
    }
[...]

Now, when excecuted the first time after the "output.bibitem", the 
output.state variable is set to the value of the constant 
"mid.sentence" (because the test "output.state mid.sentence =" results 
false). This means, because this happens when the _authors_ are 
formatted, that the autor and year (or whatever is defined to follow 
the authors' names _before_ the block ends) are separated by a 
mid-sentence punctuation (which was originally defined as ",")! When 
the function "output.nonnull" is once again executed when the date is 
formatted, the test "output.state mid.sentence =" will be true and the 
next command "{ ". " * write$ }" is executed.

Hope this a bit clarified the logic of a .bst file...

> thanks

You're welcome - var så god!

> martin

Kimmo

Reply via email to