\documentclass[a4paper]{article}
% \usepackage{times}
\usepackage[definethebibliography]{easybib}%
\usepackage{easytitle}%

\let\package\texttt % so \package{foo} comes out in \tt
\let\envname\textsf % so \envname{foo} comes out as \sf

\newbox\tempbox
% 
\def\BOX{%
    \setbox\tempbox\hbox\bgroup
    \begin{minipage}{0.9\textwidth}
}
\def\endBOX{%
    \end{minipage}
    \egroup
    \par\bigskip
    \begin{center}
        \fboxsep=10pt\fbox{\box\tempbox}
    \end{center}
    \bigskip\par
}


\title{The package \package{easybib}}
\author[E. Bertolazzi]{Enrico Bertolazzi}
\address{
  Laboratorio di Matematica Applicata e Meccanica Computazionale\\
  Dipartimento di Ingegneria Meccanica e Strutturale\\
  Universit\`a degli Studi di Trento\\
  Mesiano, Trento, Italy}

\mailto{enrico.bertolazzi@ing.unitn.it}

\begin{document}

\maketitle
\begin{abstract}
The package \package{easybib} introduces some new items for easy
customization of the bibliography.
\end{abstract}

\tableofcontents
\vfill
{\bfseries Important} The package \package{easybib} was improved a lot
between version 0.1 to version 0.2. Unfortunately, due to some technical
choice, bibliography written for version 0.2 are incompatible
(because of few modification) with bibliography written for version 
0.1. If you prefer the old style you can find \verb+easybib.sty+ in the
directory \verb+``old''+. 

\newpage

\def\AmSTeX{{$\mathcal{A}$\kern-.1667em 
\lower.5ex\hbox{$\mathcal{M}$}\kern-.125em$\mathcal{S}$}-\TeX}

\section{The package \package{easybib}}


The scheme for the bibliography in the package \package{easybib}
was inspired by the beautiful
bibliography system of \AmSTeX{}. Due to the necessity of
flexibility, the syntax is a little bit different but the
functionality is similar (although not identical).
For the use, load the package using the usual syntax:
\begin{BOX}
\begin{verbatim}
   \documentclass{article}
   .
   .
   \usepackage[definethebibliography]{easybib}
   .
   .
\end{verbatim}
\end{BOX}
The option \verb+definethebibliography+ permits to override
the default \envname{thebibliography} environment.
In this case the environment \envname{thebibliography} take this form:
\begin{verbatim}

\begin{thebibliography}``[optional name]''``(\cmd,space)''{99}
.
.
.
\end{thebibliography}

\end{verbatim}
so that you can override the default name \verb"\refname" with 
your own name, you can change the default \verb+\section*+ with \verb+\cmd+
and add extra space \verb+space+ before the items. The syntax of the
bibliography command is now the following
\begin{verbatim}

\begin{thebibliography}{99}

\bookref{label name}
  \by        Author(s) name
  \bysame
  \title     Title of the book
  \bookinfo  ...
  \publ      publisher
  \publaddr  publisher address
  \pages     pages number
  \yr        year
  \lang      ...
  \transl    ...
\endref

\paperref{label name}
  \by        Author(s) name
  \bysame
  \title     Title of the book
  \transl    ...
  \jour      Journal name
  \toappear  ...
  \inbook    ...
  \publ      publisher
  \eds       ...
  \publaddr  publisher address
  \vol       volume
  \yr        year
  \pages     pages number
  \finalinfo ...
  \lang      ...
\endref

\end{thebibliography}

\end{verbatim}
the command
\begin{verbatim}
\bookref``[display label]''{label} ... \endref
\end{verbatim}
is used to refer to a book, while 
\begin{verbatim}
\paperref``[display label]''{label} ... \endref
\end{verbatim}
is used to refer to a paper.

When an item, for example \verb+\xxx+, is encountered then the following 
text is expanded as follows
\begin{verbatim}
    \xxx+text ==> punctation + begin commands + text + end commands
\end{verbatim}
where the \verb+punctation+ is displayed unless \verb+\xxx+ is the 
first displayed item.
The default values for the items in the \verb+\bookref+ environment 
are the following
\begin{center}
\begin{tabular}{|l|l|l|l|}
\hline
command & punctation  & begin commands & end commands \\
\hline
\verb+\by+       & \verb+,+ & \verb+\bfseries+ & nothing \\
\verb+\bysame+    & \verb+,+ & $\vcenter{\vskip.5em\hbox{\verb+\hbox to3em+}\vskip.2em
                                    \hbox{\verb+{\hrulefill\hskip.1em}+}\vskip.5em}$ & nothing \\
\verb+\title+     & \verb+,+ & \verb+\scshape+ & nothing \\
\verb+\bookinfo+  & \verb+,+ & \verb+\rmfamily+ & nothing \\
\verb+\publ+      & \verb+,+ & \verb+\rmfamily+ & nothing \\
\verb+\publaddr+  & \verb+,+ & \verb+\rmfamily+ & nothing \\
\verb+\pages+     & \verb+,+ & \verb+\rmfamily+ & nothing \\
\verb+\yr+        & \verb+,+ & \verb+\rmfamily+ & nothing \\
\verb+\lang+      & nothing  & \verb+(+ & \verb+)+ \\
\verb+\transl+    & \verb+,+ & \verb+\rmfamily+ & nothing \\
\hline
\end{tabular}
\end{center}
The default values for the items in the \verb+\paperref+ environment 
are the following
\begin{center}
\begin{tabular}{|l|l|l|l|}
\hline
command & punctation  & begin commands & end commands \\
\hline
\verb+\by+       & \verb+,+ & \verb+\bfseries+ & nothing \\
\verb+\bysame+    & \verb+,+ & $\vcenter{\vskip.5em\hbox{\verb+\hbox to3em+}\vskip.2em
                                    \hbox{\verb+{\hrulefill\hskip.1em}+}\vskip.5em}$ & nothing \\
\verb+\title+     & \verb+,+ & \verb+\itshape+ & nothing \\
\verb+\transl+    & \verb+,+ & \verb+\rmfamily+ & nothing \\
\verb+\jour+      & \verb+,+ & \verb+\rmfamily+ & nothing \\
\verb+\toappear+  & nothing  & \verb+(to appear+ & \verb+)+ \\
\verb+\inbook+    & \verb+,+ & \verb+\rmfamily+ & nothing \\
\verb+\publ+      & \verb+,+ & \verb+\rmfamily+ & nothing \\
\verb+\eds+       & nothing  & \verb+(+ & \verb+\@killglue, eds.)+ \\
\verb+\publaddr+  & \verb+,+ & \verb+\rmfamily+ & nothing \\
\verb+\vol+       & nothing  & \verb+\bfseries+ & nothing \\
\verb+\yr+        & nothing  & \verb+(+ & \verb+)+ \\
\verb+\pages+     & \verb+,+ & \verb+\rmfamily+ & nothing \\
\verb+\finalinfo+ & \verb+,+ & \verb+\rmfamily+ & nothing \\
\verb+\lang+      & nothing  & \verb+(+ & \verb+)+ \\
\hline
\end{tabular}
\end{center}

\section{The command \texttt{\char`\\moreref}}
In the case of more than one reference of the same author or in the 
case of a series of papers or books on the same argument, it is sometimes
useful to use the \verb+\moreref+ command. The syntax is the following
\begin{verbatim}
\paperref{label name} or \bookref{label name}
    items
    \moreref`[punctation]'{book or paper}
    items
    \moreref`[punctation]'{book or paper}
    .
    .    
