\ProvidesPackage{biblionote}

%%
%% biblionote.sty
%%
%% (c) Vincent Zoonekynd 1996
%%

%%
%% Je voulais des notes de bas de page dans la marge...
%%

\newinsert\biblio
%\dimen\biblio=\maxdimen % ?????????
\dimen\biblio=\vsize
\count\biblio=0
\skip\biblio=0pt
\newcounter{numerobiblio}
\renewcommand{\thenumerobiblio}{{(\arabic{numerobiblio})}}
\newcommand{\biblionotestyle}{\small}
\newcommand{\biblionoteskipamount}{\bigskipamount}
\newcommand{\biblionote}[1]
{\stepcounter{numerobiblio}%
  $^\thenumerobiblio$%
  \insert\biblio{%
    \vskip \biblionoteskipamount
    \noindent\parbox{\marginparwidth}{%
      \parindent=0pt
      \biblionotestyle
      $^\thenumerobiblio$ #1}}}


%% Il faut jouer avec \output...

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%% A FAIRE : Utiliser \@thehead plutôt que \@outputpage...
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\def\@outputpage{%
  \let \protect \noexpand 
  \shipout \vbox {%
    \set@typeset@protect
    \aftergroup \set@typeset@protect \@shipoutsetup 
    \@begindvi 
    \vskip\topmargin 
    \moveright \@themargin 
    \vbox {%
      \setbox \@tempboxa 
      \vbox to\headheight {%
        \vfil \color@hbox \normalcolor \hbox to\textwidth
        {%
          \let \label \@gobble 
          \let \index \@gobble 
          \let \glossary \@gobble 
          \@thehead 
          }%
        \color@endbox 
        }%
      \dp \@tempboxa \z@ \box\@tempboxa 
      \vskip \headsep \box \@outputbox 
      %
        %%%%%% \begin{MODIF} %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
      \rlap{\hbox{\hspace{\hsize}%
          \vbox to 0pt{%
            \vss
            \ifvoid\biblio\else
            \hbox{%
              \hspace{\marginparsep}%
              \hspace{-3.2pt}\vrule width 0.4pt\hspace{2.8pt}%
              \vbox{%
                \vskip -\biblionoteskipamount
                \box\biblio}}%
            \fi
            }}}%
        %%%%%% \end{MODIF} %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
      %
      \baselineskip
      \footskip \color@hbox \normalcolor 
      \hbox to\textwidth {%
        \let \label \@gobble 
        \let \index \@gobble 
        \let \glossary \@gobble 
        \@thefoot
        }%
      \color@endbox 
      }}%
  \global \@colht \textheight \stepcounter{page}
  \let \firstmark \botmark 
}

\def\@outputpage{%
\begingroup           % the \endgroup is put in by \aftergroup
  \let \protect \noexpand
  \@resetactivechars
  \let\-\@dischyph
  \let\'\@acci\let\`\@accii\let\=\@acciii
  \let\\\@normalcr
  \let\par\@@par          %% 15 Sep 87
  \shipout \vbox{%
    \set@typeset@protect
    \aftergroup \endgroup
    \aftergroup \set@typeset@protect
                                % correct? or just restore by ending
                                % the group?
  \if@specialpage
    \global\@specialpagefalse\@nameuse{ps@\@specialstyle}%
  \fi
  \if@twoside
    \ifodd\count\z@ \let\@thehead\@oddhead \let\@thefoot\@oddfoot
         \let\@themargin\oddsidemargin
    \else \let\@thehead\@evenhead
       \let\@thefoot\@evenfoot \let\@themargin\evensidemargin
    \fi
  \fi
  \reset@font 
  \normalsize
  \baselineskip\z@skip \lineskip\z@skip \lineskiplimit\z@
    \@begindvi
    \vskip \topmargin
    \moveright\@themargin \vbox {%
      \setbox\@tempboxa \vbox to\headheight{%
        \vfil
        \color@hbox
          \normalcolor
          \hb@xt@\textwidth {%
            \let \label \@gobble
            \let \index \@gobble
            \let \glossary \@gobble %% 21 Jun 91
            \@thehead
            }%
        \color@endbox
        }%                        %% 22 Feb 87
      \dp\@tempboxa \z@
      \box\@tempboxa
      \vskip \headsep
      \box\@outputbox
      %
        %%%%%% \begin{MODIF} %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
      \rlap{\hbox{\hspace{\hsize}%
          \vbox to 0pt{%
            \vss
            \ifvoid\biblio\else
            \hbox{%
              \hspace{\marginparsep}%
              \hspace{-3.2pt}\vrule width 0.4pt\hspace{2.8pt}%
              \vbox{%
                \vskip -\biblionoteskipamount
                \box\biblio}}%
            \fi
            }}}%
        %%%%%% \end{MODIF} %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
      %
      \baselineskip \footskip
      \color@hbox
        \normalcolor
        \hb@xt@\textwidth{%
          \let \label \@gobble
          \let \index \@gobble      %% 22 Feb 87
          \let \glossary \@gobble   %% 21 Jun 91
          \@thefoot
          }%
      \color@endbox
      }%
    }%
\global \@colht \textheight
\stepcounter{page}%
\let\firstmark\botmark
}
