summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/latex/sepfootnotes/sepfootnotes.sty
blob: 2571daf0ee519c990e0563af76a0107ea72a011c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
%%
%% 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'.