\endref
\end{verbatim}
The effect is to use a single label reference for more than one book or
paper. The optional command \verb+`[punctation]'+ can be used to 
change the default punctation \verb+`;'+ to something else for example
you can use \verb+\moreref[, see also:]{book}+.

\section{The command \texttt{\char`\\endref}}
The command \verb+\endref+ ends the definition of a reference.
By default the reference is ended with the punctation \verb+;+.
It is possible to change the default value as follows
\begin{verbatim}

   \endref[punctation], for example \endref[.]

\end{verbatim}
This is useful for the last reference, for example
\begin{verbatim}
\begin{thebibliography}{99}

\bookref{ORTEGA}
\by     J.~M.~Ortega, W.~C.~Rheinboldt
\title  Iterative Solution of Nonlinear Equation in Several Variables
\publ   Accademic Press
\yr     1970
\endref

\bookref{aaa}
\by     C.~V.~Pao
\title  Nonlinear Parabolic and Elliptic Equations
\publ   Plenum Press \publaddr NY
\yr     1992
\endref

\bookref{ZEIDLER}
\by     E.~Zeidler
\title  Nonlinear Functional Analysis and its Applications I
\publ   Springer Verlag \publaddr NY
\yr     1986
\endref[.]

\end{thebibliography}

\end{verbatim}
produces
\begin{BOX}
\begin{thebibliography}{99}

\bookref{ORTEGA}
\by     J.~M.~Ortega, W.~C.~Rheinboldt
\title  Iterative Solution of Nonlinear Equation in Several Variables
\publ   Accademic Press
\yr     1970
\endref

\bookref{aaa}
\by     C.~V.~Pao
\title  Nonlinear Parabolic and Elliptic Equations
\publ   Plenum Press \publaddr NY
\yr     1992
\endref

\bookref{ZEIDLER}
\by     E.~Zeidler
\title  Nonlinear Functional Analysis and its Applications I
\publ   Springer Verlag \publaddr NY
\yr     1986
\endref[.]

\end{thebibliography}
\end{BOX}


\section{The command \texttt{\char`\\refstyle}}
There are many styles for display the labels of the bibliography. The
standard \LaTeX{} way of changing the appearance is to modify the
\verb+\@bibitem+ macro. A easiest way in \package{easybib} is to use
\verb+\refstyle+ before \verb+\begin{thebibliography}+.
The syntax is the following:
\begin{verbatim}

    \refstyle{A} or \refstyle{B}  or  \refstyle{C}
    
