diff options
Diffstat (limited to 'macros/latex/contrib/sepfootnotes/sepfootnotes.sty')
-rw-r--r-- | macros/latex/contrib/sepfootnotes/sepfootnotes.sty | 132 |
1 files changed, 95 insertions, 37 deletions
diff --git a/macros/latex/contrib/sepfootnotes/sepfootnotes.sty b/macros/latex/contrib/sepfootnotes/sepfootnotes.sty index d953d30022..f99b9770c0 100644 --- a/macros/latex/contrib/sepfootnotes/sepfootnotes.sty +++ b/macros/latex/contrib/sepfootnotes/sepfootnotes.sty @@ -1,4 +1,4 @@ -%% Copyright (C) 2013-2016 Eduardo C. Lourenço de Lima +%% Copyright (C) 2013-2024 Eduardo C. Lourenço de Lima %% %% This work may be distributed and/or modified under the %% conditions of the LaTeX Project Public License, either @@ -11,19 +11,23 @@ %% version 2005/12/01 or later. %% \NeedsTeXFormat {LaTeX2e} [1996/06/01] -\ProvidesPackage {sepfootnotes} [2016/07/18 v0.3c Footnotes in separate file] +\ProvidesPackage {sepfootnotes} [2024/07/05 v0.3d Footnotes in separate file] \newcommand\sep@packagename{sepfootnotes} +%{% options + \DeclareOption {quiet} {\sep@opt@quiettrue} \DeclareOption {warn} {\sep@opt@warntrue} \DeclareOption {error} {\sep@opt@errortrue} \DeclareOption {global} {\sep@opt@globaltrue} +\DeclareOption {after} {\sep@opt@aftertrue} \newif \ifsep@opt@quiet \newif \ifsep@opt@warn \newif \ifsep@opt@error \newif \ifsep@opt@global +\newif \ifsep@opt@after \sep@opt@warntrue @@ -38,10 +42,10 @@ \sep@opt@warnfalse \fi +%}% +%{% public -% ********************************* Public ************************************ - -% ==================== shared by footnotes and endnotes ======================= +%{% footnotes and endnotes \newcommand\sep@new [1] {\newcounter{#1note}% @@ -52,7 +56,8 @@ \expandafter\newcommand\csname #1quicknote\endcsname [1] {\sep@namereplace {#1} {sepfootnotes@tmp@quick} {##1}\csname #1note\endcsname{sepfootnotes@tmp@quick}}\relax } -% -------------------------------- footnotes ---------------------------------- +%}% +%{% footnotes \newcommand\newfootnotes{\@ifstar\sep@newfootnotesfree\sep@newfootnotes} @@ -73,7 +78,8 @@ \@addtoreset {#2note} {#1}% \expandafter\renewcommand\csname the#2mark\endcsname {\fnsymbol {#2note}}} -% -------------------------------- endnotes ----------------------------------- +%}% +%{% endnotes \newcommand\newendnotes [1] {\sep@new {#1}% @@ -88,8 +94,8 @@ \expandafter\newcommand\csname #1notesize\endcsname {\footnotesize}% \newenvironment {#1notes} {\csname #1notesize\endcsname\setlength\parskip\footnotesep} {}} - -% ------------------------------ commentnotes -------------------------------- +%}% +%{% commentnotes \newcommand\newcommentnotes [1] {\newfootnotes*{#1}\relax @@ -107,62 +113,114 @@ \@addtoreset {#2note} {#1}\relax \expandafter\renewcommand\csname the#2mark\endcsname {\fnsymbol {#2note}}} -% ********************************* Private *********************************** +%}% + +%}% +%{% private -% ---------------------------------- files ------------------------------------ +%{% 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 ------------------------------------ +%}% +%{% names + +%{% \sep@nameuse <prefix> <key> \newcommand\sep@nameuse [2] {\@ifundefined{sepfootnotes@text@#1@#2} - {\ifsep@opt@error - \PackageError {\sep@packagename} {`#2' has not been assigned a content} - {`#2' has not been assigned a content.\MessageBreak - Solution: Define `#2'\MessageBreak - Try: \@backslashchar #1notecontent{#2}{<content>}}\relax - \fi - \ifsep@opt@warn - \PackageWarning {\sep@packagename} {`#2' has not been assigned a content}\relax - \fi} + {\sep@warning@undefined{#1}{#2}} {\@nameuse{sepfootnotes@text@#1@#2}}} +%}% +%{% \sep@namedef <prefix> <key> <content> + \newcommand\sep@namedef [3] -{\@ifundefined{sepfootnotes@text@#1@#2} +{\ifsep@opt@after\sep@namereplace{#1}{#2}{#3}\else + \@ifundefined{sepfootnotes@text@#1@#2} {\ifsep@opt@global\global\fi\@namedef{sepfootnotes@text@#1@#2}{#3}} - {\ifsep@opt@error - \PackageError {\sep@packagename} {`#2' is already in use} - {`#2' is already in use.\MessageBreak - Solution: Use another key.\MessageBreak - Try: \@backslashchar #1notecontent{<key>}{<content>}}\relax - \fi - \ifsep@opt@warn - \PackageWarning {\sep@packagename} {`#2' is already in use} - \fi}} + {\sep@warning@already{#1}{#2}}\fi} + +%}% +%{% \sep@namereplace <prefix> <key> <content> + +\newcommand\sep@namereplace [3] +{% + \ifsep@opt@after + \global\@namedef{sepfootnotes@text@#1@#2}{#3}% + \write\@auxout{\expandafter\unexpanded\expandafter{\global\@namedef {sepfootnotes@text@#1@#2}{#3}}}% + \else + \ifsep@opt@global\global\fi\@namedef{sepfootnotes@text@#1@#2}{#3}% + \fi +} + +%}% + +%{% \sep@warning@undefined <prefix> <key> + +\newcommand \sep@warning@undefined [2] +{\ifsep@opt@error + \PackageError + {\sep@packagename} + {`#2' has not been assigned a content} + {`#2' has not been assigned a content.\MessageBreak + Solution: Define `#2'\MessageBreak + Try: \@backslashchar #1notecontent{#2}{<content>}}% + \fi + \ifsep@opt@warn + \PackageWarning + {\sep@packagename} + {`#2' has not been assigned a content}% + \fi +} -\newcommand\sep@namereplace [3] {\ifsep@opt@global\global\fi\@namedef{sepfootnotes@text@#1@#2}{#3}} +%}% +%{% \sep@warning@already <prefix> <key> + +\newcommand \sep@warning@already [2] +{\ifsep@opt@error + \PackageError + {\sep@packagename} + {`#2' is already in use} + {`#2' is already in use.\MessageBreak + Solution: Use another key.\MessageBreak + Try: \@backslashchar #1notecontent{<key>}{<content>}}% + \fi + \ifsep@opt@warn + \PackageWarning + {\sep@packagename} + {`#2' is already in use}% + \fi +} -% ---------------------------------- marks ------------------------------------ +%}% + +%}% +%{% 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 ------------------------ +%}% +%{% cross-references and counters \newcommand\sep@refsetcounter [2] {\setcounter{#1}{#2}\protected@edef\@currentlabel{\csname p@#1\endcsname\csname the#1\endcsname}} \newcommand\sep@refstepcounter [1] {\stepcounter {#1}\protected@edef\@currentlabel{\csname p@#1\endcsname\csname the#1\endcsname}} -% ********************************* Default *********************************** +%}% + +%}% +%{% default -% ------------------------- footnotes: \sepfootnote --------------------------- +%% The default \sepfootnote apparatus relies on \footnote -%% Default: The default \sepfootnote family relies on \footnote \newfootnotes{sepfoot} +%}% + \endinput %% %% End of file `sepfootnotes.sty'. |