summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/source/latex/tablefootnote/tablefootnote.dtx
blob: e760745a3c19708f9b344844bb1d1b60a5414664 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
% \iffalse meta-comment
%
% File: tablefootnote.dtx
% Version: 2012/01/14 v1.0g
%
% Copyright (C) 2011 - 2012 by
%    H.-Martin M"unch <Martin dot Muench at Uni-Bonn dot de>
%
% 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
%</ignore>
%<*install>
\input docstrip.tex
\Msg{******************************************************************}
\Msg{* Installation                                                   *}
\Msg{* Package: tablefootnote 2012/01/14 v1.0g Table foot notes (HMM) *}
\Msg{******************************************************************}

\keepsilent
\askforoverwritefalse

\let\MetaPrefix\relax
\preamble

This is a generated file.

Project: tablefootnote
Version: 2012/01/14 v1.0g

Copyright (C) 2011 - 2012 by
    H.-Martin M"unch <Martin dot Muench at Uni-Bonn dot de>

The usual disclaimer applies:
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
%</install>
%<*ignore>
\fi
%</ignore>
%
% \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/27]
\ProvidesFile{tablefootnote.drv}%
  [2012/01/14 v1.0g 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, H.-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}}}%
\makeatletter
\@ifundefined{eTeX}{\gdef\eTeX{$\m@th \varepsilon $-\TeX }}{% else \relax
}
\makeatother
\begin{document}
  \DocInput{tablefootnote.dtx}%
