[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: ref list in order of appearance
From: |
David Duffy |
Subject: |
Re: ref list in order of appearance |
Date: |
Thu, 6 May 1999 09:38:45 +1000 (EST) |
On Wed, 5 May 1999, Mikko Huhtala wrote:
>
> I'd like to sort my list of references in the order of appearance in the
> text. The 3.13 User's Guide states quite bluntly that "there is no way
Other people on the list have mentioned their solutions in the past, I think.
If you live in a Unix (or DJGPP or Cygwin) environment, you can do as I
do ;)
ordcite doc.lout ordered.lout
ordcite:
#
# Pass through Lout document and produce list of citations
# in order they occur in the text
#
AWK=gawk
SED=sed
$AWK '
BEGIN { RS="[{}]"
n=0
}
/@Cite/ {
getline
if (!cite[$0]) {
n++
cite[$0]=n
}
}
END { for (c in cite) {
print "s/\\" c "/$ label {" cite[c] "} " \
substr(c,index(c,"$")+1) "/g"
}
}' $1 > ordcite.sed
$SED -f ordcite.sed $1 > $2
rm ordcite.sed