summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/latex/fnbreak/fnbreak.sty
blob: c74d658f82c427caf2cf8ad08403c04a342fb5f2 (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
%%
%% This is file `fnbreak.sty',
%% generated with the docstrip utility.
%%
%% The original source files were:
%%
%% fnbreak.dtx  (with options: `package')
%% 
%%   fnbreak package
%% 
%%   Copyright 2003, 2004, 2006, 2010, 2012 Harald Harders
%% 
%%   This program can be redistributed and/or modified under the terms
%%   of the LaTeX Project Public License Distributed from CTAN
%%   archives in directory macros/latex/base/lppl.txt; either
%%   version 1.3 of the License, or any later version.
%% 
%%   harald.harders@gmx.de
%% 
\ProvidesPackage{fnbreak}
  [2012/01/01  v1.30  Warning for pagebreak in footnote (HH)]
\RequirePackage{ifthen}
\newif\iffnb@showlabel
\newif\iffnb@verbose
\DeclareOption{label}{\fnb@showlabeltrue}
\DeclareOption{nolabel}{\fnb@showlabelfalse}
\DeclareOption{verbose}{\fnb@verbosetrue}
\DeclareOption{nonverbose}{\fnb@verbosefalse}
\ExecuteOptions{label,nonverbose}
\ProcessOptions\relax
\newcommand*\fnbreakverbose{\fnb@verbosetrue}
\newcommand*\fnbreaknonverbose{\fnb@verbosefalse}
\newcommand*\fnbreaklabel{\fnb@showlabeltrue}
\newcommand*\fnbreaknolabel{\fnb@showlabelfalse}
\newcounter{fnb@@numberpages}
\newif\iffnb@@isdoublepage
\xdef\fnb@@footnotestartnum{0}
\xdef\fnb@@footnotestartpage{0}
\def\fnb@footnotestart#1#2#3{}
\def\fnb@footnoteend#1#2#3{}
\AtBeginDocument{%
  \def\fnb@footnotestart#1#2#3{%
    \xdef\fnb@@footnotestartnum{#1}%
    \gdef\fnb@@footnotestartpage{#3}%
  }%
  \def\fnb@footnoteend#1#2#3{%
    \xdef\fnb@@footnoteendnum{#1}%
    \def\fnb@@footnoteendpage{#3}%
    \ifx\fnb@@footnotestartnum\fnb@@footnoteendnum
      \ifthenelse{\equal{\fnb@@footnotestartpage}{\fnb@@footnoteendpage}}{%
        \iffnb@verbose
          \begingroup
            \def\MessageBreak{^^J(fnbreak)\@spaces\@spaces\@spaces\@spaces}%
            \set@display@protect
            \immediate\write\@unused{^^JPackage fnbreak Note:%
              \space\space\space\space Footnote number #1
            \iffnb@showlabel\MessageBreak (label `#2') \fi
            \MessageBreak
            completely on page #3.^^J}%
          \endgroup
        \fi
      }{%
        \setcounter{fnb@@numberpages}{0}%
        \if@twoside
          \ifnum\number0<0\fnb@@footnoteendpage{}%
            \ifnum\number0<0\fnb@@footnotestartpage{}%
              \setcounter{fnb@@numberpages}{\fnb@@footnoteendpage}%
              \addtocounter{fnb@@numberpages}{-\fnb@@footnotestartpage}%
              \addtocounter{fnb@@numberpages}{1}%
              \ifodd \fnb@@footnotestartpage{}%
                \fnb@@isdoublepagefalse
              \else
                \ifnum \thefnb@@numberpages=2{}%
                  \fnb@@isdoublepagetrue
                \else
                  \fnb@@isdoublepagefalse
                \fi
              \fi
            \fi
          \fi
        \fi
        \ifnum\thefnb@@numberpages=0
          \PackageWarningNoLine{fnbreak}{Footnote number #1
            \iffnb@showlabel\MessageBreak (label `#2')\fi
            \MessageBreak
            has been split over different pages:\MessageBreak
            page \fnb@@footnotestartpage\space to page #3}%
        \else
          \iffnb@@isdoublepage
            \PackageWarningNoLine{fnbreak}{Footnote number #1
              \iffnb@showlabel\MessageBreak (label `#2')\fi
              \MessageBreak
              has been split over different pages (double page):\MessageBreak
              page \fnb@@footnotestartpage\space to page #3}%
          \else
            \PackageWarningNoLine{fnbreak}{Footnote number #1
              \iffnb@showlabel\MessageBreak (label `#2')\fi
              \MessageBreak
              has been split over different pages (flipside):\MessageBreak
              page \fnb@@footnotestartpage\space to page #3}%
          \fi
        \fi
        \def\fnb@globalwarning{%
          \PackageWarningNoLine{fnbreak}{There are footnotes with a
            pagebreak.\MessageBreak
            Check if they are acceptable}%
        }%
      }%
    \else
      \PackageError{fnbreak}{Internal problem:\MessageBreak
        Start and stop marker of footnote do not fit:\MessageBreak
        start: \fnb@@footnotestartnum, page \fnb@@footnotestartpage,
        end: #1, page #3}{%
        This error may not happen.
        Please try to make a short example which shows this behaviour
        and send a bug report to harald.harders@gmx.de.}%
    \fi
    }%
  }
  \def\fnb@fnstart{\@bsphack
    \protected@write\@auxout{}{%
      \string\fnb@footnotestart{\the\c@footnote}{\thefootnote}{\thepage}%
    }%
    \@esphack
  }
  \def\fnb@fnend{\@bsphack
    \protected@write\@auxout{}{%
      \string\fnb@footnoteend{\the\c@footnote}{\thefootnote}{\thepage}%
    }%
    \@esphack
  }
\AtBeginDocument{%
  \newcommand\fnb@orig@footnotetext{}%
  \let\fnb@orig@footnotetext\@footnotetext
  \long\def\@footnotetext#1{\fnb@orig@footnotetext{\fnb@fnstart#1\fnb@fnend}}%
  \newcommand\fnb@dofilelist{}%
  \let\fnb@dofilelist\@dofilelist
  \def\@dofilelist{\fnb@dofilelist\fnb@globalwarning}%
}
\newcommand\fnb@globalwarning{}%
\let\fnb@globalwarning\relax
\endinput
%%
%% End of file `fnbreak.sty'.