
11-Oct-88 13:11:05-PDT,22002;000000000000
Return-Path: <bowen%prg.oxford.ac.uk@NSS.Cs.Ucl.AC.UK>
Date: Tue, 11 Oct 88 16:31:12 BST
From: bowen%prg.oxford.ac.uk@NSS.Cs.Ucl.AC.UK
Subject: ref2bib

Here is a new version of *my* "ref2bib" program with corrections
of bugs found by Peter King of Heriot-Watt University. Please
update your archives with this new version. (No need to include
this message in the TeXhax mailing list, unless you think it would
be useful.)

--
Jonathan Bowen
Oxford University Computing Laboratory
Programming Research Group
JANET:	bowen@uk.ac.oxford.prg
ARPA:	bowen%prg.oxford.ac.uk@nss.cs.ucl.ac.uk
UUCP:	bowen@ox-prg.uucp (...!uunet!mcvax!ukc!ox-prg!bowen)

--------- snip snip ----------
#! /bin/sh
# This is a shell archive, meaning:
# 1. Remove everything above the #! /bin/sh line.
# 2. Save the resulting text in a file.
# 3. Execute the file with /bin/sh (not csh) to create the files:
#	README
#	Makefile
#	example.ref2bib
#	ref2bib
#	ref2bib.1
# This archive created: Tue Oct 11 15:49:31 1988
# By:	Jonathan Bowen (Programming Research Group, Oxford University, UK)
export PATH; PATH=/bin:$PATH
echo shar: extracting "'README'" '(841 characters)'
if test -f 'README'
then
	echo shar: will not over-write existing file "'README'"
else
sed 's/^	X//' << \SHAR_EOF > 'README'
	XThese files relate to the ``ref2bib'' command for converting
	Xrefer format bibliographic database files to BibTeX format
	Xfiles for use with LaTeX. The files include:
	X
	X	README		this file
	X	Makefile	make and install files
	X	example.ref2bib	example ".ref2bib" file
	X	ref2bib		shell script which does the work
	X	ref2bib.1	manual page
	X
	X
	XWritten by
	X	Jonathan Bowen, October 1987.
	X	Oxford University Computing Laboratory,
	X	Programming Research Group,
	X	8-11 Keble Road,
	X	Oxford OX1 3QD,
	X	England.
	X	Tel: +44-865-272574 (Sec: +44-865-273840)
	X
	XCopyright (C) 1987,1988  by J.P.Bowen
	X
	XPermission is granted to copy these files for
	Xnon-profit purposes, provided this notice is left intact.
	X
	X	JANET: bowen@uk.ac.oxford.prg
	X	ARPA:  bowen%prg.oxford.ac.uk@nss.cs.ucl.ac.uk
	X	UUCP:  ...!uunet!mcvax!ukc!ox-prg!bowen
	X
SHAR_EOF
if test 841 -ne "`wc -c < 'README'`"
then
	echo shar: error transmitting "'README'" '(should have been 841 characters)'
fi
fi # end of overwriting check
echo shar: extracting "'Makefile'" '(329 characters)'
if test -f 'Makefile'
then
	echo shar: will not over-write existing file "'Makefile'"
else
sed 's/^	X//' << \SHAR_EOF > 'Makefile'
	XBIN=/usr/local/bin
	XMAN=/usr/man/man1
	XSRC=README Makefile example.ref2bib ref2bib ref2bib.1
	X
	Xinstall:
	X	chmod +x ref2bib
	X	cp ref2bib $(BIN)/ref2bib
	X	cp ref2bib.1 $(MAN)/ref2bib.1
	X	chown root $(BIN)/ref2bib $(MAN)/ref2bib.1
	X	chgrp system $(BIN)/ref2bib $(MAN)/ref2bib.1
	X
	Xshar:
	X	shar -a $(SRC) > ref2bib.shar
	X	compress ref2bib.shar
	X
SHAR_EOF
if test 329 -ne "`wc -c < 'Makefile'`"
then
	echo shar: error transmitting "'Makefile'" '(should have been 329 characters)'
