diff options
author | Norbert Preining <norbert@preining.info> | 2019-09-02 13:46:59 +0900 |
---|---|---|
committer | Norbert Preining <norbert@preining.info> | 2019-09-02 13:46:59 +0900 |
commit | e0c6872cf40896c7be36b11dcc744620f10adf1d (patch) | |
tree | 60335e10d2f4354b0674ec22d7b53f0f8abee672 /macros/latex/contrib/fixfoot |
Initial commit
Diffstat (limited to 'macros/latex/contrib/fixfoot')
-rw-r--r-- | macros/latex/contrib/fixfoot/README | 38 | ||||
-rw-r--r-- | macros/latex/contrib/fixfoot/fixfoot.pdf | bin | 0 -> 56191 bytes | |||
-rw-r--r-- | macros/latex/contrib/fixfoot/fixfoot.sty | 219 | ||||
-rw-r--r-- | macros/latex/contrib/fixfoot/fixfoot.tex | 49 | ||||
-rw-r--r-- | macros/latex/contrib/fixfoot/testfix.tex | 11 |
5 files changed, 317 insertions, 0 deletions
diff --git a/macros/latex/contrib/fixfoot/README b/macros/latex/contrib/fixfoot/README new file mode 100644 index 0000000000..a9e5a2b22b --- /dev/null +++ b/macros/latex/contrib/fixfoot/README @@ -0,0 +1,38 @@ +Notes on fixfoot.sty + +This is an experimental package that provides fixed footnotes; only +one instance of a fixed footnote will appear on any one page. (The +package is "experimental" because it's lacking at least one obvious +facility; no reports of problems in actual use have been received.) + +The package defines a single command, \DeclareFixedFootnote, which +takes an optional *, and two `ordinary' arguments. + +If the optional * is present, the command declared has an \xspace +command (from the xspace package) imbedded in it, so that spaces +following the fixed footnote in running text tend not to be lost. + +The first ordinary argument is a command name. +The second ordinary argument is the fixed text of the footnote. + +\DeclareFixedFootnote will then define the command to produce the +footnote, or to a link to an existing copy of the fixed footnote on +the same page. + +e.g., \DeclareFixedFootnote*{\sic}{\emph{sic}} + \DeclareFixedFootnote{\prooflater}{This theorem will be proved + later} + +The package works by exchanging information with itself via the .aux +file. Just as with labels (and per-page footnote numbers in +footmisc), the user ordinarily needs to run latex at least twice. + +The package does not (yet) have the ability to warn the user that +another run of latex is still necessary. Some evidence of user demand +would be necessary to encourage me to invest effort in getting LaTeX +to give that warning. + +Robin Fairbairns +afterthought, of 2009-07-20 + +$Id: README,v 1.2 2009/07/20 12:45:45 rf10 Exp rf10 $ diff --git a/macros/latex/contrib/fixfoot/fixfoot.pdf b/macros/latex/contrib/fixfoot/fixfoot.pdf Binary files differnew file mode 100644 index 0000000000..8e82ab05a5 --- /dev/null +++ b/macros/latex/contrib/fixfoot/fixfoot.pdf diff --git a/macros/latex/contrib/fixfoot/fixfoot.sty b/macros/latex/contrib/fixfoot/fixfoot.sty new file mode 100644 index 0000000000..1b66b7ff83 --- /dev/null +++ b/macros/latex/contrib/fixfoot/fixfoot.sty @@ -0,0 +1,219 @@ +\ProvidesPackage{fixfoot}[2007/12/12 v0.3a fixed-text footnotes] +% +% Author: Robin Fairbairns <rf10@cam.ac.uk> +% +% This program may be distributed and/or modified under the +% conditions of the LaTeX Project Public License, either version 1.1 +% 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.1 or later is part of all distributions of LaTeX +% version 1999/06/01 or later. +% +% This program consists of a package file fixfoot.sty and a test file +% testfix.tex +% +% this is an experimental package that provides fixed footnotes +% only one instance of a fixed footnote will appear on any one page +% +% the package defines a single command, \DeclareFixedFootnote, which +% takes an optional *, and two `ordinary' arguments. +% +% if the optional * is present, the command declared has an \xspace +% imbedded in it, so that spaces following it in running text tend not +% to be lost. +% +% the first ordinary argument is a cs name +% the second ordinary argument is the fixed text of the footnote +% +% e.g., \DeclareFixedFootnote*{\sic}{\emph{sic}} +% \DeclareFixedFootnote{\prooflater}{This theorem will be proved +% later} +% +% the package works by exchanging information with itself via the .aux +% file. just as with labels (and per-page footnote numbers in +% footmisc), the user ordinarily needs to run latex at least twice. +% this package does not (yet) have the ability to warn the user that +% another run of latex is still necessary (changing labels or footnote +% numbers in footmisc \emph{do} thus warn). +\newif\if@fftn@debug +\DeclareOption{debug}{\@fftn@debugtrue} +\ProcessOptions\relax +% +\newcommand\DeclareFixedFootnote{% + \@ifstar{\@declare@fftn\xspace}% + {\@declare@fftn\relax }% +} +% +% relay after detecting optional `|*|': +\newcommand\@declare@fftn[3]{% +% #1 \cs{xspace} (if `|*|' found) or \cs{relax} +% #2 footnote name, #3 footnote body +% +% extract the \csname bit of it... + \edef\reserved@a{\expandafter\@gobble\string#2}% + \@ifundefined\reserved@a + {\@declare@@fftn{#1}{#2}{#3}}% + {\@notdefinable}% +} +% +% finally, relayed command to do the actual job (same parameters as +% \cs{@declare@fftn}, which has simply checked that we're allowed to +% do this declaration) +\newcommand\@declare@@fftn[3]{% + \edef\reserved@a{\expandafter\@gobble\string#2}% +% +% the actual command + \protected@edef#2{\protect\@fixed@footnote{\reserved@a}% + {#1}{#3}}% +% +% define the fixed foot serial number and page counters + \@definecounter{@\reserved@a @fftn@serial}% + \@namedef{@\reserved@a @fftn@curpage}{moocow}% + \@namedef{@\reserved@a @fftn@scanpage}{baalamb}% + \@namedef{@\reserved@a @fftn@pagelim}{-1}% +% +% now the things we want executed at end document: + \protected@edef\@tempa{% + \expandafter\protect\csname @\reserved@a @fftn@aux\endcsname}% + \protected@edef\@tempb{% + \expandafter\protect\csname @\reserved@a @fftn@scanpage\endcsname}% +% +% Note that \cs{AtEndDocument} has global effect\dots + \begingroup + \let\protect\noexpand + \edef\@tempc{\noexpand\AtEndDocument{% + \fftn@clearpage + \noexpand\def\@tempa{% + \noexpand\@reprocess@fftn@mark{\reserved@a}}% + \noexpand\def\@tempb{oinkpig}}}% + \@tempc + \endgroup + \let\fftn@clearpage\@empty +}% +\def\fftn@clearpage{\noexpand\clearpage} +% +% Stick a dummy \cs{@process@fftn@mark} into the |.aux| file, in +% accordance with good practice for such things... +\AtBeginDocument{\immediate\write\@auxout{\noexpand\providecommand + \noexpand\@process@fftn@mark[3]{}}} +% +% \@reprocess@fftn@mark#1#2#3 will deal (when we've written it) with a +% fixed footnote mark in the .aux file at end document #1 footnote tag +% #2 serial number #3 actual page... (What should it do???) +% +% the fundamental fixed footnote command: +% the command \cs{}\meta{tag} which is supposed to generate a footnote +% containing \meta{body}, generates a call +% \@fixed@footnote\marg{tag}\marg{end-execution}\marg{body} +\def\@fixed@footnote#1#2#3{% +% #1 footnote tag +% #2 \xspace or \relax +% #3 footnote body +% +% count this footnote + \stepcounter{@#1@fftn@serial}% +% +% Is this serial beyond the limit of serial numbers destined for this +% page? + \if@fftn@debug + \message{footnote #1 serial \csname the@#1@fftn@serial\endcsname\space + existing limit \csname @#1@fftn@pagelim\endcsname;}% + \fi + \ifnum\csname @#1@fftn@pagelim\endcsname < + \csname c@@#1@fftn@serial\endcsname +% +% so here we're going to have to create a new footnote, but let's +% first find whether the |.aux| file scan at the start gave us a +% range of serial numbers to share it with us: + \expandafter\let\expandafter\@tempa + \csname @#1@fftn-\the\csname c@@#1@fftn@serial\endcsname\endcsname + \ifx\@tempa\relax + \if@fftn@debug + \message{footnote #1 no limit to inherit from .aux file;}% + \fi + \else + \if@fftn@debug + \message{footnote #1 limit \@tempa;}% + \fi +% +% record the information from the file + \global\expandafter\let\csname @#1@fftn@pagelim\endcsname\@tempa + \fi +% +% create the footnote and record its number (whether we're going to +% use it or not) + \footnote{#3}% + \expandafter\xdef\csname @#1@fftn@footnote\endcsname + {\the\c@footnote}% + \if@fftn@debug + \message{written new #1 footnote, number \the\c@footnote.}% + \fi +% +% if we're still on the same page as the previous footnote, create a +% mark only; note we can't use \cs{footnotemark} here, as it won't do +% the right thing if we're in a minipage (or anywhere where +% \cs{thempfn} isn't the same as \cs{thefootnote}). + \else + \protected@xdef\@thefnmark{\csname @#1@fftn@footnote\endcsname}% + \@footnotemark + \if@fftn@debug + \message{reusing #1 footnote \csname @#1@fftn@footnote\endcsname.}% + \fi + \fi +% +% record which page `this' footnote appeared in the |.aux| + \protected@writeaux\relax{\protect\@process@fftn@mark{#1}% + {\the\csname c@@#1@fftn@serial\endcsname}{\noexpand\thepage}}% +% +% and finally insert the `end-command' stuff (this can be \cs{xspace} +% or \cs{relax} if we're being called from a conventionally-defined +% fixed footnote command, but could be anything, really, one +% supposes!) + #2% + } +% +% \@process@fftn@mark#1#2#3 deals with a fixed footnote mark in +% the .aux file at begin document; +% arguments #1 footnote tag +% #2 serial number +% #3 actual page +\newcommand\@process@fftn@mark[3]{% + \if@fftn@debug + \message{fftn #1 #2 #3;}% + \fi + \def\@tempa{#3}% + \expandafter\ifx\csname @#1@fftn@scanpage\endcsname\@tempa + \if@fftn@debug + \message{on same page as previous;}% + \fi + \else +% +% well, we're no longer on whatever was last recorded as the page of a +% fixed footnote of this name -- record the serial + \expandafter\def\csname @#1@fftn@lastserial\endcsname{#2}% + \expandafter\let\csname @#1@fftn@scanpage\endcsname\@tempa + \fi +% +% + \if@fftn@debug + \message{setting limit for serial \csname @#1@fftn@lastserial\endcsname.}% + \fi + \expandafter\gdef\csname @#1@fftn-% + \csname @#1@fftn@lastserial\endcsname + \endcsname{#2}% +} +% +% \@reprocess@fftn@mark#1#2#3 deals with a fixed footnote mark in +% the .aux file at end document; arguments #1 footnote tag +% #2 serial number #3 actual page +\newcommand\@reprocess@fftn@mark[3]{}% pro tem +% +% use that when processing the .aux file at the end of the document +\AtEndDocument{\let\@process@fftn@mark\@reprocess@fftn@mark} +% +% this command originates in Matt Swift's inclusion stuff; I use it +% all over the place... +\providecommand\protected@writeaux{% + \protected@write\@auxout +} diff --git a/macros/latex/contrib/fixfoot/fixfoot.tex b/macros/latex/contrib/fixfoot/fixfoot.tex new file mode 100644 index 0000000000..af4add58bd --- /dev/null +++ b/macros/latex/contrib/fixfoot/fixfoot.tex @@ -0,0 +1,49 @@ +\documentclass[a4paper]{article} +\usepackage[dvips,a4paper]{geometry} +\providecommand\cs[1]{\texttt{\char`\\#1}} +\begin{document} +\title{The \texttt{fixfoot} package\thanks{This is version 0.3a, of + 2007-12-12}} +\author{Robin Fairbairns} +\maketitle + +\section{What is it for?} + +When editing an edition of my father's letters, after his death, I +found I was making the same comment, in footnotes, rather a lot. (For +example, he had a way of mis-spelling, or jumbling words for comic +effect; to point out that these \emph{weren't} transcription errors, I +marked them all with a footnoted ``\emph{Sic}''.) + +Since these footnotes made tedious reading at the best of times, and +since sometimes those ``sic'' footnotes appeared several times on one +page, I conceived the idea of this package: it ensures that a +particular (pre-declared) footnote will only appear once on any page. + +\section{Using the thing} + +The package defines only one command, \cs{DeclareFixedFootnote}; this +declares a footnote to be repeated. Apart from an optional +\texttt{*}, it takes two arguments: the command you'll use to call up +the footnote, and the text of each footnote generated. +If the optional \texttt{*} is present, the command you've created will +end with \cs{xspace}, so as to save you from the onerous business of +escaping the space after the footnote invocation. + +A couple of examples: +\begin{quote} +\begin{verbatim} +\DeclareFixedFootnote*{\sic}{\emph{sic}} +\DeclareFixedFootnote{\prooflater}{This theorem will be + proved later} +\end{verbatim} +\end{quote} + +\section{How does it do it?} + +The package works by exchanging information with itself, through the +medium of the \texttt{.aux} file (like labels, and per-page footnotes +in the \textsf{footmisc} package). I never got around to making it +tell you to re-run the document when you need to (as labels and those +per-page footnotes do). +\end{document} diff --git a/macros/latex/contrib/fixfoot/testfix.tex b/macros/latex/contrib/fixfoot/testfix.tex new file mode 100644 index 0000000000..95b6ca5e5d --- /dev/null +++ b/macros/latex/contrib/fixfoot/testfix.tex @@ -0,0 +1,11 @@ +\documentclass[a4paper]{article} +% test file for fixfoot.sty -- see that file for licence conditions +% first release to ctan 2000/02/09 +\usepackage{fixfoot} +\DeclareFixedFootnote{\blah}{blah di blah} +\begin{document} + \noindent here we are again\blah +\par\noindent happy as can be\blah +\clearpage\noindent all good friends\blah +\par\noindent and jolly good company\blah +\end{document} |