\end{verbatim}
the effect is to change \verb+\@bibitem+ as follows
\begin{center}
\begin{tabular}{|l|l|c|}
   \hline
   command & \verb+\@bibitem+ definition & sample output \\
   \hline
   \verb+\refstyle{A}+ & \verb+\def\@bibitem#1{#1.}+  & 1.   \\
   \verb+\refstyle{B}+ & \verb+\def\@bibitem#1{[#1]}+ & [1]  \\
   \verb+\refstyle{C}+ & \verb+\def\@bibitem#1{}+     & nothing \\
   \hline
\end{tabular}
\end{center}

\section{An example of bibliography from \AmSTeX{} documentation}

The following complex example shows the features of \envname{easybib}
and is essentially the example showed in the \AmSTeX{} documentation
translated in the language of \envname{easybib}.

\small
\begin{verbatim}
\begin{thebibliography}{99}

\bookref{abc}
\by     V. I. Arnol$'$d, A. N. Varchenko, and S. M. Guse\u\i n-Zade
\title  Singularities of differentiable maps.~{\rm I}
\publ   ``Nauka'' \publaddr Moscow
\yr     1982
\lang   Russian
\endref

\bookref{def}
\bysame 
\title   Singularities of differentiable maps.~{\rm II}
\publ    ``Nauka'' \publaddr Moscow
\yr      1984
\lang    Russian
\endref

\bookref{ghi}
\by       O. A. Ladyzhenskaya
\title    Mathematical problems in the dynamics of a
          viscous incompressible fluid 
\bookinfo 2nd rev. aug. ed.
\publ     ``Nauka'' \publaddr Moscow
\yr       1970
\lang     Russian
\transl   English transl. of 1st ed.
\moreref{book}
\title    The mathematical theory of viscous
          incompressible flow
\publ     Gordon and Breach \publaddr New York
\yr       1963; rev. 1969
\endref

\bigskip

\paperref{bib:4}
\by       P. D. Lax and C. D. Levermore
\title    The small dispersion limit for the KdV equation.~{\rm I}
\jour     Comm. Pure Appl. Math. 
\vol 36   \yr 1983 \pages 253--290
\finalinfo (overview)
\moreref[, see also:]{paper}
\title    {\rm II}
\jour     Comm. Pure Appl. Math. 
\vol 36 \yr 1983 \pages 571--594
\moreref[, see also:]{paper}
\title    {\rm III}
\jour     Comm. Pure Appl. Math. 
\vol 36 \yr 1983 \pages 809--829
\endref

\paperref{bib:5}
\by        S. Osher
\title     Shock capturing algorithms for equations of mixed type
\inbook    Numerical Methods for Partial Differential Equations
\eds       S. I. Hariharan and T. H. Moulton
\publ Longman \publaddr New York \yr 1986 \pages 305--322
\endref

\paperref{bib:6}
\by        G. S. Petrov
\title     Elliptic integrals and their nonoscillatory behavior
\jour      Funktsional. Anal. i Pri\-lo\-zhen.
\vol 20 \yr 1986 \pages 46--49
\moreref{paper}
\transl English transl. in Functional Anal. Appl. \vol 20\yr 1986
\endref[.]


\end{thebibliography}

\refstyle{B}

\begin{thebibliography}{AAAA}

\bookref[C1]{C1}
\by     B. Coomes
\title  Polynomial flows, symmetry groups, and conditions
        sufficient for injectivity of maps
\bookinfo Ph.D. thesis, Univ. Nebraska--Lincoln
\yr 1988
\endref

