%%
%% This is file `sepfootnotes.sty',
%% generated with the docstrip utility.
%%
%% The original source files were:
%%
%% sepfootnotes.dtx  (with options: `package')
%% 
%% Copyright (C) 2012 Eduardo C. Lourenço de Lima
%% 
%% This work may be distributed and/or modified under the
%% conditions of the LaTeX Project Public License, either
%% version 1.3 of this license or (at your option) any later
%% version.  The latest version of this license is in
%% 
%%   http://www.latex-project.org/lppl.txt
%% 
%% and version 1.3 or later is part of all distributions of LaTeX
%% version 2005/12/01 or later.
%% 
\NeedsTeXFormat{LaTeX2e}[1996/06/01]
\ProvidesPackage{sepfootnotes}[2012/03/06 v0.1 Footnotes in separate file]
\newcommand\@SFnNamespace{Notes@}
\newcommand\@SFnNew [1]{%
 \newcounter{#1}%
 \expandafter
 \newcommand\csname #1notecontent\endcsname [2]
 {\@SFnStoreText {#1} {##1} {##2}}%
 \expandafter
 \newcommand\csname #1noteref\endcsname [1]
 {\@SFnGetReference {#1} {##1}}%
 \expandafter
 \newcommand\csname #1nmark\endcsname
 {\csname the#1\endcsname}}%
\newcommand\newfootnotes [1]
 {\@SFnNew{#1}%
 \expandafter
 \newcommand\csname #1notemark\endcsname [1]
 {\@SFnInsertMark   {#1} {##1}}%
 \expandafter
 \newcommand\csname #1notetext\endcsname [1]
 {\@SFnSetMark     {#1}%
  \@SFnTypesetText {#1} {##1}}
 \expandafter
 \newcommand\csname #1note\endcsname [1]
 {\csname #1notemark\endcsname{##1}%
  \csname #1notetext\endcsname{##1}}}
\newcommand\newsymbolfootnotes [2][page]
 {\newfootnotes {#2}%
  \@addtoreset  {#2} {#1}%
  \expandafter
  \renewcommand\csname #2nmark\endcsname
  {\fnsymbol {#2}}}
\newcommand\newendnotes [1]
 {\@SFnNew         {#1}%
  \@SFnOpenFileOut {#1}%
 \expandafter
 \newcommand\csname #1notemark\endcsname [1]
 {\@SFnInsertMark    {#1} {##1}%
  \@SFnWriteToFile   {#1} {##1}}%
 \expandafter
 \newcommand\csname #1note\endcsname [1]
 {\csname #1notemark\endcsname {##1}}%
 \expandafter
 \newcommand\csname #1notetext\endcsname [1]
 {\csname #1endnotemark\endcsname
  {\@SFnGetReference {#1} {##1}}%
  \@SFnRetrieveText  {#1} {##1}\par}%
 \expandafter
 \newcommand\csname #1notes\endcsname
 {\@SFnCloseFile {#1}%
  \begin{#1endnotes}
  \input\@SFnFileName{#1}%
  \end{#1endnotes}}%
 \expandafter
 \newcommand\csname #1endnotemark\endcsname [1]
 {\noindent\makebox[0pt][r]{\mbox{{\normalfont ##1.\,}}}}
 \newenvironment{#1endnotes}
  {\footnotesize\setlength\parskip\footnotesep}
  {}}%
\newcommand\@SFnFileName [1]
 {\jobname.notes-#1}
\newcommand\@SFnOpenFileOut [1]
 {\expandafter\newwrite\csname @SFnFileOut#1\endcsname
  \immediate\expandafter\openout
  \csname @SFnFileOut#1\endcsname=\@SFnFileName#1\relax}
\newcommand\@SFnWriteToFile [2]
 {\immediate\write\csname @SFnFileOut#1\endcsname
  {\expandafter\string\csname #1notetext\endcsname
  {#2}}}%
\newcommand\@SFnCloseFile [1]
 {\immediate\expandafter
  \closeout\csname @SFnFileOut#1\endcsname\relax}
\newcommand\@SFnStoreText [3]
 {\@ifundefined{\@SFnNamespace text@#1@#2}
  {\@SFnNameDef {#1} {#2} {#3}}
  {\PackageError
   {\@SFnPackageName}
   {`#1' is already in use.}
   {The note identifier `#1' already identifies a piece of
    text.\MessageBreak Solution: Use another identifier.}}}
\newcommand\@SFnRetrieveText [2]
 {\@ifundefined{\@SFnNamespace text@#1@#2}
  {}
  {\@SFnNameUse {#1} {#2}}}
\newcommand\@SFnTypesetText [2]
 {\@footnotetext{\@SFnRetrieveText {#1} {#2}}}
\newcommand\@SFnInsertMark [2]
 {\@SFnStepCounter  {#1}%
  \@SFnSetReference {#1} {#2}%
  \@SFnSetMark      {#1}%
  \@SFnTypesetMark}
\newcommand\@SFnSetMark [1]
 {\protected@xdef\@thefnmark{\csname #1nmark\endcsname}}
\newcommand\@SFnTypesetMark
 {\@footnotemark}
\newcommand\@SFnSetReference [2]
 {\label{\@SFnNamespace refs@#1@#2}}
\newcommand\@SFnGetReference [2]
 {\ref{\@SFnNamespace   refs@#1@#2}}
\newcommand\@SFnStepCounter [1]
 {\refstepcounter{#1}}
\newcommand\@SFnNameDef [3]
 {\@namedef{\@SFnNamespace text@#1@#2}{#3}}
\newcommand\@SFnNameUse [2]
 {\@nameuse{\@SFnNamespace text@#1@#2}}
\endinput
%%
%% End of file `sepfootnotes.sty'.
