#!/bin/csh -f
#
# printbib - print a full bibtex bib file out
#
# David Kotz
#
# usage:
#  printbib bibfile...
#
# Then send the dvi file 'abstract.dvi' to the printer
# (usage varies; try lpr -d abstract.dvi)

if ($#argv == 0) then
	   echo usage: printbib bibfile...
	   exit 1
endif

if ($1:e == "bib") then
	   set files=($1:r)
else
	   set files=($1)
endif

shift
foreach f ($*)
	   if ($f:e == "bib") then
	   	   set files="$files,$f:r"
	   else
	   	   set files="$files,$f"
	   endif
end

echo creating abstract.tex for $files

cat > abstract.tex <<EOF
\documentclass[11pt]{article}
\usepackage{latexsym}
\sloppy
\setlength{\textwidth}{6.5in}
\setlength{\textheight}{9in}
\setlength{\topmargin}{-0.5in}
\setlength{\oddsidemargin}{0pt}
\setlength{\evensidemargin}{0pt}
\newcommand{\eg}{e.g.}		% e.g.
\newcommand{\ie}{i.e.}		% i.e.
\newcommand{\etc}{etc.}		% etc.
\newcommand{\vs}{{\em vs.}}		% vs.
\begin{document}
\begin{center} \Large Bibliography files \large \\\\
EOF
echo $files >> abstract.tex
cat >> abstract.tex <<EOF
\\\\ \today
\end{center}
\nocite{*}
\bibliographystyle{abstract}
EOF

echo "\bibliography{$files}" >> abstract.tex
echo '\end{document}' >> abstract.tex

rm -f abstract.{aux,log,dvi,bbl,blg}

set echo 
latex abstract.tex
bibtex abstract
latex abstract.tex
latex abstract.tex