\paperref[C2]{C2}
\bysame % B. Coomes
\title   The Lorenz system does not have a polynomial flow
\jour    J. Differential Equations
\toappear
\endref

\paperref[GHMR]{GHMR}
\by     J. Guckenheimer, P. Holmes, M. Martineau, and L. P. Robinson
\title  Nonlinear oscillations, dynamical systems, and
        bifurcations of vector fields
\publ Springer-Verlag \publaddr New York
\yr 1983
\endref[.]

\end{thebibliography}
\end{verbatim}
\normalsize
produces the following output:
\begin{BOX}
\begin{thebibliography}{99}

\bookref{abc}
\by     V. I. Arnol$'$d, A. N. Varchenko, and S. M. Guse\u\i n-Zade
\title  Singularities of differentiable maps.~{\rm I}
\publ   ``Nauka'' \publaddr Moscow
\yr     1982
\lang   Russian
\endref

\bookref{def}
\bysame 
\title   Singularities of differentiable maps.~{\rm II}
\publ    ``Nauka'' \publaddr Moscow
\yr      1984
\lang    Russian
\endref

\bookref{ghi}
\by       O. A. Ladyzhenskaya
\title    Mathematical problems in the dynamics of a
          viscous incompressible fluid 
\bookinfo 2nd rev. aug. ed.
\publ     ``Nauka'' \publaddr Moscow
\yr       1970
\lang     Russian
\transl   English transl. of 1st ed.
\moreref{book}
\title    The mathematical theory of viscous
          incompressible flow
\publ     Gordon and Breach \publaddr New York
\yr       1963; rev. 1969
\endref

\bigskip

\paperref{bib:4}
\by       P. D. Lax and C. D. Levermore
\title    The small dispersion limit for the KdV equation.~{\rm I}
\jour     Comm. Pure Appl. Math. 
\vol 36   \yr 1983 \pages 253--290
\finalinfo (overview)
\moreref[, see also:]{paper}
\title    {\rm II}
\jour     Comm. Pure Appl. Math. 
\vol 36 \yr 1983 \pages 571--594
\moreref[, see also:]{paper}
\title    {\rm III}
\jour     Comm. Pure Appl. Math. 
\vol 36 \yr 1983 \pages 809--829
\endref

\paperref{bib:5}
\by        S. Osher
\title     Shock capturing algorithms for equations of mixed type
\inbook    Numerical Methods for Partial Differential Equations
\eds       S. I. Hariharan and T. H. Moulton
\publ Longman \publaddr New York \yr 1986 \pages 305--322
\endref

\paperref{bib:6}
\by        G. S. Petrov
\title     Elliptic integrals and their nonoscillatory behavior
\jour      Funktsional. Anal. i Pri\-lo\-zhen.
\vol 20 \yr 1986 \pages 46--49
\moreref{paper}
\transl English transl. in Functional Anal. Appl. \vol 20\yr 1986
\endref[.]


\end{thebibliography}

\refstyle{B}

\begin{thebibliography}{AAAA}

\bookref[C1]{C1}
\by     B. Coomes
\title  Polynomial flows, symmetry groups, and conditions
        sufficient for injectivity of maps
\bookinfo Ph.D. thesis, Univ. Nebraska--Lincoln
\yr 1988
\endref

\paperref[C2]{C2}
\bysame % B. Coomes
\title   The Lorenz system does not have a polynomial flow
\jour    J. Differential Equations
\toappear
\endref

\paperref[GHMR]{GHMR}
\by     J. Guckenheimer, P. Holmes, M. Martineau, and L. P. Robinson
\title  Nonlinear oscillations, dynamical systems, and
        bifurcations of vector fields
\publ Springer-Verlag \publaddr New York
\yr 1983
\endref[.]

\end{thebibliography}
\end{BOX}


\section{Changing the appearance}
You can change the default formats by the command
\begin{verbatim}

   \bibsetfmt[group name,item]{punctation}
                              {begin commands}
                              {end commands}

   for example
   
   \bibsetfmt[paper,by]{,}{\textit}{:}
   
\end{verbatim}
In this way you can change in an easy way the appearance of the
bibliography.

\section{Changing the order of the items}
The order or the items:
\begin{verbatim}

  for `paper' group:
  by,bysame,title,transl,jour,toappear,
  inbook,publ,eds,publaddr,vol,
  yr,pages,finalinfo,lang
  
  for `book' group:
  by,bysame,title,bookinfo,publ,publaddr,pages,yr,lang,transl
  
