From e0c6872cf40896c7be36b11dcc744620f10adf1d Mon Sep 17 00:00:00 2001
From: Norbert Preining <norbert@preining.info>
Date: Mon, 2 Sep 2019 13:46:59 +0900
Subject: Initial commit

---
 macros/latex/contrib/savefnmark/savefnmark.dtx | 302 +++++++++++++++++++++++++
 1 file changed, 302 insertions(+)
 create mode 100644 macros/latex/contrib/savefnmark/savefnmark.dtx

(limited to 'macros/latex/contrib/savefnmark/savefnmark.dtx')

diff --git a/macros/latex/contrib/savefnmark/savefnmark.dtx b/macros/latex/contrib/savefnmark/savefnmark.dtx
new file mode 100644
index 0000000000..765c4a3731
--- /dev/null
+++ b/macros/latex/contrib/savefnmark/savefnmark.dtx
@@ -0,0 +1,302 @@
+% \iffalse meta-comment
+% %%----------------------------------------------------------------------------
+%
+%% File: savefnmark.dtx Copyright (C) 2000 Volker Kuhlmann
+%% All rights are reserved.
+%%
+%
+%<*dtx>
+        \NeedsTeXFormat{LaTeX2e}[1999/06/01]
+        \ProvidesFile{savefnmark.dtx}
+%</dtx>
+%<package|maindoc>\NeedsTeXFormat{LaTeX2e}[1998/06/01]
+%<package>\ProvidesPackage{savefnmark}
+%<driver> \ProvidesFile{savefnmark.drv}
+%<maindoc>\ProvidesFile{savefnmark.tex}
+%
+% \fi
+%         \ProvidesFile{savefnmark.dtx}
+       [2000/05/11 v1.0 save footnote marks for multiple use (VK)]
+%
+%%
+%% \CharacterTable
+%%  {Upper-case    \A\B\C\D\E\F\G\H\I\J\K\L\M\N\O\P\Q\R\S\T\U\V\W\X\Y\Z
+%%   Lower-case    \a\b\c\d\e\f\g\h\i\j\k\l\m\n\o\p\q\r\s\t\u\v\w\x\y\z
+%%   Digits        \0\1\2\3\4\5\6\7\8\9
+%%   Exclamation   \!     Double quote  \"     Hash (number) \#
+%%   Dollar        \$     Percent       \%     Ampersand     \&
+%%   Acute accent  \'     Left paren    \(     Right paren   \)
+%%   Asterisk      \*     Plus          \+     Comma         \,
+%%   Minus         \-     Point         \.     Solidus       \/
+%%   Colon         \:     Semicolon     \;     Less than     \<
+%%   Equals        \=     Greater than  \>     Question mark \?
+%%   Commercial at \@     Left bracket  \[     Backslash     \\
+%%   Right bracket \]     Circumflex    \^     Underscore    \_
+%%   Grave accent  \`     Left brace    \{     Vertical bar  \|
+%%   Right brace   \}     Tilde         \~}
+%%
+%
+% \iffalse
+%<*driver>
+
+\NeedsTeXFormat{LaTeX2e}[1999/06/01]
+\documentclass{ltxdoc}
+%%\IfFileExists{ltxdoc.cfg}{}{\OnlyDescription\RecordChanges\CodelineIndex}
+
+ %\OnlyDescription                  % uncomment to suppress code line listing
+ \RecordChanges                    % uncomment for a change history
+ %\CodelineIndex\EnableCrossrefs    % uncomment for command index
+\GetFileInfo{savefnmark.dtx}
+
+\usepackage{savefnmark}
+
+\begin{document}
+\DocInput{savefnmark.dtx}
+%%\IfFileExists{ltxdoc.cfg}{}{\PrintChanges\PrintIndex}
+ \PrintChanges                     % uncomment for a change history
+ %\PrintIndex                       % uncomment for command index
+\end{document}
+
+%</driver>
+% \fi
+%
+%
+% \GetFileInfo{savefnmark.dtx}
+% \CheckSum{30}
+%
+% \title{The \textsf{savefnmark} Package\thanks
+%        {This file has version number \fileversion,
+%         last modified \filedate.}}
+% \author{Volker Kuhlmann\thanks{%^^A
+%         Email:\ \url{v.kuhlmann@elec.canterbury.ac.nz}.
+%   	  For a postal address refer to the license section.}}
+% \date{\filedate}
+%
+%
+% %^^A  MACROS used for this document
+% \let\package\textsf
+% \let\env\textsf
+% \let\url\texttt
+% \newcommand\optmeta[1]{[\meta{#1}]}
+% \providecommand\MF{\textsc{meta-font}}
+% \providecommand\fixendverbatim{\vspace{-\bigskipamount}}
+% \newenvironment{pckcmd}{%^^A
+%   \ifvmode \else \par\vspace{-\parskip}\fi
+%   \vspace{1mm}\noindent \hangindent 4em\hangafter 0\ignorespaces
+%   }{%^^A
+%   \par\vspace{1mm}\vspace{-\parskip}}
+% \renewenvironment{quote}{%
+%   \list{}{\leftmargin=0.5\leftmargin\rightmargin\leftmargin}\item\relax
+%   }{%
+%   \endlist
+%   }
+% \makeatletter
+% \providecommand\DescribeWord[1]{%
+%   \leavevmode\@bsphack
+%   \marginpar{\raggedleft\PrintDescribeEnv{#1}}%^^A
+%   \@bsphack\index{#1\actualchar{\protect\ttfamily#1}\encapchar usage}\@esphack
+%   \@esphack\ignorespaces
+%   }
+% \makeatother
+%
+% \changes{v1.0}{2000/05/10}
+%   {Initial version.}
+%
+%
+%
+% \maketitle
+%
+% \begin{abstract}
+% Sometimes the same footnote applies to more than one location in a table. With
+% this package the mark of a footnote can be saved into a name, and re-used
+% subsequently without creating another footnote at the bottom.
+% \end{abstract}
+%
+% \tableofcontents
+%
+%
+% \section{License}
+%
+% This package is copyright \textcopyright\ 2000 by:
+%
+% \begin{quote}
+%   Volker Kuhlmann,
+%   c/o University of Canterbury,
+%   ELEC Dept, Creyke Road,
+%   Christchurch, New Zealand\\
+%   E-Mail: \url{v.kuhlmann@elec.canterbury.ac.nz}
+% \end{quote}
+%
+%     This program is free software; you can redistribute it and/or modify
+%     it under the terms of the GNU General Public License as published by
+%     the Free Software Foundation; either version 2 of the License, or
+%     (at your option) any later version.
+%
+% To obtain a copy of the license, write to the
+% Free Software Foundation, Inc.,
+% 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA,
+% or browse \url{http://www.fsf.org/}.
+%
+%
+% \section{Introduction}
+%
+% Sometimes the same footnote applies to more than one location in a table. With
+% this package the mark of a footnote can be saved into a name, and re-used
+% subsequently without creating another footnote at the bottom.
+% 
+% This even works between tables (in minipages) and footnotes in surrounding
+% text. The appearance of the footnote mark is kept, that is when a footnote of
+% a previous table is mentioned in the text following the table, the mark looks
+% the same as it does in the table.
+% 
+% The footnote marks are saved globally into a given control sequence. This
+% control sequence must not have already been used and is defined for the whole
+% of the document.
+% 
+% \pagebreak
+%
+% Currently forward references are not possible. In other words footnotes which
+% appear later in the text can't be referenced.
+%
+% \DescribeMacro{\saveFN}
+% The following two commands are defined by this package:
+% 
+% \begin{pckcmd}
+%     |\saveFN{|\meta{name}|}|
+% \end{pckcmd}
+% 
+% saves the number of the footnote which was last introduced into \meta{name}.
+% \meta{name} can be any valid control sequence not already used.
+%
+% \DescribeMacro{\useFN}
+% To place the same footnote mark again later in the text, use
+% 
+% \begin{pckcmd}
+%     |\useFN{|\meta{name}|}|
+% \end{pckcmd}
+%
+%
+% \section{Example}
+%
+% The following example is produced with this input:
+% 
+% %^^A************************************************************************
+% \begingroup
+% \small
+% \begin{verbatim}
+% Surrounding text before the minipage with table.
+% text text text\footnote{footnote 1 in text} text
+% text\footnote{footnote 2 in text; also in table}\saveFN\sft\ text text text 
+% 
+% \begin{minipage}{\textwidth}
+% \begin{tabular}{lll}
+% abc
+%         &abc abc abc\footnote{footnote 1}\saveFN\sfn    
+%                 &abc\\
+% abc abc abc
+%         &abc abcdef efgh\footnote{footnote 2} abc
+%                 &same mark as first\useFN\sfn\ footnote\\
+% www\footnote{footnote 3}
+%         &mark as text\useFN\sft\ footnote 
+%                 &abc\\
+% \end{tabular}
+% \end{minipage}
+% 
+% Surrounding text after the minipage with table.
+% text text text\footnote{footnote 3 in text} text text text 
+% \end{verbatim}
+% \fixendverbatim
+% \endgroup
+% %^^A************************************************************************
+% 
+% \parskip	2.5ex
+% \parindent	0em
+% 
+% Surrounding text before the minipage with table.
+% text text text\footnote{footnote 1 in text} text
+% text\footnote{footnote 2 in text; also in table}\saveFN\sft\ text text text 
+% 
+% \begin{minipage}{\textwidth}
+% \begin{tabular}{lll}
+% abc
+% 	&abc abc abc\footnote{footnote 1}\saveFN\sfn	
+% 		&abc\\
+% abc abc abc
+% 	&abc abcdef efgh\footnote{footnote 2} abc
+% 		&same mark as first\useFN\sfn\ footnote\\
+% www\footnote{footnote 3}
+% 	&mark as text\useFN\sft\ footnote 
+% 		&abc\\
+% \end{tabular}
+% \end{minipage}
+% 
+% Surrounding text after the minipage with table.
+% text text text\footnote{footnote 3 in text} text text text 
+% 
+%
+% \section{To Do and Bugs}
+% 
+% Any bugs?
+% 
+% Is it worth implementing a forward reference capability?
+%
+%
+% %^^A This command extracts all index entries:
+% %^^A sed < savefnmark.idx -e 's,indexentry{,,' -e 's,=.*$,,'
+%
+% \DoNotIndex{\ ,\.,\_}%^^A  DOES NOT WORK!!
+% \DoNotIndex{\@footnotetext,\@mpfn,\@xfootnote,\begingroup,\csname,\def}
+% \DoNotIndex{\endcsname,\endgroup,\expandafter,\let,\newcommand,\noexpand}
+% \DoNotIndex{\relax,\show,\the,\thempfn,\xdef}
+%
+% \StopEventually{}
+%
+%
+%
+% \section{Implementation}
+%
+%
+%    \begin{macrocode}
+%<*package>
+%    \end{macrocode}
+%
+% \begin{macro}{\saveFN}
+% First part: save the footnote number and whether it was a normal footnote or
+% one from inside a minipage. We test first whether the control sequence to save
+% it in is already defined.
+%
+%    \begin{macrocode}
+\newcommand\saveFN[1]{%
+    \newcommand{#1}{}%
+    \xdef#1{\noexpand\@useFN{\@mpfn}{\the\csname c@\@mpfn\endcsname}}%
+    %\show#1%
+}
+%    \end{macrocode}
+% \end{macro}
+% 
+% \begin{macro}{\useFN}
+% Start a new group and temporarily disable the creation of the footnote text by
+% \cs{@xfootnote}, then run the command defined when saving the mark. This
+% restores the footnote type and its number, then prints the corresponding mark.
+%
+%    \begin{macrocode}
+\newcommand\useFN[1]{\begingroup\let\@footnotetext\relax#1\endgroup}
+\newcommand\@useFN[2]{%
+    \def\@mpfn{#1}%
+    \expandafter\let\expandafter\thempfn\csname the#1\endcsname
+    \@xfootnote[#2]%
+}
+%    \end{macrocode}
+% \end{macro}
+%
+%    \begin{macrocode}
+%</package>
+%    \end{macrocode}
+%
+%
+% \Finale
+%
+% \iffalse
+% %% EOF savefnmark.dtx
+% %%----------------------------------------------------------------------------
+% \fi
-- 
cgit v1.2.3