\end{document}
%</driver>
%    \end{macrocode}
%
% \fi
%
% \CheckSum{271}
%
% \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{\MessageBreak,\message}
% \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,\textsc,\textquotedblleft,\textquotedblright}
% \DoNotIndex{\plainTeX,\TeX,\LaTeX,\pdfLaTeX}
% \DoNotIndex{\chapter,\section,\the,\csname,\endscname}
% \DoNotIndex{\value,\arabic,\hline,\text,\caption,\centering,\clear,\url}
%
% \title{The \xpackage{tablefootnote} package}
% \date{2012/01/14 v1.0g}
% \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.}
%
% \pagebreak
%
% \tableofcontents
%
% \bigskip
%
% \section{Introduction\label{sec: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. (Redefining |\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}
% \enlargethispage{\baselineskip}
% \noindent in the preamble of your \LaTeXe{} source file and use
% |\tablefootnote{...}| instead of |\footnote{...}| in (sideways)tables.
% 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.\\
%
% Pages with tables with footnotes, which are rotated with the \xpackage{lscape}-
% or with the \xpackage{pdflscape}-package (|\begin{landscape}|, table, |\end{landscape}|),
% are possible. But when the \xpackage{footmisc}-package is used, \xpackage{(pdf)lscape}
% should be loaded before \xpackage{footmisc}.\\
%
% When the \xpackage{footmisc}-package is used with option \texttt{para},
% this is regarded with the exception of a \texttt{sidewaystable}. There the footnotes
% are printed one below the other. (Well, this is better than no footnote in a
% \texttt{sidewaystable} at all, isn't it?)\\
%
% When the (sideways)table floats, the footnotes are set and (when \xpackage{hyperref}
% is used) hyperlinked, but they are not automatically adapted when the table floats
% 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 (\url{http://www.ctan.org/pkg/float}),
% or |\FloatBarrier| from the \xpackage{picins} package
% (\url{http://www.ctan.org/pkg/picins}) might help, too.
% (Or after finishing the document, move the (sideways)table in the source code
% near the position where it floats to.)
%
% \bigskip
%
% \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 continuously 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
%   wished, 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 continuous numbering of the footnotes there is no float problem.\\
%   \url{http://www.ctan.org/pkg/ctable}
%
% \pagebreak
%
% \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 continuous 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 continuously
%   numbered). The hyperlinks to the table notes indeed work.
%
% \item[-] The \xpackage{threeparttable} package creates tablenotes again. Therefore
%   there is no float problem (because the tablenotes are not continuously 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 continuously 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[%
 extension=pdf,%
 plainpages=false,%
 pdfpagelabels=true,%
 hyperindex=false,%
 pdflang={en},%
 pdftitle={tablefootnote package example},%
 pdfauthor={H.-Martin Muench},%
 pdfsubject={Example for the tablefootnote package},%
 pdfkeywords={LaTeX, tablefootnote, footnote, table, H.-Martin Muench},%
 % pdfview=FitH and FitBH do not work: hyperlinks in sidewaystables
 % do no lead to the footnotes, due to a bug in pdfTeX,
 % computing wrong anchor coordinates (Heiko Oberdiek, 29. October 2011)
 % pdfview=Fit, FitV, FitR, FitB, FitBV work
 % print is OK for all those options
 pdfstartview=FitH,%
 pdfpagelayout=OneColumn%
]{hyperref}[2011/12/04]% v6.82m
 % Due to the urls used in the example, either the hyperref or the url
 % package are needed (or the urls must be removed before compiling).

\usepackage{tablefootnote}[2012/01/14]% v1.0g

\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.0g as of 2012/01/14 (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.symbol}, \ref{tab.normal}, \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 due to a bug in pdf\TeX{}, computing wrong
anchor coordinates (\textsc{Heiko Oberdiek}, 29. October 2011).
Depending on used pdf-viewer, hyperlinks in sidewaystables lead
e.\,g.~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

\renewcommand{\thefootnote}{\fnsymbol{footnote}}
\verb|\renewcommand{\thefootnote}{\fnsymbol{footnote}}|
causes footnote-symbol-footnotes, which are possible
(see Table~\ref{tab.symbol}).

\begin{table}
\centering
\begin{tabular}{ccc}
Another\tablefootnote{A table footnote.} & %
text\tablefootnote{Another table footnote.} & %
in a table\tablefootnote{A third table footnote.}
\end{tabular}
\caption[A footnotesymbol table]{%
A table with footnote-symbol-footnotes.\label{tab.symbol}}
\end{table}

Some text.\footnote{A text footnote.}

\renewcommand{\thefootnote}{\arabic{footnote}}
\verb|\renewcommand{\thefootnote}{\arabic{footnote}}|
switches back to normal footnote numbers again.

\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 normal table.\label{tab.normal}}
\end{table}

Some text.\footnote{Another text footnote.}

\pagebreak

%    \end{macrocode}
%
% \pagebreak
%
%    \begin{macrocode}
More text.\footnote{And yet another text footnote.}

\begin{table}[t]
\centering
\begin{tabular}{|c|c|c|}
\hline
Another\tablefootnote{A $3^{rd}$ table footnote.} & %
text\tablefootnote{Another $3^{rd}$ table footnote.} & %
in a table\tablefootnote{A $3^{rd}$ third table footnote.}\\ \hline
\end{tabular}
\caption[Another table]{Another table (third one)\label{tab.another}}
\end{table}

Please note that Table~\ref{tab.another} 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

\FloatBarrier

\begin{sidewaystable}
\centering%
\begin{tabular}{ccc}
Text\tablefootnote{Please rotate the 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

%    \end{macrocode}
%
% \pagebreak
%
%    \begin{macrocode}
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 $5^{th}$ table footnote.} & %
text\tablefootnote{Another $5^{th}$ table footnote.} & %
in a table\tablefootnote{A $5^{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}
%</example>
%    \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}[2012/01/14 v1.0g
              Table foot notes (HMM)]
%    \end{macrocode}
%
% A short description of the \xpackage{tablefootnote} package:
%
%    \begin{macrocode}
%% Provides the \tablefootnote{...} 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}
%
% A last information for the user:
%
%    \begin{macrocode}
%% tablefootnote may work with earlier versions of LaTeX and that
%% package, 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.\\
%
% When the \xpackage{rotating} package (for |sidewaystable|s) is used,
% it must be loaded before the \xpackage{tablefootnote} package and it must be
% a recent version:
%
%    \begin{macrocode}
\@ifpackageloaded{rotating}{%
  \gdef\tfn@rotating{1}
  \@ifpackagelater{rotating}{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}%
   }%
 }{% else
  \gdef\tfn@rotating{0}%
 }

%    \end{macrocode}
%
% 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
\def\tfn@fmpw{\relax}% f_oot_m_isc_p_ara_w_arn-switch

%    \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%
  \@tempcnta=\tfn@footnotetablecount\relax%
  \advance\@tempcnta by -1%
  \xdef\tfn@footnotetablecount{\the\@tempcnta}%
}

%    \end{macrocode}
%
% \DescribeMacro{\tfn@footmiscparawarn}
% When the \xpackage{footmisc} package is used with option |para|,
% we need to issue a warning. (Any idea how to resolve this issue?)\\
% It must be given inside of it's own command, because |\ifFN@para| is not
% defined when \xpackage{footmisc} has not been loaded, and then the 
% |\fi| would be a |\fi| without |\if| (and \TeX{} does not like single
% |\fi|s).
%
%    \begin{macrocode}
\newcommand{\tfn@footmiscparawarn}{%
  \ifFN@para%
    \PackageWarning{tablefootnote}{%
      Package footmisc with option para used.\MessageBreak%
      Unfortunately package tablefootnote is not yet\MessageBreak%
      able to regard this in sidewaystables.\MessageBreak%
      Here the footnotes are printed one below\MessageBreak%
      the other. Sorry.\MessageBreak%
     }%
  \fi%
  }

%    \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}%
     }{}%
  \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 code-lines 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, newer versions available
    % 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}
   }{}% else \relax
