From 101b8dbc25eea15d8e82c6a3aa17c1fcea572759 Mon Sep 17 00:00:00 2001 From: Karl Berry Date: Thu, 3 Nov 2011 18:20:24 +0000 Subject: new latex package tablefootnote (29oct11) git-svn-id: svn://tug.org/texlive/trunk@24478 c570f23f-e606-0410-a88d-b1316a301751 --- .../source/latex/tablefootnote/tablefootnote.dtx | 1242 ++++++++++++++++++++ 1 file changed, 1242 insertions(+) create mode 100644 Master/texmf-dist/source/latex/tablefootnote/tablefootnote.dtx (limited to 'Master/texmf-dist/source/latex/tablefootnote/tablefootnote.dtx') diff --git a/Master/texmf-dist/source/latex/tablefootnote/tablefootnote.dtx b/Master/texmf-dist/source/latex/tablefootnote/tablefootnote.dtx new file mode 100644 index 00000000000..07aef892a08 --- /dev/null +++ b/Master/texmf-dist/source/latex/tablefootnote/tablefootnote.dtx @@ -0,0 +1,1242 @@ +% \iffalse meta-comment +% +% File: tablefootnote.dtx +% Version: 2011/10/29 v1.0b +% +% Copyright (C) 2011 by +% H.-Martin M"unch +% +% This work may be distributed and/or modified under the +% conditions of the LaTeX Project Public License, either +% version 1.3c of this license or (at your option) any later +% version. This version of this license is in +% http://www.latex-project.org/lppl/lppl-1-3c.txt +% and the latest version of this license is in +% http://www.latex-project.org/lppl.txt +% and version 1.3c or later is part of all distributions of +% LaTeX version 2005/12/01 or later. +% +% This work has the LPPL maintenance status "maintained". +% +% The Current Maintainer of this work is H.-Martin Muench. +% +% This work consists of the main source file tablefootnote.dtx, +% the README, and the derived files +% tablefootnote.sty, tablefootnote.pdf, +% tablefootnote.ins, tablefootnote.drv, +% tablefootnote-example.tex, tablefootnote-example.pdf. +% +% Distribution: +% CTAN:macros/latex/contrib/tablefootnote/tablefootnote.dtx +% CTAN:macros/latex/contrib/tablefootnote/tablefootnote.pdf +% CTAN:install/macros/latex/contrib/tablefootnote.tds.zip +% +% Cf. http://ctan.org/pkg/tablefootnote and +% http://www.tex.ac.uk/tex-archive/help/Catalogue/entries/tablefootnote.html +% +% Unpacking: +% (a) If tablefootnote.ins is present: +% tex tablefootnote.ins +% (b) Without tablefootnote.ins: +% tex tablefootnote.dtx +% (c) If you insist on using LaTeX +% latex \let\install=y\input{tablefootnote.dtx} +% (quote the arguments according to the demands of your shell) +% +% Documentation: +% (a) If tablefootnote.drv is present: +% (pdf)latex tablefootnote.drv +% makeindex -s gind.ist tablefootnote.idx +% (pdf)latex tablefootnote.drv +% makeindex -s gind.ist tablefootnote.idx +% (pdf)latex tablefootnote.drv +% (b) Without tablefootnote.drv: +% (pdf)latex tablefootnote.dtx +% makeindex -s gind.ist tablefootnote.idx +% (pdf)latex tablefootnote.dtx +% makeindex -s gind.ist tablefootnote.idx +% (pdf)latex tablefootnote.dtx +% +% The class ltxdoc loads the configuration file ltxdoc.cfg +% if available. Here you can specify further options, e.g. +% use DIN A4 as paper format: +% \PassOptionsToClass{a4paper}{article} +% +% Installation: +% TDS:tex/latex/tablefootnote/tablefootnote.sty +% TDS:doc/latex/tablefootnote/tablefootnote.pdf +% TDS:doc/latex/tablefootnote/tablefootnote-example.tex +% TDS:doc/latex/tablefootnote/tablefootnote-example.pdf +% TDS:source/latex/tablefootnote/tablefootnote.dtx +% +%<*ignore> +\begingroup + \catcode123=1 % + \catcode125=2 % + \def\x{LaTeX2e}% +\expandafter\endgroup +\ifcase 0\ifx\install y1\fi\expandafter + \ifx\csname processbatchFile\endcsname\relax\else1\fi + \ifx\fmtname\x\else 1\fi\relax +\else\csname fi\endcsname +% +%<*install> +\input docstrip.tex +\Msg{******************************************************************} +\Msg{* Installation *} +\Msg{* Package: tablefootnote 2011/10/29 v1.0b Table foot notes (HMM) *} +\Msg{******************************************************************} + +\keepsilent +\askforoverwritefalse + +\let\MetaPrefix\relax +\preamble + +This is a generated file. + +Project: tablefootnote +Version: 2011/10/29 v1.0b + +Copyright (C) 2011 by + H.-Martin M"unch + +The usual disclaimer applys: +If it doesn't work right that's your problem. +(Nevertheless, send an e-mail to the maintainer + when you find an error in this package.) + +This work may be distributed and/or modified under the +conditions of the LaTeX Project Public License, either +version 1.3c of this license or (at your option) any later +version. This version of this license is in + http://www.latex-project.org/lppl/lppl-1-3c.txt +and the latest version of this license is in + http://www.latex-project.org/lppl.txt +and version 1.3c or later is part of all distributions of +LaTeX version 2005/12/01 or later. + +This work has the LPPL maintenance status "maintained". + +The Current Maintainer of this work is H.-Martin Muench. + +This work consists of the main source file tablefootnote.dtx, +the README, and the derived files + tablefootnote.sty, tablefootnote.pdf, + tablefootnote.ins, tablefootnote.drv, + tablefootnote-example.tex, tablefootnote-example.pdf. + +\endpreamble +\let\MetaPrefix\DoubleperCent + +\generate{% + \file{tablefootnote.ins}{\from{tablefootnote.dtx}{install}}% + \file{tablefootnote.drv}{\from{tablefootnote.dtx}{driver}}% + \usedir{tex/latex/tablefootnote}% + \file{tablefootnote.sty}{\from{tablefootnote.dtx}{package}}% + \usedir{doc/latex/tablefootnote}% + \file{tablefootnote-example.tex}{\from{tablefootnote.dtx}{example}}% +} + +\catcode32=13\relax% active space +\let =\space% +\Msg{************************************************************************} +\Msg{*} +\Msg{* To finish the installation you have to move the following} +\Msg{* file into a directory searched by TeX:} +\Msg{*} +\Msg{* tablefootnote.sty} +\Msg{*} +\Msg{* To produce the documentation run the file `tablefootnote.drv'} +\Msg{* through (pdf)LaTeX, e.g.} +\Msg{* pdflatex tablefootnote.drv} +\Msg{* makeindex -s gind.ist tablefootnote.idx} +\Msg{* pdflatex tablefootnote.drv} +\Msg{* makeindex -s gind.ist tablefootnote.idx} +\Msg{* pdflatex tablefootnote.drv} +\Msg{*} +\Msg{* At least three runs are necessary e.g. to get the} +\Msg{* references right!} +\Msg{*} +\Msg{* Happy TeXing!} +\Msg{*} +\Msg{************************************************************************} + +\endbatchfile +% +%<*ignore> +\fi +% +% +% \section{The documentation driver file} +% +% The next bit of code contains the documentation driver file for +% \TeX{}, i.\,e., the file that will produce the documentation you +% are currently reading. It will be extracted from this file by the +% \texttt{docstrip} programme. That is, run \LaTeX{} on \texttt{docstrip} +% and specify the \texttt{driver} option when \texttt{docstrip} +% asks for options. +% +% \begin{macrocode} +%<*driver> +\NeedsTeXFormat{LaTeX2e}[2011/06/24]% +\ProvidesFile{tablefootnote.drv}% + [2011/10/29 v1.0b Table foot notes (HMM)]% +\documentclass{ltxdoc}[2007/11/11]% v2.0u +\usepackage{holtxdoc}[2011/02/04]% v0.21 +%% tablefootnote may work with earlier versions of LaTeX2e and those +%% class and package, but this was not tested. +%% Please consider updating your LaTeX, class, and package +%% to the most recent version (if they are not already the most +%% recent version). +\hypersetup{% + pdfsubject={Footnotes in Tables (HMM)},% + pdfkeywords={LaTeX, tablefootnote, footnote, table, Hans-Martin Muench},% + pdfencoding=auto,% + pdflang={en},% + breaklinks=true,% + linktoc=all,% + pdfstartview=FitH,% + pdfpagelayout=OneColumn,% + bookmarksnumbered=true,% + bookmarksopen=true,% + bookmarksopenlevel=3,% + pdfmenubar=true,% + pdftoolbar=true,% + pdfwindowui=true,% + pdfnewwindow=true% +} +\CodelineIndex +\hyphenation{printing docu-ment} +\gdef\unit#1{\mathord{\thinspace\mathrm{#1}}}% +\begin{document} + \DocInput{tablefootnote.dtx}% +\end{document} +% +% \end{macrocode} +% +% \fi +% +% \CheckSum{198} +% +% \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 \~} +% +% \GetFileInfo{tablefootnote.drv} +% +% \begingroup +% \def\x{\#,\$,\^,\_,\~,\ ,\&,\{,\},\%}% +% \makeatletter +% \@onelevel@sanitize\x +% \expandafter\endgroup +% \expandafter\DoNotIndex\expandafter{\x} +% \expandafter\DoNotIndex\expandafter{\string\ } +% \begingroup +% \makeatletter +% \lccode`9=32\relax +% \lowercase{%^^A +% \edef\x{\noexpand\DoNotIndex{\@backslashchar9}}%^^A +% }%^^A +% \expandafter\endgroup\x +% +% \DoNotIndex{\\} +% \DoNotIndex{\documentclass,\usepackage,\ProvidesPackage,\begin,\end} +% \DoNotIndex{\message,\MessageBreak} +% \DoNotIndex{\NeedsTeXFormat,\DoNotIndex,\verb} +% \DoNotIndex{\def,\edef,\gdef,\global} +% \DoNotIndex{\ifx,\listfiles,\mathord,\mathrm} +% \DoNotIndex{\kvoptions,\SetupKeyvalOptions,\ProcessKeyvalOptions} +% \DoNotIndex{\bigskip,\space,\thinspace,\ldots} +% \DoNotIndex{\indent,\noindent,\newline,\linebreak,\pagebreak} +% \DoNotIndex{\textbf,\textit,\textsf,\texttt,\textquotedblleft,\textquotedblright} +% \DoNotIndex{\plainTeX,\TeX,\LaTeX,\pdfLaTeX} +% \DoNotIndex{\chapter,\section,\the,\csname,\endscname} +% \DoNotIndex{\value,\arabic,\hline,\text} +% +% \title{The \xpackage{tablefootnote} package} +% \date{2011/10/29 v1.0b} +% \author{H.-Martin M\"{u}nch\\\xemail{Martin.Muench at Uni-Bonn.de}} +% +% \maketitle +% +% \begin{abstract} +% This \LaTeX{} package provides the command |\tablefootnote| to be used +% in a \texttt{table} or \texttt{sidewaystable} environment, +% where |\footnote| will not work and when using |\footnotemark| and +% |\footnotetext| and adjusting the counters (including \texttt{Hfootnote}) +% manually is either too much work or would not even work (\texttt{sidewaystable}). +% \end{abstract} +% +% \bigskip +% +% \noindent Disclaimer for web links: The author is not responsible for any contents +% referred to in this work unless he has full knowledge of illegal contents. +% If any damage occurs by the use of information presented there, only the +% author of the respective pages might be liable, not the one who has referred +% to these pages. +% +% \bigskip +% +% \noindent {\color{green} Save per page about $200\unit{ml}$ water, +% $2\unit{g}$ CO$_{2}$ and $2\unit{g}$ wood:\\ +% Therefore please print only if this is really necessary.} +% +% \bigskip +% +% \tableofcontents +% +% \bigskip +% +% \section{Introduction} +% +% \indent This \LaTeX{} package provides the command |\tablefootnote{...}| to be +% used in a \texttt{table} or \texttt{sidewaystable} environment. In those +% environments |\footnote{...}| would not work and would need to be replaced +% by |\footnotemark| in the \texttt{(sideways)table} and |\footnotetext{...}| +% after the \texttt{(sideways)table} environment ended. Additionally the counters +% for \texttt{footnote} and (when the \xpackage{hyperref} package is used) +% \texttt{Hfootnote} would need to be adjusted manually. Then still the hyperlinks +% in a \texttt{(sideways)table} would not work. Just using |\tablefootnote{...}| +% in the (sideways)table does all this automatically. (Redefing |\footnote| was +% \emph{not} done as to not create conflicts with other packages.) +% +% \bigskip +% +% \section{Usage} +% +% \indent Just load the package placing +% \begin{quote} +% |\usepackage{tablefootnote}| +% \end{quote} +% \noindent in the preamble of your \LaTeXe{} source file and use +% |\tablefootnote{...}| instead of |\footnote{...}| in (sideways)tabels. +% If |\tablefootnote{...}| is used in a tabular environment, which is inside +% of a (sideways)table environment, everything is fine, but when the tabular +% environment is not inside of a (sideways)table, the \textbf{table}footnote +% will not work.\\ +% +% When the (sideways)table floates, the footnotes are set and (when \xpackage{hyperref} +% is used) hyperlinked, but they are not automatically adapted when the table floates +% over/under another footnote. Thus either do not use a footnote between original and +% float position of the (sideways)table, or place the (sideways)table in +% \textquotedblleft here\textquotedblright\ position. |\clear(double)page|, |h(!)|, +% |H|~from the \xpackage{float} package, or |\FloatBarrier| from the \xpackage{picins} +% package might help, too. (Or after finishing the document, move the (sideways)table +% in the source code near the position where it floats to.) +% +% \pagebreak +% +% \section{Alternatives\label{sec:Alternatives}} +% +% \begin{description} +% \item[-] The \xpackage{longtable} package provides the \texttt{longtable} environment +% as replacement for the combined \texttt{table} and \texttt{tabular} environments. +% Footnotes are real footnotes (not just tablenotes), are continousely numbered and +% hyperlinked (when using the \xpackage{hyperref} package), and the hyperlinks really +% work. As drawback the appearance of the caption changes slightly (e.\,g.~distance +% to the table, width of the caption), which can probably be changed back manually. +% Furthermore, longtables are meaned to break over more than one page. If that is not +% whished, it must be prevented by |\nopagebreak|-commands and by ending the longtable +% lines with |\\*| instead of |\\|. longtables do not float. (Therefore using the +% \xpackage{tablefootnote} package and |\FloatBarrier| from the \xpackage{picins} package +% before and after the table environment is similar~- but \xpackage{tablefootnote} does not +% change the table-caption!) \texttt{sidewaystable} does not work with it.\\ +% \url{http://www.ctan.org/pkg/longtable} +% +% \item[-] The \xpackage{supertabular} package provides the \texttt{mpsupertabular} +% environment as replacement for the combined \texttt{table} and \texttt{tabular} +% environments. Footnotes are just tablenotes (with working hyperlinks when using the +% \xpackage{hyperref} package), i.\,e. numbered a, b, c and placed below the table +% and not at the end of the page. Therefore there is no float problem (because the +% tablenotes numbering is not included in the continouse numbering of the footnotes). +% Placing the \texttt{supertabular} inside of a \texttt{sidewaystable} breaks the +% hyperlinks to the tablenotes.\\ +% \url{http://www.ctan.org/pkg/supertabular} +% +% \item[-] The \xpackage{ctable} package has its very own notation for defining tables. +% It can create tablenotes and sideways-tables. The tablenotes are not automatically +% hyperlinked. The \texttt{ctable}s float. Because the tablenotes numbering is not +% included in the continouse numbering of the footnotes there is no float problem.\\ +% \url{http://www.ctan.org/pkg/ctable} +% +% \item[-] The \xpackage{footnote} package provides |\makesavenoteenv{table}|. After +% loading the package and using that command in the preamble, in tables |\footnote{...}| +% can be used. Using |\makesavenoteenv{tabular}| and \\ +% |\makesavenoteenv{sidewaystable}| +% is possible, but it neither solves the float problem, nor do the created hyperlinks +% work (i.\,e.~they aim at wrong locations). The \xpackage{mdwtab} from the same bundle +% is incompatible with other table-related packages (e.\,g. \xpackage{supertabular}, +% \xpackage{array}) and not $100\,\%$ compatible with the \texttt{tabular} environment.\\ +% \url{http://www.ctan.org/pkg/footnote}\\ +% \url{http://www.ctan.org/pkg/mdwtab} +% +% \item[-] The \xpackage{tabularx} package does produce footnotes for sidewaystables, +% but uses a, b, c instead of 1, 2, 3. The hyperlinks to the footnotes do not work. +% Because the footnotes numbering is not included in the continouse numbering of +% the other footnotes there is no float problem.\\ +% \url{http://www.ctan.org/pkg/tabularx} +% +% \item[-] Placing a tabular inside a minipage inside a table produces tablenotes. +% Therefore there is no float problem (because the footnotes are not continousely +% numbered). The hyperlinks to the table notes indeed work. +% +% \pagebreak +% +% \item[-] The \xpackage{threeparttable} package creates tablenotes again. Therefore +% there is no float problem (because the tablenotes are not continousely numbered with +% the footnotes). There are no hyperlinks to the table notes (at least not automatically). +% Using |sidewaystable| (with table notes) works.\\ +% \url{http://www.ctan.org/pkg/threeparttable} +% +% \item[-] The \xpackage{threeparttablex} package creates tablenotes again. Therefore there +% is no float problem (because the tablenotes are not continousely numbered with the +% footnotes). With option \texttt{referable} the tablenotes are hyperlinked. Use of +% a |sidewaystable| (with table notes) did not work for me. When using the +% \texttt{referable} option according to the example in the \xpackage{threeparttablex} +% manual the \xpackage{longtable} package is used, therefore that package could be used +% directly without \xpackage{threeparttablex} (see above).\\ +% \url{http://www.ctan.org/pkg/threeparttablex} +% +% \item[-] One can manually use |\footnotemark| in the table and |\footnotetext{...}| +% after the table environment ended and manually change the |footnote| and +% (when the \xpackage{hyperref} package is used) |Hfootnote| counters and needs +% to insert +% \begin{verbatim} +% \makeatletter +% \global\let\Hy@saved@currentHref\@currentHref +% \hyper@makecurrent{Hfootnote}% +% \global\let\Hy@footnote@currentHref\@currentHref +% \global\let\@currentHref\Hy@saved@currentHref +% \makeatother +% \end{verbatim} +% before each |\footnotetext{...}|, but with more than very few footnotes this can become +% much work (and prone to produce errors). And this does not even work with sidewaystables. +% \end{description} +% +% \bigskip +% +% \noindent (You programmed or found another alternative, +% which is available at \CTAN{}?\\ +% OK, send an e-mail to me with the name, location at \CTAN{}, +% and a short notice, and I will probably include it in +% the list above.) +% +% \newpage +% +% \section{Example} +% +% \begin{macrocode} +%<*example> +\documentclass[british]{article}[2007/10/19]% v1.4h +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +\usepackage{float}[2001/11/08]% v1.3d +\usepackage{placeins}[2005/04/18]% v2.2 ; for \FloatBarrier + +\usepackage{rotating}[2009/03/28]% v2.16a; for sidewaystable-environment + +\usepackage{tablefootnote}[2011/10/29]% v1.0b + +\usepackage[% + extension=pdf,% + plainpages=false,% + pdfpagelabels=true,% + hyperindex=false,% + pdflang={en},% + pdftitle={tablefootnote package example},% + pdfauthor={Hans-Martin Muench},% + pdfsubject={Example for the tablefootnote package},% + pdfkeywords={LaTeX, tablefootnote, footnote, table, Hans-Martin Muench},% + % pdfview=FitH and FitBH do not work: hyperlinks in sidewaystables + % aim at the end of the document, not at the footnote + % pdfview=Fit, FitV, FitR, FitB, FitBV work + % print is OK for all those options + pdfstartview=FitH,% + pdfpagelayout=OneColumn% +]{hyperref}[2011/10/01]% v6.82j + +\gdef\unit#1{\mathord{\thinspace\mathrm{#1}}}% +\listfiles +\begin{document} +\pagenumbering{arabic} +\section*{Example for tablefootnote} + +This example demonstrates the use of package\newline +\textsf{tablefootnote}, v1.0b as of 2011/10/29 (HMM).\newline +There were no options used. (The package provides no options.)\newline + +\textbf{The \texttt{tablefootnote-example.tex} needs to be compiled +at least twice to get the references right!}\newline + +If the etoolbox-package is found, it is automatically used.\newline + +For more details please see the documentation!\newline + +\noindent Save per page about $200\unit{ml}$ water, +$2\unit{g}$ CO$_{2}$ and $2\unit{g}$ wood:\newline +Therefore please print only if this is really necessary.\newline + +Here is some text.\footnote{And this is a text footnote.}\newline + +Tables \ref{tab.first}, \ref{tab.another} and \ref{tab.floatH} show +normal tables, table~\ref{tab.sideways} depicts a sidewaystable. +Table~\ref{tab.floatH} uses the float specifier~\texttt{H} from the +float package.\newline + +\texttt{Hyperref} option \verb|pdfview=FitH| and \verb|FitBH| do +not work: hyperlinks in sidewaystables aim at the end of the document, +not at the footnote. \verb|pdfview=Fit|, \verb|FitV|, \verb|FitR|, +\verb|FitB|, \verb|FitBV| work, print is OK for all those options. + +\bigskip + +\listoftables + +\pagebreak + +\begin{table} +\centering +\begin{tabular}{ccc} +Some\tablefootnote{A table footnote.} & % +text\tablefootnote{Another table footnote.} & % +in a table\tablefootnote{A third table footnote.} +\end{tabular} +\caption[A table]{A first table\label{tab.first}} +\end{table} + +Some text.\footnote{Another text footnote.} + +\pagebreak + +More text.\footnote{And yet another text footnote.} + +\begin{table}[t] +\centering +\begin{tabular}{|c|c|c|} +\hline +Another\tablefootnote{A $2^{nd}$ table footnote.} & % +text\tablefootnote{Another $2^{nd}$ table footnote.} & % +in a table\tablefootnote{A $2^{nd}$ third table footnote.}\\ \hline +\end{tabular} +\caption[Another table]{Another table (second one)\label{tab.another}} +\end{table} + +Please note that the table floated to the top of the page. While the +footnotes are set and (when hyperref is used) hyperlinked, they are +not automatically adapted. Thus either do not use a footnote at the +same page before the table, or place the table in +\textquotedblleft here\textquotedblright\ or +\textquotedblleft bottom\textquotedblright\ position. +\verb|\clear(double)page|, \verb|h(!)|, \verb|H|~from the +\texttt{float} package, or \verb|\FloatBarrier| from the +\texttt{picins} package might help, too. (Or move the table in the +source code near the position where it floats to.) + +Table~\ref{tab.floatH} (page~\pageref{tab.floatH}) uses float specifier +\texttt{H} from the float package and does not float. + +Some text.\footnote{This is just another text footnote.} + +\pagebreak + +% \end{macrocode} +% +% \pagebreak +% +% \begin{macrocode} +\FloatBarrier + +\begin{sidewaystable} +\centering% +\begin{tabular}{ccc} +Text\tablefootnote{Rotate view for testing the hyperlinks.} & % +in a\tablefootnote{Another sidewaystable footnote.} & % +sidewaystable% +\tablefootnote{Sidewaystable-environment provided by % +\url{http://CTAN.org/pkg/rotating} package.} +\end{tabular} +\caption[A sideways table]{A table in the \texttt{sideways} % +environment\label{tab.sideways}}% +\end{sidewaystable}% + +\FloatBarrier + +\pagebreak + +A last table, here with float specifier \texttt{H} from the +float\footnote{\url{http://CTAN.org/pkg/float}} package. + +\begin{table}[H] +\centering +\begin{tabular}{ccc} +Another\tablefootnote{A $4^{th}$ table footnote.} & % +text\tablefootnote{Another $4^{th}$ table footnote.} & % +in a table\tablefootnote{A $4^{th}$ third table footnote.} +\end{tabular} +\caption[A last table]{A very last table\label{tab.floatH}} +\end{table} + +Some text.\footnote{This is just another text footnote.} + +\pagebreak + +End of the example for the +tablefootnote\footnote{\url{http://CTAN.org/pkg/tablefootnote}} package. + +\end{document} +% +% \end{macrocode} +% +% \StopEventually{} +% +% \newpage +% +% \section{The implementation} +% +% We start off by checking that we are loading into \LaTeXe\ and +% announcing the name and version of this package. +% +% \begin{macrocode} +%<*package> +% \end{macrocode} +% +% \begin{macrocode} +\NeedsTeXFormat{LaTeX2e}[2011/06/27] +\ProvidesPackage{tablefootnote}[2011/10/29 v1.0b + Table foot notes (HMM)] + +% \end{macrocode} +% +% A short description of the \xpackage{tablefootnote} package: +% +% \begin{macrocode} +%% Provides the \tablefootnoteote{...} command +%% for footnotes in (sideways)tables. + +% \end{macrocode} +% +% We need the \xpackage{ltxcmds} package by \textsc{Heiko Oberdiek}: +% +% \begin{macrocode} +\RequirePackage{ltxcmds}[2011/04/18]% v1.20 + +% \end{macrocode} +% +% When the \xpackage{rotating} package (for |sidewaystable|s) is used, +% some more packages are needed: +% +% \begin{macrocode} +\@ifpackageloaded{rotating}{% + \gdef\tfn@rotating{1} + \@ifpackagelater{rotating}{2009/03/28}% 2009/03/28 v2.16a + {% >= 2009/03/28, OK + }{% else + \PackageWarningNoLine{tablefootnote}{% + It is required version\MessageBreak + 2009/03/28 v2.16a (or later) of package rotating,\MessageBreak + but only version\MessageBreak + `\csname ver@rotating.sty\endcsname'\MessageBreak + is available}% + }% + \RequirePackage{amstext}[2000/06/29]% v2.01 + \RequirePackage{setspace}[2000/12/01]% v6.7 + \RequirePackage{subcaption}[2011/09/12]% v1.1b + }{% else + \gdef\tfn@rotating{0}% + } + +% \end{macrocode} +% +% A last information for the user: +% +% \begin{macrocode} +%% tablefootnote may work with earlier versions of LaTeX and those +%% packages, but this was not tested. Please consider updating +%% your LaTeX and packages to the most recent version +%% (if they are not already the most recent version). + +% \end{macrocode} +% +% \indent See subsection~\ref{ss:Downloads} about how to get them.\\ +% There are no options to be processed.\\ +% We need some definitions: +% +% \begin{macrocode} +\def\tfn@footnotetablecount{0} +\def\tfn@footnotetableprint{0} +\def\tfn@footnotezero{0} +\def\tfn@fnt{0} +\def\tfn@swt{0}% _s_ide_w_ays_t_able + +% \end{macrocode} +% +% \DescribeMacro{\tfn@footnotemarks} +% |\tfn@footnotemarks| uses the |\footnotemark| command to place a foot note mark +% and decreases the |\tfn@footnotetablecount| (i.\,e.~increases the negative value) +% of the number of footnote(marks) in the table. +% +% \begin{macrocode} +\newcommand{\tfn@footnotemarks}{% + \footnotemark% + \count255=\tfn@footnotetablecount \relax% + \count255=\numexpr \count255 - 1 \relax% + \xdef\tfn@footnotetablecount{\the\count255}% +} + +% \end{macrocode} +% +% \DescribeMacro{\tfn@footnotetext} +% |\tfn@footnotetext| contains the |\footnotetext{...}| command and handles the +% numbering. |\tfn@footnotetext| will be executed after the table. The foot note +% counter has been increased automatically with each |\footnotemark|, therefore +% it must be reset to its value before the table began. +% +% \begin{macrocode} +\newcommand{\tfn@footnotetext}[1]{% + \ifx\tfn@footnotetableprint\tfn@footnotezero% + % This is the first footnotetext after the (sideways)table. + \addtocounter{footnote}{\tfn@footnotetablecount}% +% \end{macrocode} +% +% When the \xpackage{hyperref} package is used, also its |Hfootnote| counter must +% be reset. +% +% \begin{macrocode} + \ltx@ifpackageloaded{hyperref}{% + \addtocounter{Hfootnote}{\tfn@footnotetablecount}% + }{}% +% \end{macrocode} +% +% For further footnotes in that table this must not be repeated, therefore +% we deactivate this by defining |\tfn@footnotetableprint| to something other +% than |0| (here |1| is used). +% +% \begin{macrocode} + \gdef\tfn@footnotetableprint{1}% + \fi% +% \end{macrocode} +% +% For issuing the text for the next footnote the footnote-counter +% (and |Hfootnote| counter) are increased by one. +% +% \begin{macrocode} + \addtocounter{footnote}{+1}% + \ltx@ifpackageloaded{hyperref}{% + \addtocounter{Hfootnote}{+1}% +% \end{macrocode} +% +% The \xpackage{hyperref} package was not expecting this kind of change of the +% |(H)footnote| numbers, therefore some codelines are missing here which can be +% found at other places in that same package. +% +% \begin{macrocode} + % Code form the hyperref package, 2011/10/01, v6.82j, + % by Heiko Oberdiek + \global\let\Hy@saved@currentHref\@currentHref% + \hyper@makecurrent{Hfootnote}% + \global\let\Hy@footnote@currentHref\@currentHref% + \global\let\@currentHref\Hy@saved@currentHref% + % End of code form the hyperref package +% \end{macrocode} +% +% When \xpackage{hyperref} is not loaded, nothing is to be done here. +% +% \begin{macrocode} + }{}% +% \end{macrocode} +% +% The |\footnotetext{...}| places the foot note text as usual. +% +% \begin{macrocode} + \ifx\tfn@swt\tfn@footnotezero% + \footnotetext{#1}% + \else% + \footnotetext{$^{\text{\thefootnote}}$\thinspace #1}% + \fi% +% \end{macrocode} +% +% |\tfn@footnotetablecount| contains the negative number of footnote texts +% to be printed, therefore it is increase by one (i.\,e.~the negative number +% decreases, i.\,e.~$-3$ becomes~$-2$). +% +% \begin{macrocode} + \count255=\tfn@footnotetablecount \relax% + \count255=\numexpr \count255 + 1 \relax% + \xdef\tfn@footnotetablecount{\the\count255}% +% \end{macrocode} +% +% When it is zero, all footnote texts have been placed, and\\ +% |\tfn@footnotetableprint| can be reset to zero and\\ +% |\tfn@tablefootnoteprintout| can be cleared. +% +% \begin{macrocode} + \ifx\tfn@footnotetablecount\tfn@footnotezero% all footnotes placed + \gdef\tfn@footnotetableprint{0}% + \global\let\tfn@tablefootnoteprintout\relax% brute force + %\else there is at least one \footnotemark which needs \footnotetext + \fi +} + +% \end{macrocode} +% +% \DescribeMacro{\tfn@tablefootnoteprintout} +% When something shall be cleared or redefined, it is a good idea to define it. +% It~will be later filled with the foot note text to be printed. +% +% \begin{macrocode} +\newcommand{\tfn@tablefootnoteprintout}{\relax} + +% \end{macrocode} +% +% \DescribeMacro{\tablefootnote} +% |\tablefootnote{...}| is the command to be used by the user instead of |\footnote{...}| +% in the table. It places a foot note mark via |\tfn@footnotemarks| and appends a +% |\tfn@footnotetext{#1}| to the |\tfn@tablefootnoteprintout| macro. (And remembers that +% table foot notes have been used.) +% +% \begin{macrocode} +\newcommand{\tablefootnote}[1]{% +\tfn@footnotemarks% +\ltx@GlobalAppendToMacro{% +\tfn@tablefootnoteprintout}{\tfn@footnotetext{#1}}% +\gdef\tfn@fnt{1}% +} + +% \end{macrocode} +% +% \DescribeMacro{\tablefootnote} +% For |sidewaystable|s the |\tfn@tablefootnoteprintout| is placed in a\linebreak +% |\subcaptionbox|, which can be placed at the same place as the |sidewaystable|: +% +% \begin{macrocode} +\newcommand{\tfn@swtbox}{% +\vspace{0.8cm}% +\begin{spacing}{0.1}% +\subcaptionbox*{}[\linewidth][l]{\tfn@tablefootnoteprintout}% +\end{spacing}% +} + +% \end{macrocode} +% +% |\tfn@tablefootnoteprintout| shall be executed after the end of the table environment. +% The \xpackage{etoolbox} package provides very easy syntax for this: +% +% \begin{macrocode} +\IfFileExists{etoolbox.sty}{% + \RequirePackage{etoolbox} + \AfterEndEnvironment{table}{% + \tfn@tablefootnoteprintout% + \gdef\tfn@fnt{0}% + } +% \end{macrocode} +% +% \pagebreak +% +% When the \xpackage{rotating} package has been loaded, we need to detect whether the +% |\tablefootnote| is placed inside of a |sidewaystable|. +% +% \begin{macrocode} + \ltx@ifpackageloaded{rotating}{% + \AtBeginEnvironment{sidewaystable}{% + \gdef\tfn@swt{1}% + } +% \end{macrocode} +% +% At the end of |sidewaystable| environments |\tfn@swtbox| shall be placed +% (if~there was any |\tablefootnote| in that |sidewaystable| at all). And +% |\tfn@swt| as well as |\tfn@fnt| must be reset to |0|. +% +% \begin{macrocode} + \AtEndEnvironment{sidewaystable}{% + \ifx\tfn@fnt\tfn@footnotezero% \relax + \else% + \tfn@swtbox% + \fi% + \gdef\tfn@swt{0}% + \gdef\tfn@fnt{0}% + }% + }{}% +}{% +% \end{macrocode} +% +% When the \xpackage{etoolbox} package is not available (e.\,g. because of missing +% \eTeX{}) we~do a workaround: +% +% \begin{macrocode} + \PackageWarning{tablefootnote}{% + Package etoolbox not available, therefore\MessageBreak% + substituting commands \string\AtEndEnvironment\space % + and\MessageBreak% + \string\AfterEndEnvironment\space for tablefootnotes% + }% + \let\tfnorigtable\table + \let\tfnendorigtable\endtable + \renewenvironment{table}{% + \tfnorigtable% + }{% + \tfnendorigtable% + \tfn@tablefootnoteprintout% + } + \ltx@ifpackageloaded{rotating}{% + \let\tfnorigsidewaystable\sidewaystable + \let\tfnendorigsidewaystable\endsidewaystable + \renewenvironment{sidewaystable}{% + \gdef\tfn@swt{1}% + \tfnorigsidewaystable% + }{% + \ifx\tfn@fnt\tfn@footnotezero% \relax + \else% + \tfn@swtbox% + \fi% + \gdef\tfn@swt{0}% + \gdef\tfn@fnt{0}% + \tfnendorigsidewaystable% + }% + }{}% +} + +% \end{macrocode} +% +% \pagebreak +% +% \DescribeMacro{\AtBeginDocument} +% When the \xpackage{rotating} package has been loaded after the \xpackage{tablefootnote} +% package, the \xpackage{amstext}, \xpackage{setspace}, and \xpackage{subcaption} +% packages have not been loaded automatically by the \xpackage{tablefootnote} package +% (and there was no check of their required version). An error message is given. +% In this case the |\tablefootnote|s in |sidewaystable|s would not work! +% +% \begin{macrocode} +\AtBeginDocument{% + \ltx@ifpackageloaded{rotating}{% + \ifx\tfn@rotating\tfn@footnotezero% + \PackageError{tablefootnote}{% + Package rotating loaded after package tablefootnote}{% + When using both the rotating and the tablefootnote package,% + \MessageBreak% + the rotating package must be loaded before the tablefootnote% + package!% + }% + \fi% + }{} + } + +% \end{macrocode} +% +% That's it! +% +% \begin{macrocode} +% +% \end{macrocode} +% +% \newpage +% +% \section{Installation} +% +% \subsection{Downloads\label{ss:Downloads}} +% +% Everything is available at \CTAN{}, \url{http://www.ctan.org/tex-archive/}, +% but may need additional packages themselves.\\ +% +% \DescribeMacro{tablefootnote.dtx} +% For unpacking the |tablefootnote.dtx| file and constructing the documentation it is required: +% \begin{description} +% \item[-] \TeX{} Format \LaTeXe{}: \url{http://www.CTAN.org/} +% +% \item[-] document class \xpackage{ltxdoc}, 2007/11/11, v2.0u, +% \url{http://ctan.org/pkg/ltxdoc} +% +% \item[-] package \xpackage{holtxdoc}, 2011/02/04, v0.21, +% \url{http://ctan.org/pkg/holtxdoc} +% +% \item[-] package \xpackage{hypdoc}, 2010/03/26, v1.9, +% \url{http://ctan.org/pkg/hypdoc} +% \end{description} +% +% \DescribeMacro{tablefootnote.sty} +% The \texttt{tablefootnote.sty} for \LaTeXe\ (i.\,e. each document using +% the \xpackage{tablefootnote} package) requires: +% \begin{description} +% \item[-] \TeX{} Format \LaTeXe{}, \url{http://www.CTAN.org/} +% +% \item[-] package \xpackage{ltxcmds}, 2011/04/18, v1.20, +% \url{http://ctan.org/pkg/ltxcmds} +% \end{description} +% +% When the \xpackage{rotating} package is used (for its |sidewaystable| environment; +% 2009/03/28, v2.16a, \url{http://ctan.org/pkg/rotating}) also the \xpackage{amstext}, +% \xpackage{setspace}, and \xpackage{subcaption} packages are needed (they will be +% loaded automatically by the \xpackage{tablefootnote} package, if \xpackage{rotating} +% is loaded \emph{before} \xpackage{tablefootnote}). +% \begin{description} +% \item[-] package \xpackage{amstext}, 2000/06/29, v2.01, +% \url{http://ctan.org/pkg/amstext} +% +% \item[-] package \xpackage{setspace}, 2000/12/01, v6.7, +% \url{http://ctan.org/pkg/setspace} +% +% \item[-] package \xpackage{subcaption}, 2011/09/12, v1.1b, +% \url{http://ctan.org/pkg/subcaption} +% \end{description} +% (loading themselfes further packages). +% +% \DescribeMacro{tablefootnote-example.tex} +% The \texttt{tablefootnote-example.tex} requires the same files as all +% documents using the \xpackage{tablefootnote} package, i.\,e. the ones +% named above and additionally: +% \begin{description} +% \item[-] class \xpackage{article}, 2007/10/19, v1.4h, from \xpackage{classes.dtx}:\\ +% \CTAN{macros/latex/base/classes.dtx} +% +% \item[-] package \xpackage{rotating}, 2009/03/28, v2.16a, +% \url{http://ctan.org/pkg/rotating} +% +% \item[-] package \xpackage{float}, 2001/11/08, v1.3d, +% \url{http://ctan.org/pkg/float} +% +% \item[-] package \xpackage{placeins}, 2005/04/18, v2.2, +% \url{http://ctan.org/pkg/placeins}\\ +% for |\FloatBarrier| +% +% \item[-] package \xpackage{hyperref}, 2011/10/01, v6.82j, +% \url{http://ctan.org/pkg/hyperref} +% +% \item[-] package \xpackage{tablefootnote}, 2011/10/29, v1.0b,\\ +% \url{http://ctan.org/pkg/tablefootnote}\\ +% (Well, it is the example file for this package, and because you +% are reading the documentation for the \xpackage{tablefootnote} package, +% it can be assumed that you already have some version of it~-- +% is it the current one?) +% \end{description} +% +% \DescribeMacro{Oberdiek} +% \DescribeMacro{holtxdoc} +% \DescribeMacro{ltxcmds} +% All packages of \textsc{Heiko Oberdiek's} bundle `oberdiek' +% (especially \xpackage{holtxdoc} and \xpackage{ltxcmds}) +% are also available in a TDS compliant ZIP archive:\\ +% \CTAN{install/macros/latex/contrib/oberdiek.tds.zip}.\\ +% It is probably best to download and use this, because the packages in there +% are quite probably both recent and compatible among themselves.\\ +% +% \DescribeMacro{hyperref} +% \noindent \xpackage{hyperref} is not included in that bundle and needs to be downloaded +% separately,\\ +% \url{http://mirror.ctan.org/install/macros/latex/contrib/hyperref.tds.zip}.\\ +% +% \DescribeMacro{M\"{u}nch} +% A hyperlinked list of my (other) packages can be found at +% \url{http://www.Uni-Bonn.de/~uzs5pv/LaTeX.html}.\\ +% +% \subsection{Package, unpacking TDS} +% +% \paragraph{Package.} This package is available on \CTAN{} +% \begin{description} +% \item[\CTAN{macros/latex/contrib/tablefootnote/tablefootnote.dtx}]\hspace*{0.1cm} \\ +% The source file. +% \item[\CTAN{macros/latex/contrib/tablefootnote/tablefootnote.pdf}]\hspace*{0.1cm} \\ +% The documentation. +% \item[\CTAN{macros/latex/contrib/tablefootnote/tablefootnote-example.pdf}]\hspace*{0.1cm} \\ +% The compiled example file, as it should look like. +% \item[\CTAN{macros/latex/contrib/tablefootnote/README}]\hspace*{0.1cm} \\ +% The README file. +% \item[\CTAN{install/macros/latex/contrib/tablefootnote.tds.zip}]\hspace*{0.1cm} \\ +% Everything in TDS compliant, compiled format. +% \end{description} +% which additionally contains\\ +% \begin{tabular}{ll} +% tablefootnote.ins & The installation file.\\ +% tablefootnote.drv & The driver to generate the documentation.\\ +% tablefootnote.sty & The \xext{sty}le file.\\ +% tablefootnote-example.tex & The example file. +% \end{tabular} +% +% \bigskip +% +% \noindent For required other packages, see the preceding subsection. +% +% \paragraph{Unpacking.} The \xfile{.dtx} file is a self-extracting +% \docstrip\ archive. The files are extracted by running the +% \xfile{.dtx} through \plainTeX: +% \begin{quote} +% \verb|tex tablefootnote.dtx| +% \end{quote} +% +% About generating the documentation see paragraph~\ref{GenDoc} below.\\ +% +% \paragraph{TDS.} Now the different files must be moved into +% the different directories in your installation TDS tree +% (also known as \xfile{texmf} tree): +% \begin{quote} +% \def\t{^^A +% \begin{tabular}{@{}>{\ttfamily}l@{ $\rightarrow$ }>{\ttfamily}l@{}} +% tablefootnote.sty & tex/latex/tablefootnote.sty\\ +% tablefootnote.pdf & doc/latex/tablefootnote.pdf\\ +% tablefootnote-example.tex & doc/latex/tablefootnote-example.tex\\ +% tablefootnote-example.pdf & doc/latex/tablefootnote-example.pdf\\ +% tablefootnote.dtx & source/latex/tablefootnote.dtx\\ +% \end{tabular}^^A +% }^^A +% \sbox0{\t}^^A +% \ifdim\wd0>\linewidth +% \begingroup +% \advance\linewidth by\leftmargin +% \advance\linewidth by\rightmargin +% \edef\x{\endgroup +% \def\noexpand\lw{\the\linewidth}^^A +% }\x +% \def\lwbox{^^A +% \leavevmode +% \hbox to \linewidth{^^A +% \kern-\leftmargin\relax +% \hss +% \usebox0 +% \hss +% \kern-\rightmargin\relax +% }^^A +% }^^A +% \ifdim\wd0>\lw +% \sbox0{\small\t}^^A +% \ifdim\wd0>\linewidth +% \ifdim\wd0>\lw +% \sbox0{\footnotesize\t}^^A +% \ifdim\wd0>\linewidth +% \ifdim\wd0>\lw +% \sbox0{\scriptsize\t}^^A +% \ifdim\wd0>\linewidth +% \ifdim\wd0>\lw +% \sbox0{\tiny\t}^^A +% \ifdim\wd0>\linewidth +% \lwbox +% \else +% \usebox0 +% \fi +% \else +% \lwbox +% \fi +% \else +% \usebox0 +% \fi +% \else +% \lwbox +% \fi +% \else +% \usebox0 +% \fi +% \else +% \lwbox +% \fi +% \else +% \usebox0 +% \fi +% \else +% \lwbox +% \fi +% \else +% \usebox0 +% \fi +% \end{quote} +% If you have a \xfile{docstrip.cfg} that configures and enables \docstrip's +% TDS installing feature, then some files can already be in the right +% place, see the documentation of \docstrip. +% +% \subsection{Refresh file name databases} +% +% If your \TeX~distribution (\teTeX, \mikTeX,\dots) relies on file name +% databases, you must refresh these. For example, \teTeX\ users run +% \verb|texhash| or \verb|mktexlsr|. +% +% \subsection{Some details for the interested} +% +% \paragraph{Unpacking with \LaTeX.} +% The \xfile{.dtx} chooses its action depending on the format: +% \begin{description} +% \item[\plainTeX:] Run \docstrip\ and extract the files. +% \item[\LaTeX:] Generate the documentation. +% \end{description} +% If you insist on using \LaTeX\ for \docstrip\ (really, +% \docstrip\ does not need \LaTeX{}), then inform the autodetect routine +% about your intention: +% \begin{quote} +% \verb|latex \let\install=y\input{tablefootnote.dtx}| +% \end{quote} +% Do not forget to quote the argument according to the demands +% of your shell. +% +% \paragraph{Generating the documentation.\label{GenDoc}} +% You can use both the \xfile{.dtx} or the \xfile{.drv} to generate +% the documentation. The process can be configured by a +% configuration file \xfile{ltxdoc.cfg}. For instance, put this +% line into this file, if you want to have A4 as paper format: +% \begin{quote} +% \verb|\PassOptionsToClass{a4paper}{article}| +% \end{quote} +% +% \noindent An example follows how to generate the +% documentation with \pdfLaTeX{}: +% +% \begin{quote} +%\begin{verbatim} +%pdflatex tablefootnote.dtx +%makeindex -s gind.ist tablefootnote.idx +%pdflatex tablefootnote.dtx +%makeindex -s gind.ist tablefootnote.idx +%pdflatex tablefootnote.dtx +%\end{verbatim} +% \end{quote} +% +% \subsection{Compiling the example} +% +% The example file, \textsf{tablefootnote-example.tex}, can be compiled via\\ +% |(pdf)latex tablefootnote-example.tex| (and needs at least two compiler runs +% to get the references right!).\\ +% +% \pagebreak +% +% \section{Acknowledgements} +% +% I would like to thank \textsc{Heiko Oberdiek} for providing +% the \xpackage{hyperref}, \xpackage{ltxcmds}, as well as +% a~lot~(!) of other useful packages (from which I also got everything +% I know about creating a file in \xext{dtx} format, ok, say it: copying), +% and the \Newsgroup{comp.text.tex} and \Newsgroup{de.comp.text.tex} +% newsgroups for their help in all things \TeX{}. +% +% \bigskip +% +% \phantomsection +% \begin{History}\label{History} +% \begin{Version}{2011/10/26 v1.0a, tabfootn} +% \item Upload to \CTAN{macros/latex/contrib/tablefootnote/}. +% \end{Version} +% \begin{Version}{2011/10/29 v1.0b} +% \item Renamed to \xpackage{tablefootnote}. +% \item Added support for the |sidewaystable|-environment of the +% \xpackage{rotating} package. +% \item Diverse changes in documentation and README. +% \end{Version} +% \end{History} +% +% \bigskip +% +% When you find a mistake or have a suggestion for an improvement of this package, +% please send an e-mail to the maintainer, thanks! (Please see BUG REPORTS in the README.) +% +% \pagebreak +% +% \PrintIndex +% +% \Finale +\endinput \ No newline at end of file -- cgit v1.2.3