\end{verbatim}
can be changed defining the macro \verb+\paperlist+ and
\verb+\booklist+. For example in order to have the \verb+yr+ item 
displayed after \verb+pages+ item in the \verb+paper+ group define:
\begin{verbatim}

\def\paperlist{by,bysame,title,transl,jour,toappear,%
inbook,publ,eds,publaddr,vol,pages,yr,finalinfo,lang}

\end{verbatim}





\section{Citing}

\begin{BOX}
\begin{thebibliography}{AA}

\bookref{book:1}
\by     B. Coomes
\title  Polynomial flows, symmetry groups, and conditions
        sufficient for injectivity of maps
\bookinfo Ph.D. thesis, Univ. Nebraska--Lincoln
\yr 1988
\endref

\paperref{art:1}
\bysame % B. Coomes
\title   The Lorenz system does not have a polynomial flow
\jour    J. Differential Equations
\toappear
\endref

\paperref{art:2}
\by     J. Guckenheimer, P. Holmes, M. Martineau, and L. P. Robinson
\title  Nonlinear oscillations, dynamical systems, and
        bifurcations of vector fields
\publ Springer-Verlag \publaddr New York
\yr 1983
\endref[.]

\end{thebibliography}
\end{BOX}
the following code
\begin{verbatim}
    \citestyle{A}
    Cite mode A \cite{book:1,art:1,art:2}. \\
    \citestyle{B}
    Cite mode B \cite{book:1,art:1,art:2}. \\
    \citestyle{C}
    Cite mode C \cite{book:1,art:1,art:2}.
\end{verbatim}
produce the following output
\begin{BOX}
\citestyle{A}
Cite mode A \cite{book:1,art:1,art:2}. \\
\citestyle{B}
Cite mode B \cite{book:1,art:1,art:2}. \\
\citestyle{C}
Cite mode C \cite{book:1,art:1,art:2}.
\end{BOX}


\section{Defining new styles}
If you do not like the predefined styles \verb+paper+ and \verb+book+
you can easily define new ones. For example suppose you want to 
define a new style \verb+tales+ with the item \verb+\author+,
\verb+\title+ \verb+\year+ with:
\begin{enumerate}
\item \verb+\author+ in smallcaps style surrounded by a box
\item \verb+\title+ in italic style
\item \verb+\year+ in bold style  within \verb+(...)+
\end{enumerate}
you must follow the following steps
\begin{description}
\item[define the list of items] \ \\
\begin{verbatim}
    \def\taleslist{author,title,year}
\end{verbatim}
\item[define the command ``talesref'' with the items] \ \\
\begin{verbatim}
    \bibdefinestyles{tales}
\end{verbatim}
it defines the items \verb+\author+, \verb+\title+, \verb+\year+ with 
the default format and the command \verb+talesref+.
\item[change the default formatting] \ \\
\begin{verbatim}
   \bibsetfmt[tales,author]{,}
                           {\setbox0\hbox\bgroup\scshape}
                           {\egroup\fbox{\box0}}
   \bibsetfmt[tales,title]{}{\itshape}{}
   \bibsetfmt[tales,year]{}{\bfseries(}{)}
\end{verbatim}
\end{description}
The following example (which uses [definethebibliography])
shows the effect:
\begin{verbatim}

\begin{thebibliography}[Tales](\section*,1cm){99}
   \talesref{A}
      \author Isaac Asimov
      \title  Nemesis
      \year   1989
   \endref
   \talesref{B}
      \author Roger Zelazny
      \title  Nove principi in ambra
      \year   1970
   \endref
   \talesref{C}
      \author Dean R. Koontz
      \title  Strangers
      \year   1986
   \endref[.]
\end{thebibliography}

\end{verbatim}

\begin{BOX}
   \def\taleslist{author,title,year}
   \bibdefinestyles{tales}
   \bibsetfmt[tales,author]{,}{\setbox0\hbox\bgroup\scshape}
                              {\egroup\fbox{\box0}}
   \bibsetfmt[tales,title]{}{\itshape}{}
   \bibsetfmt[tales,year]{}{\bfseries(}{)}
\begin{thebibliography}[Tales](\section*,1cm){99}
   \talesref{A}
      \author Isaac Asimov
      \title  Nemesis
      \year   1989
   \endref
   \talesref{B}
      \author Roger Zelazny
      \title  Nove principi in ambra
      \year   1970
   \endref
   \talesref{C}
      \author Dean R. Koontz
      \title  Strangers
      \year   1986
   \endref[.]
\end{thebibliography}
\end{BOX}
\end{document}