fi
fi # end of overwriting check
echo shar: extracting "'example.ref2bib'" '(226 characters)'
if test -f 'example.ref2bib'
then
	echo shar: will not over-write existing file "'example.ref2bib'"
else
sed 's/^	X//' << \SHAR_EOF > 'example.ref2bib'
	Xs/Sorensen/S{\\o}rensen/g
	Xs/Jorgensen/J{\\o}rgensen/g
	Xs/Molgaard/M{\\o}lgaard/g
	X/^	TITLE = /s/\([{ ]\)Z\([ :\.,}]\)/\1{Z}\2/g
	X/^	TYPE = /s/onographs}$/onograph}/
	X/^@/s/{ed\./{Ed/
	Xs/^	AUTHOR = {\(.*\), ed\.},$/	AUTHOR = {\1},/
SHAR_EOF
if test 226 -ne "`wc -c < 'example.ref2bib'`"
then
	echo shar: error transmitting "'example.ref2bib'" '(should have been 226 characters)'
fi
fi # end of overwriting check
echo shar: extracting "'ref2bib'" '(11586 characters)'
if test -f 'ref2bib'
then
	echo shar: will not over-write existing file "'ref2bib'"
else
sed 's/^	X//' << \SHAR_EOF > 'ref2bib'
	X#!/bin/sh
	X#
	X#	ref2bib - convert Unix "refer" format
	X#			to BibTeX "bib" format.
	X#
	X#	Written by Jonathan Bowen, Oxford University, October 1987.
	X#
	X#	Version 1.1 updated by JPB, October 1988:
	X#		Bugs found by Peter Hall corrected.
	X#
	X#	Copyright (C) 1987, J.P.Bowen
	X#
	X#	Permission is granted to copy this shell script for
	X#	non-profit purposes, provided this header is left intact.
	X#
	X#		JANET: bowen@uk.ac.oxford.prg
	X#		ARPA:  bowen%prg.oxford.ac.uk@nss.cs.ucl.ac.uk
	X#
	X
	XPATH=/bin:/usr/bin:/usr/ucb
	XPROGNAME=`basename $0`
	XDEFAULTWIDTH=72
	XDEBUG=false
	XWIDTH=$DEFAULTWIDTH
	XUSENAME=false
	XNAMEDFILES=false
	XBIB=bib
	XVERSION="Version 1.1"
	X
	Xwhile expr X$1 : X'-' > /dev/null
	Xdo
	X    case "$1" in
	X    -|-0|-w)
	X	WIDTH=
	X	;;
	X    -[1-9]|-[1-9][0-9]|-[1-9][0-9][0-9])
	X	WIDTH=`expr X"$1" : X'-\(.*\)'`
	X	;;
	X    -a) : Name by author and year
	X	USENAME=true
	X	;;
	X    -d) : Enable debugging
	X	echo "DEBUGGING: $VERSION"
	X	DEBUG=true
	X	;;
	X    -n) : Named output files
	X	NAMEDFILES=true
	X	;;
	X    -u|-U)
	X	echo "Usage: $PROGNAME [ options ] [ file ... ]
	XConverts Unix \"refer\" format to \"BibTeX\" database format.
	X-a	name entries by author and year		(default=$USENAME)
	X-d	enable debugging			(default=$DEBUG)
	X-n	output to named files (ext \".$BIB\")	(default=$NAMEDFILES)
	X-w	no maximum width
	X-u	display usage information
	X-N	maximum width of N characters (N=1-999)	(default=$DEFAULTWIDTH)"
	X	exit 0
	X	;;
	X    -*)
	X	echo "Usage: $PROGNAME [ -a -[width] ] [ file ... ]"
	X	exit 0
	X	;;
	X    esac
	X    shift
	Xdone
	X
	XGEN=`date -u`" on "`hostname`
	XNAME=$BIB
	XEDITFILE=$HOME/.$PROGNAME
	XSTDIN="-"
	XNEWFILE=""
	X
	X$DEBUG && echo "Generated: <$GEN>" 1>&2
	X$DEBUG && echo "Width: <$WIDTH>" 1>&2
	X
	X# Process each file, or if none given, standard input
	Xfor FILE in ${*-$STDIN}
	Xdo
	X
	X# First set up shell variables as required
	X    if [ "$FILE" = "$STDIN" ]
	X    then
	X	NEWFILE=$NAME.$BIB
	X    else
	X	if [ -r "$FILE" -a -f "$FILE" ]
	X	then
	X		NAME=`basename $FILE`
	X		NEWFILE=$FILE.$BIB
	X	else
	X		NAME=""
	X		echo "$PROGNAME: Can't read $FILE" 1>&2
	X	fi
	X    fi
	X
	X# If all is OK, read input and terminate with a blank line.
	X    if [ "$NAME" ]
	X    then
	X	if [ "$FILE" = "$STDIN" ]
	X	then
	X# If no files given, read from standard input.
	X	    $DEBUG && echo "Reading from standard input" 1>&2
	X	    cat
	X	    echo
	X	else
	X	    $DEBUG && echo "Reading <$FILE>" 1>&2
	X	    cat $FILE
	X	    echo
	X	fi |
	X
	X# Expand (convert tabs to spaces)
	X	expand | 
	X
	X# Remove trailing spaces if present
	X	sed 's/ *$//' |
	X
	X# Unfold wrapped % fields (except %X field with can be long)
	X	awk '/^$|%X/	{ pcfield=0 }
	X/^%[^X]/ 	{ pcfield=1 }
	X/^[^%]/ 	{ if (pcfield > 0) {
	X			pcfield++
	X			printf "%s ",last
	X			last = $0
	X			next
	X		  }
	X		}
	X		{ print last; last = $0 }
	XEND		{ print last }' |
	X
	X
	X# Next do the real work
	X	awk 'BEGIN {	# Initialization
	X		gen="'"$GEN"'"
	X		default="'"$NAME"'"
	X		progname="'"$PROGNAME"'"
	X		printf "@COMMENT{Generated by %s, %s}\n",progname,gen
	X	}
	X/^%/	{	# Any % line
	X	entry=substr($0,4)
	X	recordtype=substr($0,2,1)
	X	percent=1
	X	xcount=0
	X	}
	X/^%A /	{	# Author
	X	if (author == "") {
	X		name4 = substr($NF,1,4)
	X		author = entry
	X	}
	X	else author = sprintf("%s and %s",author,entry)
	X	next
	X	}
	X/^%B /	{	# Book
	X	if (booktitle == "") booktitle = entry
	X	else booktitle = booktitle " " entry
	X	entrytype = "INCOLLECTION"
	X	next
	X	}
	X/^%C /	{	# City
	X	if (address == "") address = entry
	X	else address = address " " entry
	X	next
	X	}
	X/^%D /	{	# Date
	X	if (year == "") {
	X		year = $NF
	X		year2 = substr($NF,length($NF)-1)
	X	}
	X	if (month == "" && NF > 2)
	X		month = substr(entry,1,length(entry)-length($NF)-1)
	X	next
	X	}
	X/^%E /	{	# Editor
	X	if (editor == "") editor = entry
	X	else editor = sprintf("%s and %s",editor,entry)
	X	if (entrytype == "") entrytype = "BOOK"
	X	next
	X	}
	X/^%F /	{	# Footnote
	X	if (note == "") note = entry
	X	else note = note " " entry
	X	next
	X	}
	X/^%G /	{	# Government order number
	X	next
	X	}
	X/^%H /	{	# Header
	X	if (annote == "") annote = entry
	X	else annote = annote " " entry
	X	next
	X	}
	X/^%I /	{	# Issuer
	X	if (institution == "") institution = entry
	X	else institution = institution " " entry
	X	next
	X	}
	X/^%J /	{	# Journal
	X#	if (index(entry,"Proc.") > 0 || index(entry,"Proceedings") || \
	X	if (index(entry,"Conf.") > 0 || \
	X	    index(entry,"Conference") > 0) {
	X		if (booktitle == "") booktitle = entry
	X		else booktitle = sprintf("%s, %s",booktitle,entry)
	X		entrytype = "INPROCEEDINGS"
	X	}
	X	else {
	X		if (journal == "") journal = entry
	X		else journal = journal " " entry
	X		entrytype = "ARTICLE"
	X	}
	X	next
	X	}
	X/^%K /	{	# Keyword
	X	if (keywords == "") keywords = entry
	X	else keywords = sprintf("%s, %s",keywords,entry)
	X	next
	X	}
	X/^%L /	{	# Label
	X	if (label == "") label = $2
	X	next
	X	}
	X/^%M /	{	# Memorandum
	X	next
	X	}
	X/^%N /	{	# Number
	X	if (number == "") number = entry
	X	next
	X	}
	X/^%O /	{	# Other (conference)
	X	if (conference == "") conference = entry
	X	else conference = conference " " entry
	X	entrytype = "INPROCEEDINGS"
	X	next
	X	}
	X/^%P /	{	# Page(s)
	X	if (index(entry,"-") > 0 || index(entry,",") > 0) {
	X		if (pages == "") pages = entry
	X		else pages = sprintf("%s,%s",pages,entry)
	X	}
	X	else if (numberofpages == "") numberofpages = entry
	X	next
	X	}
	X/^%Q /	{	# Corporate or foreign author (surname first)
	X	if (author == "") {
	X		name4 = substr($2,1,4)
	X		author = entry
	X	}
	X	else author = sprintf("%s and %s",author,entry)
	X	next
	X	}
	X/^%R /	{	# Report, paper or thesis (i.e. unpublished)
	X	if (index(entry,"Ph") > 0)	entrytype="PHDTHESIS"
	X	if (index(entry,"hesis") > 0)	entrytype="PHDTHESIS"
	X	if (index(entry,"Sc") > 0)	entrytype="MASTERSTHESIS"
	X	if (index(entry,"aster") > 0)	entrytype="MASTERSTHESIS"
	X	if (index(entry,"ech") > 0)	entrytype="TECHREPORT"
	X	if (index(entry,"eport") > 0)	entrytype="TECHREPORT"
	X	if (index(entry,"aper") > 0)	entrytype="UNPUBLISHED"
	X	if (index(entry,"orking") > 0)	entrytype="UNPUBLISHED"
	X	if (index(entry,"npub") > 0)	entrytype="UNPUBLISHED"
	X	if (index(entry,"ocument") > 0)	entrytype="MANUAL"
	X	if (index(entry,"anual") > 0)	entrytype="MANUAL"
	X	if (entrytype=="UNPUBLISHED") {
	X		if (note == "") note = entry
	X		else note = note " " entry
	X	}
	X	else {
	X		if (type == "") type = entry
	X	}
	X	next
	X	}
	X/^%S /	{	# Series title
	X	if (series == "") series = entry
	X	else series = series " " entry
	X	if (index(entry,"Tech") > 0)	entrytype="TECHREPORT"
	X	next
	X	}
	X/^%T /	{	# Title
	X	if (title == "") title = entry
	X	else title = title " " entry
	X	next
	X	}
	X/^%U /	{	# Unused
	X	next
	X	}
	X/^%V /	{	# Volume
	X	if (volume == "") volume = entry
	X	next
	X	}
	X/^%X /	{	# Abstract
	X	abstract[++xcount] = entry
	X	next
	X	}
	X/^%Y /	{	# Unused
	X	next
	X	}
	X/^%Z /	{	# Can be used to supply an entry name
	X	name = entry
	X	next
	X	}
	X/^[^%]/	{	# Other lines - abstract if started by "%X" field
	X	if (recordtype == "X") abstract[++xcount] = $0
	X	next
	X	}
	X/^$/	{	# Empty line delimits a record
	X	if (percent == 1) {	# End of a record
	X		if (index(entrytype,"BOOK") > 0 || \
	X		    index(entrytype,"INCOLLECTION") > 0) {
	X			publisher = institution
	X			institution = ""
	X		}
	X		if (entrytype == "" || entrytype == "BOOK") {
	X			if (pages != "") {
	X				if (booktitle != "") entrytype = "INCOLLECTION"
	X				else entrytype = "INBOOK"
	X			}
	X		}
	X		if (entrytype == "MANUAL" || \
	X		    index(entrytype,"PROCEEDINGS") > 0) {
	X			organization = institution
	X			institution = ""
	X		}
	X		if (entrytype == "TECHREPORT") {
	X			if (type == "") {
	X				type = series
	X				if (substr(type,length(type)) == "s") {
	X					type = substr(type,1,length(type)-1)
	X				}
	X				series = ""
	X			}
	X			if (number == "") {
	X				number = volume
	X				volume = ""
	X			}
	X		}
	X		if (index(entrytype,"THESIS") > 0) {
	X			school = institution
	X			institution = ""
	X		}
	X		if ("'"$USENAME"'" == "true") name = sprintf("%s%s",name4,year2)
	X		if (name == "") name = default;
	X		if (entrytype == "") entrytype = "MISC";
	X		printf "\n@%s{%s:%03d,\n",entrytype,name,++num
	X		if (author != "")
	X			printf "\tAUTHOR = {%s},\n",author;
	X		if (editor != "")
	X			printf "\tEDITOR = {%s},\n",editor;
	X		if (title != "")
	X			printf "\tTITLE = {%s},\n",title;
	X		if (booktitle != "")
	X			printf "\tBOOKTITLE = {%s},\n",booktitle;
	X		if (journal != "")
	X			printf "\tJOURNAL = {%s},\n",journal;
	X		if (volume != "")
	X			printf "\tVOLUME = {%s},\n",volume;
	X		if (number != "")
	X			printf "\tNUMBER = {%s},\n",number;
	X		if (pages != "")
	X			printf "\tPAGES = {%s},\n",pages;
	X		if (type != "")
	X			printf "\tTYPE = {%s},\n",type;
	X		if (series != "")
	X			printf "\tSERIES = {%s},\n",series;
	X		if (institution != "")
	X			printf "\tINSTITUTION = {%s},\n",institution;
	X		if (organization != "")
	X			printf "\tORGANIZATION = {%s},\n",organization;
	X		if (school != "")
	X			printf "\tSCHOOL = {%s},\n",school;
	X		if (publisher != "")
	X			printf "\tPUBLISHER = {%s},\n",publisher;
	X		if (address != "")
	X			printf "\tADDRESS = {%s},\n",address;
	X		if (conference != "")
	X			printf "\tCONFERENCE = {%s},\n",conference;
	X		if (key != "")
	X			printf "\tKEY = {%s},\n",key;
	X		if (keywords != "")	 # Non-standard keyword field
	X			printf "\tKEYWORDS = {%s},\n",keywords;
	X		if (label != "")	 # Non-standard label field
	X			printf "\tLABEL = {%s},\n",label;
	X		if (numberofpages != "") # Non-standard length (in pages) field
	X			printf "\tLENGTH = {%s},\n",numberofpages;
	X		if (year != "")
	X			printf "\tYEAR = {%s},\n",year;
	X		if (month != "")
	X			printf "\tMONTH = {%s},\n",month;
	X		if (annote != "")
	X			printf "\tANNOTE = {%s},\n",annote;
	X		if (note != "")
	X			printf "\tNOTE = {%s},\n",note;
	X		if (xcount != 0) {
	X			printf "\tABSTRACT = {%s",abstract[1];
	X			for (i=2; i<=xcount; i++)
	X				printf "\n\t\t%s",abstract[i];
	X			printf "},\n"
	X		}
	X#		printf "\tGENERATED = {%s}\n",gen
	X		printf "}\n"	# End of record
	X	}
	X	author=""
	X	booktitle=""
	X	address=""
	X	year=""
	X	month=""
	X	editor=""
	X	annote=""
	X	note=""
	X	institution=""
	X	organization=""
	X	school=""
	X	publisher=""
	X	address=""
	X	conference=""
	X	journal=""
	X	key=""
	X	keywords=""
	X	label=""
	X	number=""
	X	pages=""
	X	numberofpages=""
	X	type=""
	X	series=""
	X	title=""
	X	volume=""
	X	name=""
	X	entrytype=""
	X	name4=""
	X	year2=""
	X	percent=0
	X	xcount=0
	X	recordtype=""
	X	}
	XEND {printf "\n"}' |
	X
	X# Remove trailing comma from last line in each entry
	X	awk '/^$|^[^}]/ { print last }
	X/^}/	{ print substr(last,1,length(last)-1) }
	X	{ last=$0 }
	XEND	{ print }' |
	X
	X# Some things can be automatically edited
	X	sed '1d
	Xs/\([\\\$&#^_]\)/\\\1/g
	Xs/\([{ ]\)LaTeX\([} :]\)/\1{\\LaTeX}\2/g
	Xs/\([{ ]\)TeX\([} :]\)/\1{\\TeX}\2/g
	X/^	TITLE = /{
	X	s/\([{ ]\)\([B-Z]\)\([ :\.,}]\)/\1{\2}\3/g
	X	s/\([{ ]\)\([A-Z][A-Z][A-Z]*\)\([ :\.,}]\)/\1{\2}\3/g
	X}
	Xs/\\0/\~/g
	Xs/"\([^"]*\)"/``\1'"''"'/g
	Xs/ - / --- /g
	Xs/\([0-9]\)-\([0-9]\)/\1--\2/g' |
	X
	X# Other edits can be customised by the user
	X	if [ -r $EDITFILE -a -f $EDITFILE ]
	X	then
	X		sed -f $EDITFILE
	X	else
	X		cat
	X	fi |
	X
	X# Optionally fold lines
	X	if [ "$WIDTH" ]
	X	then
	X		awk 'BEGIN	{width='"$WIDTH"'}
	X/^[^	]|^$/	{printf "\n%s",$0}	# Print most lines normally
	X/^	[^	]/ {	# Fold lines starting with a single tab
	X	    i=1
	X	    while (i <= NF) {
	X		if (i > 1) {
	X		    printf "\n\t\t%s",$i
	X		    pos = 16+length($i)
	X		}
	X		else {
	X		    printf "\n\t%s",$i
	X		    pos = 8+length($i)
	X		}
	X		if (++i <= NF) {
	X		    pos += 1+length($i)
	X		    while (pos <= width) {
	X			printf " %s",$i
	X			if (++i > NF) break
	X			pos += 1+length($i)
	X		    }
	X		}
	X	    }
	X	}
	X/^		/ {	# Fold multiple lines starting with a double tab
	X	    i=1
	X	    while (i <= NF) {
	X		pos += 1+length($i)
	X		if (pos > width) {
	X		    printf "\n\t\t%s",$i
	X		    pos = 16+length($i)
	X		}
	X		else {
	X		    printf " %s",$i
	X		}
	X		if (++i <= NF) {
	X		    pos += 1+length($i)
	X		    while (pos <= width) {
	X			printf " %s",$i
	X			if (++i > NF) break
	X			pos += 1+length($i)
	X		    }
	X		}
	X	    }
	X	}
	XEND {printf "\n"}'
	X	else
	X		cat
	X	fi |
	X
	X# Finally, output to named files or standard output
	X	if $NAMEDFILES
	X	then
	X		$DEBUG && echo "Output to <$NEWFILE>" 1>&2
	X		cat > $NEWFILE
	X	else
	X		cat
	X	fi
	X
	X    fi
	Xdone
	X
	Xexit 0
	X
