Re: Crossreferencing
From: "William D. Lindsey" <blindsey@BDMTech.com>
Date: Sun, 30 Mar 1997 15:47:30 0700
Matthias Clasen writes:
>
[ ...stuff ...]
>
> I.e. I want the `of ' part in proof to be omitted, if it is immediately
> following the theorem. So the task is to determine if the node
> immediately
> before the `proof' element is the one the `of' attribute is referring
> to.
[ ... more stuff ...]
>
>
> 1) Is my idea correct ?
>
> 2) Is there a way to do it within the current limitations of Jade ?
>
> 3) All these questions about crossreferencing made me remember a
> Latexstyle called varioref which allows `intelligent pagereferences'
> which print out
> text like `on this page', `on the next page', `on the previous page'.
> It
> might even be aware if the reference and the referent are on one
> spread
> or not.
Here's a workaround for jade which I used for a problem similar
to yours. I'm sure there are better ways ...
This doesn't address your third question about "intelligent
pagereferences" which would involve indirect sosofos (see 12.5.1
in the standard).
Your code, with one small change:
(element PROOF
(make paragraph
(make sequence
(if (equal? (attributestring "OF")
(attributestring "ID"
(mypreced (currentnode))))
;; was (attributestring "ID" (ipreced)))
; proof directly following theorem, omit number
(literal "Proof:" )
; proof not directly following theorem
(withmode theorem
(processelementwithid
(attributestring "OF"))))
(processchildren))))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;
;; mypreced : substitute for ipreced in jade0.5
;; different from ipreced in that it works on a singleton node list.
;;
;; returns the preceding sibling element or empty node list if
;; this is the first child.
;;
(define (mypreced snl)
(let loop ((scanned (emptynodelist))
(rest (siblings snl)))
(cond ((nodelistempty? rest)
(emptynodelist))
((nodelist=? (nodelistfirst rest) snl)
scanned)
(else
(loop (nodelistfirst rest)
(nodelistrest rest))))))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;
;; a couple of necessary utilities
;;
;; 1) get the list of sibling elements (assumes origin == parent,
;; in other words we're content)
;;
(define (siblings snl)
(children (parent snl)))
;;
;; 2) (emptynodelist)
;;
;; this doesn't seem to have been supplied with jade, so we go find
;; an empty node list at the tail of the currentnode nodelist.
;;
(define (emptynodelist)
(let loop ((enl (currentnode)))
(if (nodelistempty? enl)
enl
(loop (nodelistrest enl)))))
Hope this helps,
Bill

William D. Lindsey
blindsey@bdmtech.com
+1 (303) 6728954