%    \end{macrocode}
%
% The |\footnotetext{...}| places the foot note text as usual.
%
%    \begin{macrocode}
  \ifx\tfn@swt\tfn@footnotezero%
    \footnotetext{#1}%
  \else%
%    \end{macrocode}
%
% If there is more than one tablefootnote in the |sidewaystable|, \\
% the |\tfn@footmiscparawarn| shall be given,
%
%    \begin{macrocode}
    \ifx\tfn@footnotetableprint\tfn@footnotezero%
      \gdef\tfn@fmpw{\tfn@footmiscparawarn}%
    \else%
      \ltx@ifpackageloaded{footmisc}{\tfn@fmpw}{\relax}%
%    \end{macrocode}
%
% but we do not want to repeat the message for a third(, forth,\ldots)
% tablefootnote in the |sidewaystable|.
%
%    \begin{macrocode}
      \gdef\tfn@fmpw{\relax}%
    \fi%
%    \end{macrocode}
%
% |\@makefnmark| is \\
% |\hbox {\@textsuperscript {\normalfont \@thefnmark }}|,
% but according to |\show\@thefnmark| here |\@thefnmark| is
% |{\protect \itshape}| instead of \\
% |\thefootnote| (Why?!).
%
%    \begin{macrocode}
    \footnotetext{\hbox {\@textsuperscript {\normalfont \thefootnote %
      }}\thinspace #1}%
  \fi%
%    \end{macrocode}
%
% For further footnotes in the table the \\
% |\ifx\tfn@footnotetableprint\tfn@footnotezero|\ldots|\fi| form the beginning
% of this |\tfn@footnotetext| macro 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}%
%    \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}
  \@tempcnta=\tfn@footnotetablecount\relax%
  \advance\@tempcnta by +1%
  \xdef\tfn@footnotetablecount{\the\@tempcnta}%
%    \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{\tfn@swtbox}
% For |sidewaystable|s the |\tfn@tablefootnoteprintout| is placed in a \\
% |\parbox|, which can be placed at the end of the |sidewaystable|:
%
%    \begin{macrocode}
\newcommand{\tfn@swtbox}{%
\ifvoid \footins%
\vskip 2\baselineskip%
\else%
\vskip \skip\footins%
\fi%
\parbox[b][][t]{\linewidth}{\raggedright \tfn@tablefootnoteprintout}%
}

%    \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}[2011/01/03]%   v2.1
  \AfterEndEnvironment{table}{%
    \tfn@tablefootnoteprintout%
    \gdef\tfn@fnt{0}%
   }
