anchor.diff:  
   ;;; Writing the BBL file
   
  -(defvar *bbl-output* nil "The stream corresponding to the formatted bibliography (BBL) file.")
  - 
  +(defvar *bbl-output* nil
  +  "The stream corresponding to the formatted bibliography (BBL) file.")
  +
  +(defvar *bbl-min-print-line* 3
  +  "Minimum line length in the formatted bibliography (BBL) file.")
  +
  +(defvar *bbl-max-print-line* 79
  +  "Maximum .bbl line length.  BBL-PRINT breaks lines so that no more
  +than this many characters apear on each output line.  If nil,
  +BBL-PRINT will not break lines.")
  +
  +(defvar *bbl-line-buffer* nil)
  +
  +(defun bbl-print (string)
  +  "Add STRING to the BBL output buffer.  If there are enough
  +characters present in the output buffer, it writes one or more lines
  +out to the *BBL-OUTPUT* stream.  It may break a line at any whitespace
  +character it likes, but if it does, it will add two spaces to the next
  +output line.  If there's no whitespace character to break the line at,
  +we break it just before *BBL-MAX-PRINT-LINE*, append a comment
  +character (%), and don't indent the next line."
  +  (loop for char across string do
  + 	(vector-push-extend char *bbl-line-buffer*))
  +  (when *bbl-max-print-line*
  +    (loop while (> (length *bbl-line-buffer*) *bbl-max-print-line*) do
  +	  ;; Break that line
  +	  (let ((white-space-index
  +		 (position-if #'whitespace-p *bbl-line-buffer*
  +			      :start *bbl-min-print-line*
  +			      :end (+ *bbl-max-print-line* 1)
  +			      :from-end t)))
  +	    (cond
  +	      (white-space-index	; have a whitespace character
  +	       (let ((non-space-index
  +		      (position-if (complement #'whitespace-p) *bbl-line-buffer*
  +				   :end white-space-index
  +				   :from-end t)))
  +		 (when non-space-index ; ignore a line of just whitespace
  +		   (princ (subseq *bbl-line-buffer* 0 (+ non-space-index 1))
  +			  *bbl-output*)
  +		   (terpri *bbl-output*)
  +		   ;; shift the rest back
  +		   (replace *bbl-line-buffer* *bbl-line-buffer*
  +			    :start1 2 :start2 (+ white-space-index 1))
  +		   ;; start the next line with two spaces
  +		   (replace *bbl-line-buffer* "  " :start1 0)
  +		   (decf (fill-pointer *bbl-line-buffer*)
  +			 (- (+ white-space-index 1) 2)))))
  +	      (t ; there's no whitespace character to break the line at
  +	       (princ (subseq *bbl-line-buffer* 0 (- *bbl-max-print-line* 1))
  +		      *bbl-output*)
  +	       (princ "%" *bbl-output*)
  +	       (terpri *bbl-output*)
  +	       (replace *bbl-line-buffer* *bbl-line-buffer*
  +			:start1 0 :start2 (- *bbl-max-print-line* 1))
  +	       (decf (fill-pointer *bbl-line-buffer*)
  +		     (- *bbl-max-print-line* 1))))))))
  +
  +(defun bbl-terpri ()
  +  (princ *bbl-line-buffer* *bbl-output*)
  +  (terpri *bbl-output*)
  +  (setf (fill-pointer *bbl-line-buffer*) 0)
  +  nil)
  +
  +(defun bbl-flush ()
  +  (unless (zerop (length *bbl-line-buffer*))
  +    (bbl-terpri)))
  +
  +(defmacro with-bbl-output ((stream) &body body)
  +  `(let ((*bbl-output* ,stream)
  +	 (*bbl-line-buffer* (make-array 0
  +					:element-type 'character
  +					:adjustable t
  +					:fill-pointer 0)))
  +    (multiple-value-prog1 (progn ,@body)
  +      (bbl-flush))))
  +
   ;;;
   
   (defvar *min-crossrefs* 2 "When a crossref'd entry is referenced at
  
positive.code: 	       (setf (gethash key entry) value)))
      entry))
  
  (defun cited-bib-entries (cite-keys &key
  			  (min-crossrefs 2))
    "Return a vector of the entries in *BIB-DATABASE* whose keys are
  
negative.code: (defun read-all-bib-files-and-compute-bib-entries ()
    (dolist (file *bib-files*)
      (let ((expanded-file (kpathsea:find-file (concatenate 'string file ".bib"))))
        (if (not expanded-file)
  	  (format *error-output* "I couldn't find database file `~A.bib'" file)
  	  (with-open-file (s expanded-file :if-does-not-exist nil)
  	    (if (not s)
  		(format *error-output* "I couldn't open database file `~A.bib'" expanded-file)
  		(read-bib-database s))))))
    (cited-bib-entries (if *cite-all-entries* t *cite-keys*)
  		     :min-crossrefs *min-crossrefs*))
  
  