SHAR_EOF
if test 11586 -ne "`wc -c < 'ref2bib'`"
then
	echo shar: error transmitting "'ref2bib'" '(should have been 11586 characters)'
fi
chmod +x 'ref2bib'
fi # end of overwriting check
echo shar: extracting "'ref2bib.1'" '(3399 characters)'
if test -f 'ref2bib.1'
then
	echo shar: will not over-write existing file "'ref2bib.1'"
else
sed 's/^	X//' << \SHAR_EOF > 'ref2bib.1'
	X.TH REF2BIB 1L "23 October 1987"
	X.UC
	X.SH NAME
	Xref2bib \- convert refer formatted records to BibTeX format
	X.SH SYNOPSIS
	X.B ref2bib
	X[ options ] [ file ... ]
	X.SH DESCRIPTION
	X.I Ref2bib
	Xreads input from a number of files or standard input.
	XGroups of consecutive lines starting with a ``%'' character
	Xare assumed to be records in \fIrefer\fP(1) format 
	Xseparated by one or more empty lines.
	X(See the \fIaddbib\fP(1) manual page for further details.)
	XThese are translated into BibTeX database format records on
	Xstandard output.
	XOther lines are ignored and thrown away except for
	Xlines after an ``%X'' field in a record (see below).
	XDetails of the BibTeX format may be found in the
	XLaTeX User's Guide & Reference Manual on pp140\-147.
	X.PP
	XThe BibTeX records are given names of the form ``filename:ddd''
	Xwhere ``filename'' is the basename of the current file
	X(or ``bib'' if reading from standard input), and ``ddd'' is
	Xa three digit number starting from ``001''.
	XThe filename may be replaced by including a (normally unused)
	X``%Z'' field in the refer record.
	X.PP
	XThe ``%X'' field may be used to hold an abstract.
	XAny lines in a record after a ``%X'' which do not start
	Xwith a ``%'' are considered to hold further abstract details
	Xand are included in the corresponding BibTeX record.
	X.PP
	XSome words and character sequences (such as ``LaTeX'') are detected
	Xin the input automatically and converted to a suitable LaTeX form.
	XThe BibTeX output may be further massaged through \fIsed\fP(1)
	Xby placing a \fIsed\fP script in the file \fI$HOME/.ref2bib\fP.
	XFor example, accents for known names may be added automatically.
	XE.g.:
	X.IP
	Xs/Sorensen/S{\\\\o}rensen/g
	X.LP
	XNote that backslashes need to be doubled up since they are normally
	Xused as an escape sequence.
	X.PP
	XThe output of each field in the BibTeX records is normally folded
	Xat word boundaries to ensure that lines do not become too long on
	Xoutput.
	X.SH OPTIONS
	XThe following options are available:
	X.TP 10
	X.BI \- num
	XSpecify a maximum width for the output.
	XThe default is 72 characters.
	XIf \fInum\fP is omitted then field entries are not folded and may
	Xbe of any length.
	X.TP 10
	X.B \-a
	XName the record using the first four letters of the first author's
	Xsurname and the last two digits of the year, rather than using
	Xthe filename (e.g. ``Bowe87:001'').
	X.TP 10
	X.B \-n
	XUse the name of the input file(s) to produce output file(s) with
	Xthe same name and extension ``.bib'' rather than sending the output
	Xto standard output.
	X.TP 10
	X.B \-u
	XDisplay the usage of the command.
	X.TP 10
	X.B \-w
	XDo not fold the output. Field entries may be of any length on
	Xoutput.
	X.SH FILES
	X.PD 0
	X.TP 40
	X$HOME/.ref2bib
	X\fIsed\fP script for output
	X.TP 40
	X*.bib
	XBibTeX database files
	X.TP 40
	X*.bst
	XBibTeX style files
	X.PD
	X.SH "SEE ALSO"
	Xaddbib(1),
	Xbibtex(1),
	Xfold(1),
	Xlatex(1),
	Xrefer(1),
	Xsed(1),
	X.br
	X``LaTeX User's Guide & Reference Manual'' by Leslie Lamport
	X.SH AUTHOR
	XJonathan Bowen, Oxford University
	X.SH BUGS
	XThis program is not perfect, needless to say, and thus
	Xthe output produced may require further hand editing.
	X.PP
	XA number of bugs found by Peter King of Heriot-Watt University
	Xhave been corrected. He has also produced another separately
	Xdeveloped version of \fIref2bib\fP which may or may not do a
	Xbetter job than this one depending on the input supplied.
	X.PP
	XThe shell script and manual page may change without notice.
	X.PP
	XPlease report problems to \fI<bowen@uk.ac.oxford.prg>\fP.
SHAR_EOF
if test 3399 -ne "`wc -c < 'ref2bib.1'`"
then
	echo shar: error transmitting "'ref2bib.1'" '(should have been 3399 characters)'
fi
fi # end of overwriting check
#	End of shell archive
exit 0

