diff options
author | Karl Berry <karl@freefriends.org> | 2013-01-21 00:04:18 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2013-01-21 00:04:18 +0000 |
commit | 2bc4b75f9c1e05e394bbfc9c298b2506223b1451 (patch) | |
tree | 8655a714c8600f42180fee89b886ee6145742d60 /Master/texmf-dist/tex | |
parent | 57efe333991905d9fd5ba8ef1ee7ce110cdf4b83 (diff) |
sepfootnotes (19jan13)
git-svn-id: svn://tug.org/texlive/trunk@28885 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex')
-rw-r--r-- | Master/texmf-dist/tex/latex/sepfootnotes/sepfootnotes.sty | 195 |
1 files changed, 82 insertions, 113 deletions
diff --git a/Master/texmf-dist/tex/latex/sepfootnotes/sepfootnotes.sty b/Master/texmf-dist/tex/latex/sepfootnotes/sepfootnotes.sty index 2571daf0ee5..31e8be64fd4 100644 --- a/Master/texmf-dist/tex/latex/sepfootnotes/sepfootnotes.sty +++ b/Master/texmf-dist/tex/latex/sepfootnotes/sepfootnotes.sty @@ -1,12 +1,4 @@ -%% -%% 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 +%% Copyright (C) 2013 Eduardo C. Lourenço de Lima %% %% This work may be distributed and/or modified under the %% conditions of the LaTeX Project Public License, either @@ -19,111 +11,88 @@ %% 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}}} +\ProvidesPackage{sepfootnotes}[2013/01/17 v0.2 Footnotes in separate file] + +\newcommand\sep@packagename{sepfootnotes} + +% ********************************* Public ************************************ + +% ==================== shared by footnotes and endnotes ======================= + +\newcommand\sep@new [1] +{\newcounter{#1note}% + \expandafter\newcommand\csname #1note\endcsname [1] {\csname #1notemark\endcsname{##1}\csname #1notetext\endcsname{##1}}% + \expandafter\newcommand\csname #1notecontent\endcsname [2] {\sep@namedef {#1} {##1} {##2}}% + \expandafter\newcommand\csname print#1note\endcsname [1] {\sep@nameuse {#1} {##1}}% + \expandafter\newcommand\csname the#1mark\endcsname {\csname the#1note\endcsname}}% + +% -------------------------------- footnotes ---------------------------------- + +\newcommand\newfootnotes{\@ifstar\sep@newfootnotesfree\sep@newfootnotes} + +\newcommand\sep@newfootnotes [1] +{\sep@new{#1}% + \expandafter\renewcommand\csname #1note\endcsname [1] {\footnote {\csname print#1note\endcsname{##1}}}% + \expandafter\newcommand\csname #1notetext\endcsname [1] {\footnotetext {\csname print#1note\endcsname{##1}}}% + \expandafter\newcommand\csname #1notemark\endcsname [1] {\footnotemark}% + \expandafter\renewcommand\csname the#1mark\endcsname {\thefootnote}} + +\newcommand\sep@newfootnotesfree [1] +{\sep@new{#1}% + \expandafter\newcommand\csname #1notemark\endcsname [1] {\sep@mark {#1} {##1}}% + \expandafter\newcommand\csname #1notetext\endcsname [1] {\sep@markset {#1}\@footnotetext{\csname print#1note\endcsname {##1}}}} + +\newcommand\newsymbolfootnotes [2] [page] +{\newfootnotes* {#2}% + \@addtoreset {#2note} {#1}% + \expandafter\renewcommand\csname the#2mark\endcsname {\fnsymbol {#2note}}} + +% -------------------------------- endnotes ----------------------------------- + \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}} +{\sep@new {#1}% + \sep@openout {#1}% + \expandafter\newcommand\csname #1notemark\endcsname [1] {\sep@mark {#1} {##1}}% + \expandafter\newcommand\csname #1notetext\endcsname [1] {\sep@markset {#1}\sep@write {#1} {\expandafter\noexpand\csname do#1note\endcsname{\arabic{#1note}}{\unexpanded{##1}}}}% + \expandafter\newcommand\csname addto#1notes\endcsname [1] {\sep@write {#1} {\unexpanded{##1}}}% + \expandafter\newcommand\csname the#1notes\endcsname {\sep@close {#1}\setcounter {#1note} {0}\begin{#1notes}\input\sep@filename{#1}\end{#1notes}}% + \expandafter\newcommand\csname make#1mark\endcsname {\hbox{\normalfont\csname the#1mark\endcsname.\ }}% + \expandafter\newcommand\csname #1noteformat\endcsname {\noindent\rightskip\z@ \leftskip\z@ \leavevmode\llap{\csname make#1mark\endcsname}}% + \expandafter\newcommand\csname do#1note\endcsname [2] {\sep@refsetcounter{#1note}{##1}\par\csname #1noteformat\endcsname\csname print#1note\endcsname{##2}\par}% + \expandafter\newcommand\csname #1notesize\endcsname {\footnotesize} + \newenvironment {#1notes} {\csname #1notesize\endcsname\setlength\parskip\footnotesep} {}} + + +% ********************************* Private *********************************** + +% ---------------------------------- files ------------------------------------ + +\newcommand\sep@filename [1] {\jobname.ent-#1} +\newcommand\sep@openout [1] {\expandafter \newwrite\csname sep@fileout#1\endcsname\immediate\expandafter\openout\csname sep@fileout#1\endcsname=\sep@filename#1\relax} +\newcommand\sep@write [2] {\immediate \write\csname sep@fileout#1\endcsname {#2}}% +\newcommand\sep@close [1] {\immediate\expandafter\closeout\csname sep@fileout#1\endcsname\relax} + +% ---------------------------------- table ------------------------------------ + +\newcommand\sep@nameuse [2] {\@ifundefined{sepfootnotes@text@#1@#2} {} {\@nameuse{sepfootnotes@text@#1@#2}}} +\newcommand\sep@namedef [3] {\@ifundefined{sepfootnotes@text@#1@#2} {\@namedef{sepfootnotes@text@#1@#2}{#3}} {\PackageError {\sep@packagename} {`#2' is already in use} {The key `#2' already identifies a note content.\MessageBreak Solution: Use another key.}}} + +% ---------------------------------- marks ------------------------------------ + +\newcommand\sep@markset [1] {\protected@xdef\@thefnmark{\csname the#1mark\endcsname}} +\newcommand\sep@mark [2] {\stepcounter {#1note}\sep@markset {#1}\@footnotemark} + +% ---------------------- cross-references and counters ------------------------ + +\newcommand\sep@refsetcounter [2] {\setcounter{#1}{#2}\protected@edef\@currentlabel{\csname p@#1\endcsname\csname the#1\endcsname}} + +% ********************************* Default *********************************** + +% ------------------------- footnotes: \sepfootnote --------------------------- + +%% Default: The default \sepfootnote family relies on \footnote +\newfootnotes{sepfoot} + \endinput %% %% End of file `sepfootnotes.sty'. |