%    \end{macrocode}
%
% 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}%
     }%
   }{}% else \relax
}{%
%    \end{macrocode}
%
% \pagebreak
%
% 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%
    \MessageBreak%
   }%
  \RequirePackage{letltxmacro}[2010/09/02]% v1.4
  \@ifpackagelater{letltxmacro}{2010/09/02}%
   {% >= 2010/09/02, OK
    \GlobalLetLtxMacro{\tfnorigtable}{\table}
    \GlobalLetLtxMacro{\tfnendorigtable}{\endtable}
%    \end{macrocode}
%
% |\GlobalLetLtxMacro| was introduced in version 2010/09/02 v1.4 of the
% \xpackage{letltxmacro} package.
%
%    \begin{macrocode}
   }{% else
     \PackageError{tablefootnote}{%
       Outdated version of letltxmacro package used%
      }{Version 2010/09/02 v1.4 or newer needed but not found!%
        \MessageBreak%
        Update the used letltxmacro package.}
        \LetLtxMacro{\tfnorigtable}{\table}
        \LetLtxMacro{\tfnendorigtable}{\endtable}
    }
  \ltx@ifpackageloaded{float}{%
    \@ifpackagelater{float}{2001/11/08}%   v1.3d
     {% >= 2001/11/08, OK
     }{% else
       \PackageWarningNoLine{tablefootnote}{%
         It is required version\MessageBreak
         2001/11/08 v1.3d (or later) of package float,\MessageBreak
         but only version\MessageBreak
        `\csname ver@float.sty\endcsname'\MessageBreak
        is available}%
     }%
   }{\relax}
  \renewenvironment{table}{%
    \ltx@ifpackageloaded{float}{%
%    \end{macrocode}
%
% When \xpackage{etoolbox.sty} was not found, and the \xpackage{float} package
% has been loaded, and the float specifier is \texttt{H}, then |\endtable| was
% let to |\float@endH| by the \xpackage{float} package (line~79 of
% \xpackage{float.sty}, 2001/11/08 v1.3d:\\
% |\expandafter\let\csname end#1\endcsname\float@endH|), i.\,e.~appending\\
% |\tfn@tablefootnoteprintout \gdef\tfn@fnt{0}| to |\endtable| is useless.
% Instead of this, it must be appended to |\float@endH|.\\
% (Why is this not necessary when \xpackage{etoolbox} is used?
% That is a good question, answers are welcome.)
%
%    \begin{macrocode}
      \ltx@LocalAppendToMacro{\float@endH}{%
        \tfn@tablefootnoteprintout%
        \gdef\tfn@fnt{0}%
       }%
     }{\relax}
    \tfnorigtable%
   }{%
%    \end{macrocode}
%
% \pagebreak
%
%    \begin{macrocode}
     \tfnendorigtable%
     \tfn@tablefootnoteprintout%
     \gdef\tfn@fnt{0}%
    }%
%    \end{macrocode}
%
% The |sidewaystable|-environment must be treated separately:
%
%    \begin{macrocode}
  \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}
%
% \DescribeMacro{\AtBeginDocument}
% When the \xpackage{rotating} package (for |sidewaystable|s) is used,
% it must be loaded before the \xpackage{tablefootnote} package.
% (If it is loaded |\AtBeginDocument| after this check, the error message
% will not be given, but packages really should be loaded before
% |\AtBeginDocument|.)
%
%    \begin{macrocode}
\AtBeginDocument{%
  \ltx@ifpackageloaded{rotating}{%
    \ifx\tfn@rotating\tfn@footnotezero%
      \PackageError{tablefootnote}{%
        Package rotating loaded after tablefootnote}{%
        When using both the rotating and the tablefootnote package,%
        \MessageBreak%
        the rotating package MUST be loaded before the tablefootnote%
        \space package!\MessageBreak%
       }%
    \fi%
   }{% else \relax
   }
%    \end{macrocode}
%
% \pagebreak
%
% When the document is compiled with \LuaLaTeX{}, hyperlinks in rotated content
% will be misplaced, regardless of the use of the \xpackage{tablefootnote} package
% (or of tables or footnotes). The text to be printed will be OK.
% This problem of \LuaLaTeX{} (not \xpackage{tablefootnote}) was found and reported
% by \textsc{Arno Trautmann}, 2011/11/15 - thanks!
%
%    \begin{macrocode}
  \ltx@ifpackageloaded{hyperref}{%
    \ifluatex%
      \PackageWarningNoLine{tablefootnote}{%
        LuaTeX & hyperref used:\MessageBreak%
        Hyperreferences in rotated content\MessageBreak%
        will be misplaced\MessageBreak%
        regardless of tablefootnote package.\MessageBreak%
        The text to be printed will be OK%
       }%
    \fi%
   }{% else \relax
   }%
  }

%    \end{macrocode}
%
%    \begin{macrocode}
%</package>
%    \end{macrocode}
%
% \pagebreak
%
% \section{Installation}
%
% \subsection{Downloads\label{ss:Downloads}}
%
% Everything is available on \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 |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{hyperref} package is used, also the \xpackage{ifluatex} package
% is needed, but it is already loaded automatically by the \xpackage{hyperref}
% package.\\
% When the \xpackage{etoolbox} package is available, it is used,
% otherwise the \xpackage{letltxmacro} package is used:
% \begin{description}
% \item[-] package \xpackage{letltxmacro}, 2010/09/02, v1.4,
%           \url{http://ctan.org/pkg/letltxmacro}.
% \end{description}
%
% \DescribeMacro{tablefootnote-example.tex}
% The |tablefootnote-example.tex| requires the same files as all
% documents using the \xpackage{tablefootnote} package 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/12/04, v6.82m,
%           \url{http://ctan.org/pkg/hyperref}
%
% \item[-] package \xpackage{tablefootnote}, 2012/01/14, v1.0g,\\
%           \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{ifluatex}
% \DescribeMacro{letltxmacro}
% \DescribeMacro{ltxcmds}
% All packages of \textsc{Heiko Oberdiek}'s bundle `oberdiek'
% (especially \xpackage{holtxdoc}, \xpackage{ifluatex}, \xpackage{letltxmacro},
% 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.\\
%
% \pagebreak
%
% \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.
% \end{description}
% There is also a tablefootnote.tds.zip available:
% \begin{description}
% \item[\CTAN{install/macros/latex/contrib/tablefootnote.tds.zip}]\hspace*{0.1cm} \\
%       Everything in \xfile{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, please see the preceding subsection.
%
% \paragraph{Unpacking.} The \xfile{.dtx} file is a self-extracting
% \docstrip{} archive. The files are extracted by running the
% \xext{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/tablefootnote.sty\\
%   tablefootnote.pdf & doc/latex/tablefootnote/tablefootnote.pdf\\
%   tablefootnote-example.tex & doc/latex/tablefootnote/tablefootnote-example.tex\\
%   tablefootnote-example.pdf & doc/latex/tablefootnote/tablefootnote-example.pdf\\
%   tablefootnote.dtx & source/latex/tablefootnote/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
% \xfile{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 the following
% 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\\
% \indent |latex tablefootnote-example.tex|,\\
% \indent |lualatex tablefootnote-example.tex|,\\
% or (recommended)\\
% \indent |pdflatex thumbs-example.tex|\\
% and will need at least two compiler runs to get everything right.
%
% \bigskip
%
% \section{Acknowledgements}
%
% I would like to thank \textsc{Heiko Oberdiek} for providing
% the \xpackage{hyperref}, \xpackage{ifluatex}, \xpackage{letltxmacro},
% \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 for information about the \pdfTeX{}-bug,
% \textsc{Arno Trautmann} for reporting the bug (misplaced hyperreferences in
% |sidewaystable|s using \LuaTeX{}, independently of the \xpackage{tablefootnote}
% package or footnotes at all)\footnote{The \xpackage{tablefootnote} package %
% seems to be helpful to detect issues in other things (which does not mean %
% that it does not create its own bugs!).} and the \Newsgroup{comp.text.tex}
% and \Newsgroup{de.comp.text.tex} newsgroups for their help in all things \TeX{}.
%
% \pagebreak
%
% \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}
%   \begin{Version}{2011/11/06 v1.0c}
%     \item Replaced |^{\text{\thefootnote}}| by |{}^{\text{\textup{\thefootnote}}}|.
%     \item Bug fix: When \xpackage{etoolbox.sty} was not found, and the \xpackage{float}
%             package had been loaded, and the float specifier was \texttt{H},
%             then the |\tablefootnote|s were not printed for that table. Fixed.
%     \item Minor details.
%   \end{Version}
%   \begin{Version}{2011/11/19 v1.0d}
%     \item Replaced |{}^{\text{\textup{\thefootnote}}}| by
%             |\textsuperscript{\thefootnote}|, therefore the \xpackage{amstext}
%             package is no longer required by the \xpackage{tablefootnote} package.
%     \item \xpackage{lscape} and \xpackage{pdflscape} package now work with
%             \xpackage{tablefootnote} (except for using a \texttt{sidewaystable} on
%             a \texttt{landscape} page).
%     \item Added information about footnotes in \texttt{sidewaystable} being printed
%             one below the other, even if \xpackage{footmisc} package with option
%             \texttt{para} is used.
%     \item Redefined |\tfn@swtbox| from
%  \begin{verbatim}
%  \vspace{0.8cm}%
%  \begin{spacing}{0.1}%
%  \subcaptionbox*{}[\linewidth][l]{\tfn@tablefootnoteprintout}%
%  \end{spacing}%
%  \end{verbatim}
%             to
%  \begin{verbatim}
%  \vspace{2\baselineskip}%
%  \parbox[b][][t]{\linewidth}{\raggedright \tfn@tablefootnoteprintout}%
%  \end{verbatim}
%             , therefore the \xpackage{setspace} and \xpackage{subcaption} packages
%             are no longer required by the \xpackage{tablefootnote} package.
%     \item No longer uses |\numexpr|, therefore also usable without \eTeX{}.
%     \item Replaced |\textsuperscript{\thefootnote}| by
%             |\hbox {\@textsuperscript {\normalfont \thefootnote }}|,
%             which is next to the original definition of |\@makefnmark|
%             (|\hbox {\@textsuperscript {\normalfont \@thefnmark }}|,
%             but according to |\show\@thefnmark| here |\@thefnmark| is
%             |{\protect \itshape}| instead of |\thefootnote|).
%     \item Added an error message, when \LuaTeX{}, \xpackage{rotating} package, and
%            \xpackage{hyperref} package are used together. Hyperreferences in
%            |sidewaystable|s are misplaced, independently of the
%            \xpackage{tablefootnote} package or footnotes at all. (Bug reported
%            by \textsc{Arno Trautmann}, 2011/11/15 - thanks!)
%     \item Added footnotesymbol-footnote-numbers in the example.
%     \item Several details.
%   \end{Version}
%   \begin{Version}{2011/11/26 v1.0e}
%     \item Check for \xpackage{hyperref} is only done once.
%     \item Message regarding the misplacement of hyperlinks by \LuaLaTeX{}
%             changed form error to warning.
%     \item Replaced |\vspace{2\baselineskip}| by
%  \begin{verbatim}
% \ifvoid \footins%
% \vskip 2\baselineskip%
% \else%
% \vskip \skip\footins%
% \fi%
%  \end{verbatim}
%             between the |sidewaystable|s and their footnotes.
%     \item The warning about un-regarded |para|-option of \xpackage{footmoisc}
%            package is only given at the second |tablefootnote| in a |sidewaystable|,
%            not repeatedly for every |tablefootnote| in a |sidewaystable|.
%     \item Minor details.
%   \end{Version}
%   \begin{Version}{2012/01/01 v1.0f}
%     \item Bugfix: Wrong installation path given in the documentation, fixed.
%     \item Minor details.
%     \item Update of documentation, README, and \xfile{dtx} internals.
%   \end{Version}
%   \begin{Version}{2012/01/14 v1.0g}
%     \item Bugfix: There was a |relax| instead of a |\relax|, fixed.
%   \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.)
%
% \bigskip
%
% \PrintIndex
%
% \Finale
\endinput