%%
%% This is file `opcit.sty',
%% generated with the docstrip utility.
%%
%% The original source files were:
%%
%% opcit.dtx  (with options: `package')
%% Part of the `opcit' project: bibliographical references as footnotes.
%% 
%% Copyright 2002 Federico Garcia
%% 
\NeedsTeXFormat{LaTeX2e}[1995/12/01]
\ProvidesPackage{opcit}[2002/12/25 Footnote references (Federico Garcia)]
\RequirePackage{xspace}
\newcommand{\opcit@bst}{opcit}
\DeclareOption*{\PackageInfo{opcit}{%
    `\CurrentOption' used as bibliography style}%
    \let\opcit@bst\CurrentOption}
\ProcessOptions
\newif\ifopcit@bbl\opcit@bblfalse
\newif\ifopcit@footnote\opcit@footnotefalse
\newif\ifperi@d\peri@dfalse
\newlength{\sameauthorsrule}\setlength{\sameauthorsrule}{23pt}
\newtoks\opcit@redefs
\newcommand{\newBibCommand}[3]{%
    \newcommand#1{#2}%
    \opcit@redefs\expandafter{\the\opcit@redefs%
        \renewcommand#1{#3}}}
\newcommand{\opcitstart}{\relax}
\newBibCommand{\opcitend}{\relax}{\ifnum\spacefactor=\sfcode`?\else.\fi}
\newBibCommand{\bibparenthesis[1]}{ (#1)}{. \newblock #1}
\newBibCommand{\bibIn}{in}{In}
\newBibCommand{\bibpunctuation}{%
    \ifnum\spacefactor=\sfcode`.\else,\fi\xspace}{%
    \ifnum\spacefactor=\sfcode`?\else.\fi\xspace}
\newcommand{\sameauthors}{\rule{\sameauthorsrule}{.4pt}}
\newBibCommand{\biblastnames[1]}{%
    \global\@namedef{\@curr@bibitem @authors}{#1}}{\relax}
\newBibCommand{\bibhereafter[1]}{%
    \global\@namedef{\@curr@bibitem @hereafter}{#1}}{\relax}
\newcommand{\last@cited}{)OpcitFirst(}
\newcommand{\opcittext}{Op.~Cit.}
\newcommand{\idemtext}{Idem}
\bibliographystyle{\opcit@bst}
\bgroup
    \renewenvironment{thebibliography}[1]{\relax}{\relax}
    \def\bibitem#1#2\opcitstart #3\bibpunctuation \newblock#4\opcitend{%
        \ifx#3\sameauthors\else\def\@lastauthors{#3}\fi
        \global\expandafter\edef\csname#1@author\endcsname{\@lastauthors}%
        \global\def\@curr@bibitem{#1}%
        \global\expandafter\def\csname#1\endcsname{\@nameuse{#1@author}, #4}%
        \global\@namedef{#1@star}{#4}%
        \bibhereafter{\opcittext}%
        #2}
    \InputIfFileExists{\jobname.bbl}{\global\opcit@bbltrue}%
        {\global\opcit@bblfalse\PackageWarningNoLine{opcit}{%
            No information found about bibliographical references.}}
\egroup
\ifopcit@bbl
\renewcommand{\cite}{\@ifstar{\opcit@cite@star}{\opcit@cite}}%
\newcommand{\opcit@cite}[2][.]{\nocite{#2}%
    \ifnum\interlinepenalty=\interfootnotelinepenalty\opcit@footnotetrue%
        \else\opcit@footnotefalse\expandafter\footnote\fi%
    {\@nameuse{#2}\ifx#1.\check@for@period{\@nameuse{#2}}%
        \else\check@for@period{#1}%
        {, #1}\fi%
        \ifopcit@footnote\peri@dtrue\fi%
        \ifperi@d\else.\fi}%
    \renew@cites{#2}}
\newcommand{\opcit@cite@star}[2][.]{\nocite{#2}%
    \ifnum\interlinepenalty=\interfootnotelinepenalty\opcit@footnotetrue%
        \else\opcit@footnotefalse\expandafter\footnote\fi%
    {\@nameuse{#2star}\ifx#1.\check@for@period{\@nameuse{#2}}%
        \else\check@for@period{#1}%
        {, #1}\fi%
        \ifopcit@footnote\peri@dtrue\fi%
        \ifperi@d\else.\fi}%
    \renew@cites{#2}}
\fi
\newcommand{\renew@cites}[1]{%
    \global\expandafter\edef\csname\last@cited\endcsname{%
        \@nameuse{\last@cited @authors},%
        ~{\noexpand\em\@nameuse{\last@cited @hereafter}}}%
    \global\expandafter\edef\csname\last@cited star\endcsname{%
        {\noexpand\em\@nameuse{\last@cited @hereafter}}}%
    \global\def\last@cited{#1}%
    \global\@namedef{#1}{{\em\idemtext}}%
    \global\@namedef{#1star}{{\em\@nameuse{#1@hereafter}}}%
    \global\def\hereafter{\@nameuse{#1@hereafter}}}
\def\check@for@period#1{{\normalsfcodes\setbox0\hbox{#1%
    \ifnum\spacefactor=\sfcode`.\global\peri@dtrue\else%
    \global\peri@dfalse\fi}}}
\let\opcit@bibliography\bibliography
\renewcommand{\bibliography}{\the\opcit@redefs\opcit@bibliography}
\newcommand{\thebib@renew}{}
\@ifclassloaded{article}{%
    \renewcommand{\thebib@renew}{\section*{\refname}\@mkboth{\refname}{\refname}}}{%
    \renewcommand{\thebib@renew}{\chapter*{\bibname}\@mkboth{\bibname}{\bibname}}}%
\renewenvironment{thebibliography}[1]
     {\thebib@renew%
      \the\opcit@redefs%
      \list{}%
           {\setlength\labelwidth{\z@}%
            \leftmargin\bibindent
            \itemindent -\bibindent
            \parsep \z@
            \@openbib@code
            \usecounter{enumiv}%
            \let\p@enumiv\@empty
            \renewcommand\theenumiv{\@arabic\c@enumiv}}%
      \sloppy
      \clubpenalty4000
      \@clubpenalty \clubpenalty
      \widowpenalty4000%
      \sfcode`\.\@m}
     {\def\@noitemerr
       {\@latex@warning{Empty `thebibliography' environment}}%
      \endlist}
\endinput
%%
%% End of file `opcit.sty'.
