diff options
author | Karl Berry <karl@freefriends.org> | 2014-11-02 21:50:27 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2014-11-02 21:50:27 +0000 |
commit | 4443aa712503e8404b2152c761c2ab5e1a98d197 (patch) | |
tree | c387f072c69b1415bca5a9878ce161eb50cad9ce /Master/texmf-dist | |
parent | 5c146a8c39f3d52b9b6aba7423a0984e5830f407 (diff) |
bigfoot (2nov14)
git-svn-id: svn://tug.org/texlive/trunk@35482 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist')
16 files changed, 1548 insertions, 658 deletions
diff --git a/Master/texmf-dist/doc/latex/bigfoot/COPYING b/Master/texmf-dist/doc/latex/bigfoot/COPYING new file mode 100644 index 00000000000..d159169d105 --- /dev/null +++ b/Master/texmf-dist/doc/latex/bigfoot/COPYING @@ -0,0 +1,339 @@ + GNU GENERAL PUBLIC LICENSE + Version 2, June 1991 + + Copyright (C) 1989, 1991 Free Software Foundation, Inc., + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + Preamble + + The licenses for most software are designed to take away your +freedom to share and change it. By contrast, the GNU General Public +License is intended to guarantee your freedom to share and change free +software--to make sure the software is free for all its users. This +General Public License applies to most of the Free Software +Foundation's software and to any other program whose authors commit to +using it. (Some other Free Software Foundation software is covered by +the GNU Lesser General Public License instead.) You can apply it to +your programs, too. + + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +this service if you wish), that you receive source code or can get it +if you want it, that you can change the software or use pieces of it +in new free programs; and that you know you can do these things. + + To protect your rights, we need to make restrictions that forbid +anyone to deny you these rights or to ask you to surrender the rights. +These restrictions translate to certain responsibilities for you if you +distribute copies of the software, or if you modify it. + + For example, if you distribute copies of such a program, whether +gratis or for a fee, you must give the recipients all the rights that +you have. You must make sure that they, too, receive or can get the +source code. And you must show them these terms so they know their +rights. + + We protect your rights with two steps: (1) copyright the software, and +(2) offer you this license which gives you legal permission to copy, +distribute and/or modify the software. + + Also, for each author's protection and ours, we want to make certain +that everyone understands that there is no warranty for this free +software. If the software is modified by someone else and passed on, we +want its recipients to know that what they have is not the original, so +that any problems introduced by others will not reflect on the original +authors' reputations. + + Finally, any free program is threatened constantly by software +patents. We wish to avoid the danger that redistributors of a free +program will individually obtain patent licenses, in effect making the +program proprietary. To prevent this, we have made it clear that any +patent must be licensed for everyone's free use or not licensed at all. + + The precise terms and conditions for copying, distribution and +modification follow. + + GNU GENERAL PUBLIC LICENSE + TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION + + 0. This License applies to any program or other work which contains +a notice placed by the copyright holder saying it may be distributed +under the terms of this General Public License. The "Program", below, +refers to any such program or work, and a "work based on the Program" +means either the Program or any derivative work under copyright law: +that is to say, a work containing the Program or a portion of it, +either verbatim or with modifications and/or translated into another +language. (Hereinafter, translation is included without limitation in +the term "modification".) Each licensee is addressed as "you". + +Activities other than copying, distribution and modification are not +covered by this License; they are outside its scope. The act of +running the Program is not restricted, and the output from the Program +is covered only if its contents constitute a work based on the +Program (independent of having been made by running the Program). +Whether that is true depends on what the Program does. + + 1. You may copy and distribute verbatim copies of the Program's +source code as you receive it, in any medium, provided that you +conspicuously and appropriately publish on each copy an appropriate +copyright notice and disclaimer of warranty; keep intact all the +notices that refer to this License and to the absence of any warranty; +and give any other recipients of the Program a copy of this License +along with the Program. + +You may charge a fee for the physical act of transferring a copy, and +you may at your option offer warranty protection in exchange for a fee. + + 2. You may modify your copy or copies of the Program or any portion +of it, thus forming a work based on the Program, and copy and +distribute such modifications or work under the terms of Section 1 +above, provided that you also meet all of these conditions: + + a) You must cause the modified files to carry prominent notices + stating that you changed the files and the date of any change. + + b) You must cause any work that you distribute or publish, that in + whole or in part contains or is derived from the Program or any + part thereof, to be licensed as a whole at no charge to all third + parties under the terms of this License. + + c) If the modified program normally reads commands interactively + when run, you must cause it, when started running for such + interactive use in the most ordinary way, to print or display an + announcement including an appropriate copyright notice and a + notice that there is no warranty (or else, saying that you provide + a warranty) and that users may redistribute the program under + these conditions, and telling the user how to view a copy of this + License. (Exception: if the Program itself is interactive but + does not normally print such an announcement, your work based on + the Program is not required to print an announcement.) + +These requirements apply to the modified work as a whole. If +identifiable sections of that work are not derived from the Program, +and can be reasonably considered independent and separate works in +themselves, then this License, and its terms, do not apply to those +sections when you distribute them as separate works. But when you +distribute the same sections as part of a whole which is a work based +on the Program, the distribution of the whole must be on the terms of +this License, whose permissions for other licensees extend to the +entire whole, and thus to each and every part regardless of who wrote it. + +Thus, it is not the intent of this section to claim rights or contest +your rights to work written entirely by you; rather, the intent is to +exercise the right to control the distribution of derivative or +collective works based on the Program. + +In addition, mere aggregation of another work not based on the Program +with the Program (or with a work based on the Program) on a volume of +a storage or distribution medium does not bring the other work under +the scope of this License. + + 3. You may copy and distribute the Program (or a work based on it, +under Section 2) in object code or executable form under the terms of +Sections 1 and 2 above provided that you also do one of the following: + + a) Accompany it with the complete corresponding machine-readable + source code, which must be distributed under the terms of Sections + 1 and 2 above on a medium customarily used for software interchange; or, + + b) Accompany it with a written offer, valid for at least three + years, to give any third party, for a charge no more than your + cost of physically performing source distribution, a complete + machine-readable copy of the corresponding source code, to be + distributed under the terms of Sections 1 and 2 above on a medium + customarily used for software interchange; or, + + c) Accompany it with the information you received as to the offer + to distribute corresponding source code. (This alternative is + allowed only for noncommercial distribution and only if you + received the program in object code or executable form with such + an offer, in accord with Subsection b above.) + +The source code for a work means the preferred form of the work for +making modifications to it. For an executable work, complete source +code means all the source code for all modules it contains, plus any +associated interface definition files, plus the scripts used to +control compilation and installation of the executable. However, as a +special exception, the source code distributed need not include +anything that is normally distributed (in either source or binary +form) with the major components (compiler, kernel, and so on) of the +operating system on which the executable runs, unless that component +itself accompanies the executable. + +If distribution of executable or object code is made by offering +access to copy from a designated place, then offering equivalent +access to copy the source code from the same place counts as +distribution of the source code, even though third parties are not +compelled to copy the source along with the object code. + + 4. You may not copy, modify, sublicense, or distribute the Program +except as expressly provided under this License. Any attempt +otherwise to copy, modify, sublicense or distribute the Program is +void, and will automatically terminate your rights under this License. +However, parties who have received copies, or rights, from you under +this License will not have their licenses terminated so long as such +parties remain in full compliance. + + 5. You are not required to accept this License, since you have not +signed it. However, nothing else grants you permission to modify or +distribute the Program or its derivative works. These actions are +prohibited by law if you do not accept this License. Therefore, by +modifying or distributing the Program (or any work based on the +Program), you indicate your acceptance of this License to do so, and +all its terms and conditions for copying, distributing or modifying +the Program or works based on it. + + 6. Each time you redistribute the Program (or any work based on the +Program), the recipient automatically receives a license from the +original licensor to copy, distribute or modify the Program subject to +these terms and conditions. You may not impose any further +restrictions on the recipients' exercise of the rights granted herein. +You are not responsible for enforcing compliance by third parties to +this License. + + 7. If, as a consequence of a court judgment or allegation of patent +infringement or for any other reason (not limited to patent issues), +conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot +distribute so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you +may not distribute the Program at all. For example, if a patent +license would not permit royalty-free redistribution of the Program by +all those who receive copies directly or indirectly through you, then +the only way you could satisfy both it and this License would be to +refrain entirely from distribution of the Program. + +If any portion of this section is held invalid or unenforceable under +any particular circumstance, the balance of the section is intended to +apply and the section as a whole is intended to apply in other +circumstances. + +It is not the purpose of this section to induce you to infringe any +patents or other property right claims or to contest validity of any +such claims; this section has the sole purpose of protecting the +integrity of the free software distribution system, which is +implemented by public license practices. Many people have made +generous contributions to the wide range of software distributed +through that system in reliance on consistent application of that +system; it is up to the author/donor to decide if he or she is willing +to distribute software through any other system and a licensee cannot +impose that choice. + +This section is intended to make thoroughly clear what is believed to +be a consequence of the rest of this License. + + 8. If the distribution and/or use of the Program is restricted in +certain countries either by patents or by copyrighted interfaces, the +original copyright holder who places the Program under this License +may add an explicit geographical distribution limitation excluding +those countries, so that distribution is permitted only in or among +countries not thus excluded. In such case, this License incorporates +the limitation as if written in the body of this License. + + 9. The Free Software Foundation may publish revised and/or new versions +of the General Public License from time to time. Such new versions will +be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. + +Each version is given a distinguishing version number. If the Program +specifies a version number of this License which applies to it and "any +later version", you have the option of following the terms and conditions +either of that version or of any later version published by the Free +Software Foundation. If the Program does not specify a version number of +this License, you may choose any version ever published by the Free Software +Foundation. + + 10. If you wish to incorporate parts of the Program into other free +programs whose distribution conditions are different, write to the author +to ask for permission. For software which is copyrighted by the Free +Software Foundation, write to the Free Software Foundation; we sometimes +make exceptions for this. Our decision will be guided by the two goals +of preserving the free status of all derivatives of our free software and +of promoting the sharing and reuse of software generally. + + NO WARRANTY + + 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY +FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN +OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES +PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED +OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS +TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE +PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, +REPAIR OR CORRECTION. + + 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR +REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, +INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING +OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED +TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY +YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER +PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE +POSSIBILITY OF SUCH DAMAGES. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Programs + + If you develop a new program, and you want it to be of the greatest +possible use to the public, the best way to achieve this is to make it +free software which everyone can redistribute and change under these terms. + + To do so, attach the following notices to the program. It is safest +to attach them to the start of each source file to most effectively +convey the exclusion of warranty; and each file should have at least +the "copyright" line and a pointer to where the full notice is found. + + <one line to give the program's name and a brief idea of what it does.> + Copyright (C) <year> <name of author> + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License along + with this program; if not, write to the Free Software Foundation, Inc., + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + +Also add information on how to contact you by electronic and paper mail. + +If the program is interactive, make it output a short notice like this +when it starts in an interactive mode: + + Gnomovision version 69, Copyright (C) year name of author + Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. + This is free software, and you are welcome to redistribute it + under certain conditions; type `show c' for details. + +The hypothetical commands `show w' and `show c' should show the appropriate +parts of the General Public License. Of course, the commands you use may +be called something other than `show w' and `show c'; they could even be +mouse-clicks or menu items--whatever suits your program. + +You should also get your employer (if you work as a programmer) or your +school, if any, to sign a "copyright disclaimer" for the program, if +necessary. Here is a sample; alter the names: + + Yoyodyne, Inc., hereby disclaims all copyright interest in the program + `Gnomovision' (which makes passes at compilers) written by James Hacker. + + <signature of Ty Coon>, 1 April 1989 + Ty Coon, President of Vice + +This General Public License does not permit incorporating your program into +proprietary programs. If your program is a subroutine library, you may +consider it more useful to permit linking proprietary applications with the +library. If this is what you want to do, use the GNU Lesser General +Public License instead of this License. diff --git a/Master/texmf-dist/doc/latex/bigfoot/Makefile b/Master/texmf-dist/doc/latex/bigfoot/Makefile new file mode 100644 index 00000000000..eb4867d5556 --- /dev/null +++ b/Master/texmf-dist/doc/latex/bigfoot/Makefile @@ -0,0 +1,49 @@ +TEX=tex +PDFLATEX=pdflatex +DTX=bigfoot.dtx suffix.dtx perpage.dtx +DIST=README COPYING $(DTX) Makefile bigfoot.ins +DOC=$(DTX:.dtx=.pdf) + +all: $(DIST) $(DTX:.dtx=.sty) $(DOC) + +bigfoot-mk.ins: bigfoot.dtx Makefile + $(TEX) '\nonstopmode \def\jobname{.ins}\input docstrip ' \ + '\askforoverwritefalse \nopreamble' \ + '\generate{\file{bigfoot-mk.ins}{\from{bigfoot.dtx}{installer,make}}}' \ + '\endbatchfile' + +# Not generated by bigfoot-mk.ins in order to allow for hand-editing, +# like putting debug options in +bigfoot.ins: bigfoot.dtx Makefile + $(TEX) '\nonstopmode \def\jobname{.ins}\input docstrip ' \ + '\askforoverwritefalse \nopreamble' \ + '\generate{\file{bigfoot.ins}{\from{bigfoot.dtx}{installer}}}' \ + '\endbatchfile' + +bigfoot.drv bigfoot.sty perpage.drv perpage.sty suffix.drv suffix.sty: bigfoot-mk.ins + $(TEX) bigfoot-mk.ins + +bigfoot.drv bigfoot.sty: bigfoot.dtx +perpage.drv perpage.sty: perpage.dtx +suffix.drv suffix.sty: suffix.dtx + +bigfoot.pdf: bigfoot.dtx bigfoot.drv bigfoot.sty perpage.sty suffix.sty + $(PDFLATEX) '\nonstopmode\input{bigfoot.drv}' + $(PDFLATEX) '\nonstopmode\input{bigfoot.drv}' + $(PDFLATEX) '\nonstopmode\input{bigfoot.drv}' + +perpage.pdf: perpage.dtx perpage.drv + $(PDFLATEX) '\nonstopmode\input{perpage.drv}' + $(PDFLATEX) '\nonstopmode\input{perpage.drv}' + $(PDFLATEX) '\nonstopmode\input{perpage.drv}' + +suffix.pdf: suffix.dtx suffix.drv + $(PDFLATEX) '\nonstopmode\input{suffix.drv}' + $(PDFLATEX) '\nonstopmode\input{suffix.drv}' + $(PDFLATEX) '\nonstopmode\input{suffix.drv}' + +bigfoot.tar.gz: $(DIST) + tar czf $@ $(DIST) + +bigfoot-ctan.tar.gz: $(DIST) $(DOC) + tar czf $@ --transform 's,^\(\./\)\?,bigfoot/,' $(DIST) $(DOC) diff --git a/Master/texmf-dist/doc/latex/bigfoot/README b/Master/texmf-dist/doc/latex/bigfoot/README index b85d8f9f2f2..1ce209de090 100644 --- a/Master/texmf-dist/doc/latex/bigfoot/README +++ b/Master/texmf-dist/doc/latex/bigfoot/README @@ -4,29 +4,47 @@ package in development can be accessed using the CVS instructions at <URL:http://sarovar.org/projects/bigfoot>, and CTAN:/macros/latex/contrib/bigfoot provides released versions. -The whole bundle is released under the GPL version 2 (or later). Part -of the work has been sponsored or commissioned by various parties -(including TUG), but further functionality and development depends on -your support, financially or by participation. The author has a -Paypal account which you might consider contributing to. +The whole bundle is released under the GPL version 2 (or later), see +the file COPYING for details. Part of the work has been sponsored or +commissioned by various parties (including TUG), but further +functionality and development depends on your support, financially or +by participation. The author has a Paypal account which you might +consider contributing to. All of the files (except perpage.sty, for historical reasons) need -eTeX 2 as the LaTeX engine. Newer distributions already are -eTeX-based; with older distributions you might need to use the -`elatex' command. +eTeX 2 as the LaTeX engine. All modern distributions provide this by +default. + +A Makefile is provided for generating most files. In case the +platform does not support Make, the distribution tarball includes the +file bigfoot.ins pregenerated from bigfoot.dtx. File descriptions for available files: -bigfoot.ins: This is a generated file and not in the CVS archive (but - on CTAN). If you need to generate it, you can do so by running - `tex docstrip' and answering the prompts +bigfoot.ins: This is a generated file and not in the Git repository (but + on CTAN). Generating it can be done by running `tex docstrip' and + answering the prompts \infileext=dtx \outfileext=ins \Options=installer \filelist=bigfoot - Running TeX on bigfoot.ins will generate further files. + If you instead use + + \Options=installer,make + + you will get a version of `bigfoot.ins' which will not ask before + overwriting files, but will only place them in the current + directory even if your docstrip configuration contains target + directory declarations. + + Running TeX on bigfoot.ins will generate a number of style files + (with the extension .sty) and a number of documentation driver + files (with the extension .drv). + + +Here come the source files themselves: suffix.dtx: This is the doc source for `suffix.sty', a package that makes it very easy to define command variants like \macro* or diff --git a/Master/texmf-dist/doc/latex/bigfoot/bigfoot.pdf b/Master/texmf-dist/doc/latex/bigfoot/bigfoot.pdf Binary files differindex 758c0b5dc90..93a2ca3056c 100644 --- a/Master/texmf-dist/doc/latex/bigfoot/bigfoot.pdf +++ b/Master/texmf-dist/doc/latex/bigfoot/bigfoot.pdf diff --git a/Master/texmf-dist/doc/latex/bigfoot/perpage.pdf b/Master/texmf-dist/doc/latex/bigfoot/perpage.pdf Binary files differindex 1afa69d9461..ebdbf7c5f72 100644 --- a/Master/texmf-dist/doc/latex/bigfoot/perpage.pdf +++ b/Master/texmf-dist/doc/latex/bigfoot/perpage.pdf diff --git a/Master/texmf-dist/doc/latex/bigfoot/suffix.pdf b/Master/texmf-dist/doc/latex/bigfoot/suffix.pdf Binary files differindex 58256594ce3..7e0ac2fe2d3 100644 --- a/Master/texmf-dist/doc/latex/bigfoot/suffix.pdf +++ b/Master/texmf-dist/doc/latex/bigfoot/suffix.pdf diff --git a/Master/texmf-dist/source/latex/bigfoot/bigfoot.drv b/Master/texmf-dist/source/latex/bigfoot/bigfoot.drv index 1eed69b8ee1..84916b732f5 100644 --- a/Master/texmf-dist/source/latex/bigfoot/bigfoot.drv +++ b/Master/texmf-dist/source/latex/bigfoot/bigfoot.drv @@ -22,7 +22,10 @@ %% in the same archive or directory.) %% %% bigfoot is part of the bigfoot bundle for critical typesetting -%% Copyright 2004, 05, 06 David Kastrup <dak@gnu.org> +%% Copyright 2004--2014 David Kastrup <dak@gnu.org> +%% +%% The license notice and corresponding source code for this file are +%% contained in bigfoot.dtx. %% \documentclass{ltxdoc} \usepackage{bigfoot} diff --git a/Master/texmf-dist/source/latex/bigfoot/bigfoot.dtx b/Master/texmf-dist/source/latex/bigfoot/bigfoot.dtx index feaddf19929..be78a65452c 100644 --- a/Master/texmf-dist/source/latex/bigfoot/bigfoot.dtx +++ b/Master/texmf-dist/source/latex/bigfoot/bigfoot.dtx @@ -1,7 +1,10 @@ % \iffalse %% %% bigfoot is part of the bigfoot bundle for critical typesetting -%% Copyright 2004, 05, 06 David Kastrup <dak@gnu.org> +%% Copyright 2004--2014 David Kastrup <dak@gnu.org> +%% +%% The license notice and corresponding source code for this file are +%% contained in bigfoot.dtx. %% % This program is free software; you can redistribute it and/or modify % it under the terms of the GNU General Public License as published by @@ -17,7 +20,7 @@ % along with this program; if not, write to the Free Software % Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA % \fi -% \CheckSum{4157} +% \CheckSum{4576} % \GetFileInfo{bigfoot.sty} % \title{The \texttt{bigfoot} package\\version \fileversion} % \date{\filedate} @@ -40,7 +43,7 @@ % long ``u'', but that's just obvious in spoken Latin.}} % that is higher on the page. % \item The last footnote in each apparatus may be broken to the next -% page\footnote{This will probably be interesting for footnotes +% page.\footnote{This will probably be interesting for footnotes % that contain stuff like math equations\footnoteB+{Like % \begin{equation} % \label{eq:1} @@ -64,7 +67,7 @@ % \item Footnotes can be formatted in separate paragraphs, or be run % into a single paragraph. The choice is made per footnote % apparatus, but can be overridden for single -% footnotes.\footnote{Footnotes containing material like display +% footnotes.\footnote{I.e., footnotes with display % math\footnoteB{We had this already, right?} or list % environments\footnoteB{And this looks familiar, too.} have to be % done in vertical mode.} @@ -148,9 +151,7 @@ % \begin{macrocode} %<*style> \NeedsTeXFormat{LaTeX2e} -\def\FN@next $#1: #2 #3${#2} -\ProvidesPackage{bigfoot}[\FN@next $Date: 2006/07/15 21:24:56 $ - \FN@next $Revision: 1.25 $ makes footnotes work]%} +\ProvidesPackage{bigfoot}[2014/10/23 2.0 makes footnotes work] \DeclareOption{para}{\PackageInfo{bigfoot}{Compatibility option `para' has no effect:^^J% @@ -165,6 +166,19 @@ \DeclareOption{ruled}{\PassOptionsToPackage{ruled}{manyfoot}} % \end{macrocode} +% The normal processing makes footnote text macros allow verbatim and +% similar. We call this |robust| processing though it is not totally +% accurate. This is the default. There is also an option |fragile| +% which will not allow this, but may be required for some definitions +% of \cmd{\@makefntext}. It turns out that most document classes work +% with the `robust' option, but there might be some that fail, and +% there might be some footnote-modifying packages that also can cause +% failure. +% \begin{macrocode} +\DeclareOption{robust}{\def\FN@makefncall{\FN@makefnrobust}} +\DeclareOption{fragile}{\def\FN@makefncall{\FN@makefnfragile}} +\ExecuteOptions{robust} +% \end{macrocode} % The |verbose| option talks about changed labels at the end of a % run. It is for debugging instable configurations that fail to % converge after a number of \TeX\ runs. The output is probably @@ -303,12 +317,13 @@ }% } -\def\MFL@minipage{% - \ifinner\else - \let\MFL@mpinsertsave\MFL@insert - \MFL@reinsert \let\MFL@insert\MFL@mpinsert - \fi -} +\def\FN@divert{% + \let\MFL@mpinsertsave\MFL@insert + \MFL@reinsert \let\MFL@insert\MFL@mpinsert} +\def\FN@enddivert{{\let\@elt\MFL@mpreinsert \MFL@list}} + +\def\MFL@minipage{\ifinner\else \FN@divert\fi} +\def\MFL@endminipage{\ifinner\else \FN@enddivert\fi} % \end{macrocode} % \end{macro} % \end{macro} @@ -343,7 +358,7 @@ % \end{macrocode} % \end{macro} % \begin{macro}{\MFL@removevboxes} -% The trick is like with \cmd{\removehboxes} in the \TeX book's +% This trick works like \cmd{\removehboxes} in the \TeX book's % appendix~D. % \begin{macrocode} \def\MFL@removevboxes{{\setbox\z@\lastbox @@ -604,6 +619,21 @@ \iffalse}\fi} % \end{macrocode} % +% \subsubsection{Continuation marks} +% +% We add a possibility of adding continuation marks. While the box is +% assembled, immediately before the break, \cmd{\FN@beforebreak} gets +% called, and \cmd{\FN@afterbreak} is called at the top of the +% continuing box. +% \begin{macrocode} +\ifx\FN@beforebreak\@undefined + \let\FN@beforebreak\@empty +\fi +\ifx\FN@afterbreak\@undefined + \let\FN@afterbreak\@empty +\fi +% \end{macrocode} +% % %\subsubsection{The works} % @@ -724,7 +754,7 @@ % \begin{macrocode} \def\@makefnvtext#1{% \FN@specific\FN@masterinsert\@makefntext{% - \clubpenalties\tw@\@MM\clubpenalty + \clubpenalties\thr@@\@MM\clubpenalty\z@ \vadjust{\nobreak\vskip-\baselineskip}\nobreak\hfill\break#1}} % \end{macrocode} % \end{macro} @@ -780,6 +810,9 @@ % \end{macro} % \begin{macrocode} \def\@makefnstartbox{% + \ifdefined\setspace@singlespace + \def\baselinestretch{\setspace@singlespace}% + \fi \reset@font\footnotesize \hsize\MFL@columnwidth \@parboxrestore \interlinepenalty\FN@specific\FN@masterinsert\interfootnotelinepenalty @@ -798,16 +831,16 @@ \finalfootnotewidowpenalty=4000 % \end{macrocode} % \begin{macro}{\@makefnvbox} -% This is the formatting code for a vertical mode footnote box. It -% uses \cmd{\@makefnstartbox} for setting up the initial widow/club -% penalties, and \cmd{\@makefnendbox} for preparing the final end. It -% results in a vbox, but its argument, a stream of horizontal and -% vertical material, is typeset in +% This is the formatting code for a vertical mode footnote box from +% already set horizontal material. It uses \cmd{\@makefnstartbox} +% for setting up the initial widow/club penalties, and +% \cmd{\@makefnendbox} for preparing the final end. It results in a +% vbox. % \begin{macrocode} \ifx\@makefnvbox\@undefined \def\@makefnvbox#1{\vbox{% \@makefnstartbox - \clubpenalties\tw@\@MM\clubpenalty + \clubpenalties\thr@@\@MM\clubpenalty\z@ \let\@thefnmark\@empty \FN@specific\FN@masterinsert\@makefntext{\rule\z@\footnotesep \nobreak @@ -821,15 +854,12 @@ % Those parameters govern when a footnote block is going to be set % completely in vertical mode. If a footnote block does not shrink % to less than \cmd{\hfootfraction} its size when using in-paragraph -% notes and, has at least \cmd{\vtypefraction} of forcedly vertical +% notes or has at least \cmd{\vtypefraction} of forcedly vertical % footnotes (specified as purely vertical, or vertical because of % being large), it is set entirely in vertical mode. -% -% In addition, the ratio of purely vertical footnotes must not fall -% below \cmd{\vtypefraction}. % \begin{macrocode} \def\hfootfraction{0.9} -\def\vtypefraction{0.6} +\def\vtypefraction{0.7} % \end{macrocode} % \end{macro} % \end{macro} @@ -875,12 +905,13 @@ \setbox\z@\@makefnvbox{% {\unhbox\FN@tempbox}% \setbox\z@\lastbox\FN@joinhboxes}% - \ifdim\FN@vfound>\dimexpr\vtypefraction\p@*\FN@found\relax - \ifdim\dimexpr \ht\z@+\dp\z@>\hfootfraction\dimen@ii - \global\setbox\FN@tempbox\box\tw@ - \setbox\z@\@makefnvbox{\let\@makefnbreak\FN@pseudofillbreak - {\unhbox\FN@tempbox}\setbox\z@\lastbox\FN@joinhboxes}% - \fi + \ifcase + \ifdim\FN@vfound>\dimexpr\vtypefraction\p@*\FN@found\relax \@ne\fi + \ifdim\dimexpr \ht\z@+\dp\z@>\hfootfraction\dimen@ii \@ne\fi \z@ + \or + \global\setbox\FN@tempbox\box\tw@ + \setbox\z@\@makefnvbox{\let\@makefnbreak\FN@pseudofillbreak + {\unhbox\FN@tempbox}\setbox\z@\lastbox\FN@joinhboxes}% \fi \setbox\tw@\box\voidb@x \ht\z@\dimexpr \ht\z@+\dp\z@-\dimen@\relax @@ -958,8 +989,8 @@ % calculation. % \begin{macrocode} \def\FN@pseudobreak{% - {\parskip\z@skip\parfillskip\z@skip\parindent\z@\vadjust{}\par\noindent - \vadjust{\nobreak\vskip-\baselineskip}\nobreak\hfill\break}} + {\parskip\z@skip\parfillskip\z@skip\parindent\z@\vadjust{}\par\noindent + \vadjust{\nobreak\vskip-\baselineskip}\nobreak\hfill\break}} % \end{macrocode} % \end{macro} % \begin{macro}{\FN@pseudofillbreak} @@ -967,7 +998,7 @@ % \begin{macrocode} \def\FN@pseudofillbreak{\nobreak\hskip\parfillskip\FN@pseudobreak} % \end{macrocode} -% +% % \end{macro} % \begin{macro}{\@makefnbreak} % This calculates the glue for the standard horizontal footnotes. @@ -1144,7 +1175,7 @@ % insertion level. % \begin{macrocode} \ifnum#2<\FN@masterinsert - \FN@colorstackbgroup\MFL@minipage + \FN@colorstackbgroup\FN@divert \FN@newslot\FN@masterslot \count@\FN@id % \end{macrocode} @@ -1185,75 +1216,114 @@ \else \FN@specific{#2}\@preparefnhtext \normalcolor \fi % \end{macrocode} -% After preparation, we now do the big bad trick for making -% footnotes cooperate with \cmd{\verb} and other catcode changing -% things: we call \cmd{\@makefntext} with an argument of -% |\iffalse|. This kills off its expansion right at the point -% where it would choose to place its argument. +% Ok, now we do the call to \cmd{\@makefntext} which may occur in +% one of several ways, depending on whether the `robust' or the +% `fragile' package option got used. % \begin{macrocode} - \FN@specific{#2}\@makefntext - \iffalse\fi + \expandafter \FN@makefncall + \else +% \end{macrocode} +% We still needed to cater for the error of badly anchored footnotes: +% \begin{macrocode} + \PackageError{bigfoot}{#2 forbidden in \FN@masterinsert.}% + {Higher-placed footnotes can't be anchored in inferior ones.^^J% + I am not putting this text in a footnote. History:% +\FN@errorstack}% + \rule{1em}{\ht\strutbox}% +\fi} +% \end{macrocode} +% \end{macro} +% \begin{macro}{\FN@makefnstart} +% This is called in the start of \cmd{\@makefntext}. +% \begin{macrocode} +\providecommand{\FN@seitenobreak}{\nobreak} +\def\FN@makefnstart{% % \end{macrocode} % Record the footnote specific dimensions. It is assumed that they % don't change in the document, at least not before the footnote % gets actually placed. % \begin{macrocode} - \expandafter\xdef\csname FN@ht\number#2\endcsname{\the\footnotesep}% - \expandafter\xdef\csname FN@dp\number#2\endcsname{\the\dp\strutbox}% + \expandafter\xdef\csname FN@ht\number\FN@masterinsert\endcsname + {\the\footnotesep}% + \expandafter\xdef\csname FN@dp\number\FN@masterinsert\endcsname + {\the\dp\strutbox}% + \expandafter\xdef\csname FN@wd\number\FN@masterinsert\endcsname + {\the\hsize}% % \end{macrocode} % The footnote gets markers for identifying it and its starting block. % \begin{macrocode} - \marks\FN@master{\FN@masterslot}% - \marks\FN@slave{\number\FN@id}% - \nobreak - \bgroup - \aftergroup\FN@commonending + \marks\FN@master{\FN@masterslot}% + \marks\FN@slave{\number\FN@id}% + \nobreak % \end{macrocode} % \cmd{\FN@commonending} will intervene before any tokens that are % shifted in due to switching back the color stack. Those will only % be executed once we completely relinquish control. % \begin{macrocode} - \ifx\FN@boxtype\vbox - \rule\z@\footnotesep - \else - \ifx\FN@par\par\else - \let\FN@@par\par - \let\FN@@noindent\noindent - \let\FN@@indent\indent - \fi - \everyvbox\expandafter{\expandafter\everyvbox - \expandafter{\the\everyvbox}% - \let\par\FN@@par - \let\noindent\FN@@noindent - \let\indent\FN@@indent - \the\everyvbox}% - \let\par\FN@par - \let\noindent\FN@noindent - \let\indent\FN@indent - \fi - \afterassignment\ignorespaces - \expandafter\FN@fnotecommonii - \else + \ifx\FN@boxtype\vbox + \rule\z@\footnotesep + \else + \ifx\FN@par\par\else + \let\FN@@par\par + \let\FN@@noindent\noindent + \let\FN@@indent\indent + \fi + \everyvbox\expandafter{\expandafter\everyvbox + \expandafter{\the\everyvbox}% + \let\par\FN@@par + \let\noindent\FN@@noindent + \let\indent\FN@@indent + \the\everyvbox}% + \let\par\FN@par + \let\noindent\FN@noindent + \let\indent\FN@indent + \fi + \FN@seitenobreak + \afterassignment\ignorespaces} % \end{macrocode} -% We still needed to cater for the error of badly anchored footnotes: +% \end{macro} +% \begin{macro}{\FN@makefnrobust} +% After preparation, we now do the big bad trick for making +% footnotes cooperate with \cmd{\verb} and other catcode changing +% things: we call \cmd{\@makefntext} with an argument of +% |\iffalse|. This kills off its expansion right at the point +% where it would choose to place its argument. +% +% Furthermore, this swallows the opening brace of the footnote text +% and then lets the footnote text progress. The closing group will +% then trigger the processing via \cmd{\aftergroup}. % \begin{macrocode} - \PackageError{bigfoot}{#2 forbidden in \FN@masterinsert.}% - {Higher-placed footnotes can't be anchored in inferior ones.^^J% - I am not putting this text in a footnote. History:% -\FN@errorstack}% - \rule{1em}{\ht\strutbox}% -\fi} +\def\FN@makefnrobust#{% + \FN@specific\FN@masterinsert\@makefntext + \iffalse\fi + \bgroup + \aftergroup\FN@robustending + \FN@makefnstart + \let\next} % \end{macrocode} % \end{macro} -% \begin{macro}{\FN@fnotecommonii} -% This just swallows the opening brace of the footnote text and then -% lets the footnote text progress. The closing group will then -% trigger the processing via \cmd{\aftergroup}. +% \begin{macro}{\FN@robustending} +% Here we put in the missing part of \cmd{\@makefntext}. % \begin{macrocode} -\def\FN@fnotecommonii#{\let\next} -% \end{macrocode} +\def\FN@robustending{% + \expandafter\expandafter\expandafter + \expandafter\expandafter\expandafter\expandafter + \iffalse \FN@specific\FN@masterinsert\@makefntext\fi + \FN@commonending} +% \end{macrocode} % \end{macro} -% % Ok, color handling is a nuisance, to say the least. Split +% \begin{macro}{\FN@makefnfragile} +% This is the escape route when the robust variant does not work. +% In that case, |\verb| and similar won't work in footnotes. +% \begin{macrocode} +\long\def\FN@makefnfragile#1{% + \FN@specific\FN@masterinsert\@makefntext + {\FN@makefnstart#1\FN@commonending}} +% \end{macrocode} +% +% \end{macro} +% +% Ok, color handling is a nuisance, to say the least. Split % footnotes need to close their color stack on the old page, and reopen % it on the new one. So we record the color stack state at each time % it changes in a marks register. @@ -1271,8 +1341,8 @@ \let\reset@color\FN@reset@color \let\color@begingroup\FN@color@begingroup} -\def\FN@colorstackegroup{\egroup\ifx\FN@colorstack\@empty - \global\let\FN@colorstack\FN@savecolorstack \fi} +\def\FN@colorstackegroup{\egroup + \global\let\FN@colorstack\FN@savecolorstack} \def\FN@colorstackfinish{\def\@elt##1##2{\FN@@reset@color##2}% \FN@colorstack @@ -1317,9 +1387,6 @@ % standard ones) happens to work. % \begin{macrocode} \def\FN@commonending{% - \expandafter\expandafter\expandafter - \expandafter\expandafter\expandafter\expandafter - \iffalse \FN@specific\FN@masterinsert\@makefntext\fi \@makefnendbox \ifx\FN@boxtype\vbox\@finalstrut\strutbox \else \unskip \fi \FN@colorstackfinish @@ -1359,9 +1426,12 @@ % footnotes belong to this one. % \begin{macrocode} \MFL@insert\FN@masterinsert{\nointerlineskip\box\z@}% + \ifdim\lastkern=\z@ \let\FN@next\@empty\else + \edef\FN@next{\kern\the\lastkern\relax}\unkern + \fi \marks\FN@slave{\number\FN@id}% - \MFL@endminipage - \FN@colorstackegroup + \expandafter\FN@enddivert\expandafter\FN@colorstackegroup + \FN@next } % \end{macrocode} % \end{macro} @@ -1427,15 +1497,15 @@ \ifcase \ifvoid\z@\m@ne\fi \FN@config\z@ %<trace> \if\foottrace8\message{^^J\string\FN@retaindelayed: -%<trace> dropping box \FN@slotget{\number\dp\z@}}\fi +%<trace> dropping Id \FN@slotget{\number\dp\z@}}\fi %<trace> \if\foottrace{16}{\showboxdepth4 \showboxbreadth400 %<trace> \tracingonline=\@ne\showbox\z@}\fi \ifnum\dp\z@=\count@\else \FN@freeslot{\number\dp\z@}\fi %<trace> \ifnum\dp\z@<\@ne \errmessage{Unidentified box}\fi - \FN@retaindelayed + \expandafter\FN@retaindelayed \or %<trace> \if\foottrace8\message{^^J\string\FN@retaindelayed: -%<trace> retaining box \FN@slotget{\number\dp\z@}}\fi +%<trace> retaining Id \FN@slotget{\number\dp\z@}}\fi %<trace> \if\foottrace{16}{\showboxdepth4 \showboxbreadth400 %<trace> \tracingonline=\@ne\showbox\z@}\fi {\FN@retaindelayed \nointerlineskip \box\z@}% @@ -1681,8 +1751,9 @@ \expandafter\expandafter\expandafter\let\FN@cache\FN@savebox=\@cclv -\expandafter\def\csname FN@ht\number\FN@savebox\endcsname{\topskip}% +\expandafter\def\csname FN@ht\number\FN@savebox\endcsname{\z@skip}% \expandafter\def\csname FN@dp\number\FN@savebox\endcsname{\maxdepth} +\expandafter\def\csname FN@wd\number\FN@savebox\endcsname{\columnwidth} \def\FN@list{\MFL@list\@elt{}\footins} @@ -1705,7 +1776,8 @@ % \end{macrocode} % \begin{macro}{\FN@removecheck} % This returns |\@ne| if and only if the current slot master is strictly -% inside of the specified interval. +% inside of the specified open interval. In this case it is not to +% appear on the current page. % \begin{macrocode} \def\FN@removecheck#1#2{% \ifnum#1<\FN@slotget{\number\dp\z@} % @@ -1806,7 +1878,8 @@ \def\FN@insertmarks{% {\setbox\z@\copy\@cclv \splittopskip-\maxdimen\relax - \vbadness=\maxdimen + \vbadness=\@M + \vfuzz=\maxdimen \loop \ifvoid\z@\else {\let\@elt\FN@pseudomarks @@ -1827,7 +1900,10 @@ % a complicated expression if you want to, for example by checking % the presence of particular footnotes. % \begin{macrocode} +\def\FootnoteMinimum{1sp} \def\FootnoteMainMinimum{0pt} +\expandafter\def\csname\string\FootnoteMinimum\number\FN@savebox +\endcsname{\FootnoteMainMinimum} % \end{macrocode} % \end{macro} % @@ -1850,7 +1926,7 @@ % the next page). We then reinsert the remaining split insertions, % any possibly split off page material and the penalty. % -% \TeX is rather monotonous in its page break processing. Increase +% \TeX\ is rather monotonous in its page break processing. Increase % the available page size, and the available page material will also % increase. There is a singular exception to that rule, and that are % split and floating insertions. However, we notice their presence by @@ -1899,21 +1975,31 @@ % \item We are looking for missing insertions that may have floated. % \end{enumerate} % -% In the situation where the page break has already been determined -% (magic output penalty, looking for missing insertions), we are not -% interested in `foreign' insertions like floating figures. The -% current code does not cater for them. +% We are trying to do bookkeeping on the effects of page size for +% insertions that fall into the footnote class. While we do basic +% bookkeeping for other insertions as well, this can only be +% incomplete since we don't reinsert material. In consequence, +% multiple material ending up in the same insertion might cause the +% corresponding skip register to be accounted for several times. +% \LaTeX\ does not really reuse insertions in that manner except for +% footnotes, so we are mostly ok here. +% +% |bigfoot| usually does some lookahead in the main list in order to +% obtain optimal breakpoints. It explicitly undoes the effect this +% has on marks, but insertions are a different matter here. So floats +% may appear on an earlier page than expected. % % If the output routine is invoked with a penalty of $-13750$, then % the page content is merely used for setting the \cmd{\topmarks} % array. In that case, we just clear out the output box and resume. % We don't fiddle with \cmd{\deadcycles} in order to catch foulups. +% % Also we don't touch insertion boxes. There is a particular % situation where there \emph{are} insertions, namely if we are % collecting insertions after the last output routine has ended up % with a non-zero value of \cmd{\insertpenalties}. In this case, all % insertions we \emph{do} get are floating insertions, meaning that -% the had a preceding insertion of the same class already on the last +% they had a preceding insertion of the same class already on the last % page, and thus we have zeroed its skip register already. We are % assuming that a single pass with such a large \cmd{\vsize} is % sufficient for pulling all insertions. If that happens to be @@ -1921,12 +2007,15 @@ % are probably in big dodo with regard to page size accounting, % anyway. % \begin{macrocode} +\newcount\FN@outputflag +\FN@outputflag=3158345 \output{% + \let\@elt\relax + \ifvoid\@cclv \PackageError{bigfoot}{Empty box 255 in \output}\fi %<trace> \if\foottrace8% %<trace> \message{entering output with %<trace> \outputpenalty=\the\outputpenalty:}% -%<trace> \showbox\@cclv\fi -% \ifnum\c@page=10 \traceon\fi +%<trace> {\showboxdepth4\showboxbreadth\maxdimen\showbox\@cclv}\fi \ifnum\outputpenalty=-13750 %<trace> \if\foottrace8% %<trace> \message{Discarding box 255.}% @@ -1937,7 +2026,7 @@ gather all floating insertions in a single pass.^^J% Complain to the author if you consider this a bug}% \fi - \global\advance\FN@outervsize\dimexpr\ht\@cclv-\vsize\relax + \global\advance\FN@outervsize\dimexpr\ht\@cclv-\vsize \global\setbox\@cclv\box\voidb@x \else % \end{macrocode} @@ -1949,44 +2038,35 @@ \ifvoid\@holdpg \FN@sweeptopmarks \fi - \ifvoid\@cclv - \global\FN@outervsize\z@ - \else - \global\FN@outervsize\ht\@cclv - \global\setbox\@cclv\vbox{\unvbox\@cclv\boxmaxdepth\maxdepth}% - \global\advance\FN@outervsize-\ht\@cclv\relax - \fi + \FN@nest@iterate{\FN@insertouterspace\global\FN@outervsize + \dimexpr\z@}% + \global\advance\FN@outervsize\ht\@cclv + \global\setbox\@cclv\vbox{\unvbox\@cclv\boxmaxdepth\maxdepth}% \global\let\FN@vsadjustlist\@empty - \FN@normaloutput % \end{macrocode} -% \cmd{\FN@outervsize} now contains the amount of stretch that was put -% into the output box in order to reach the goal size. So it is the -% space we still have left available to fill given the current -% \cmd{\vsize} and contents of insertions. Note that this can be -% negative if shrinkability has been involved in getting at the value. +% \cmd{\FN@outervsize} now contains the value of \cmd{\pagegoal} at +% the time of output. It should be \cmd{\vsize} adjusted by the +% natural size of insertions. Note that \cmd{\FN@normaloutput} is not +% required to return with a sensible value of \cmd{\outputpenalty}. % \begin{macrocode} + \FN@normaloutput \else % \end{macrocode} % We now are in the situation that we already have collected material -% previously. \cmd{\FN@outervsize} contains the overshoot according -% to the difference of demanded and achieved space again. It remains -% unchanged if we have inserted a special penalty ourselves: in this -% case no page material has possibly been added. However, we can't be -% sure that adding a special penalty does not take more than one -% output routine call before delivery. For that reason, we don't rely -% on special outputs being special and always subtract any -% additionally demanded \cmd{\vspace} from \cmd{\FN@outervsize} before -% calling a special output, so that we can afterwards compensate for -% it. -% \begin{macrocode} - \ifvbox\@cclv - \dimen@\ht\@cclv - \global\setbox\@cclv\vbox{\unvbox\@cclv\boxmaxdepth\maxdepth}% - \global\advance\FN@outervsize\dimexpr\dimen@-\ht\@cclv\relax - \fi +% previously. We can't be sure that adding a special penalty does not +% take more than one output routine call before delivery. For that +% reason, we don't rely on special outputs being special and always +% subtract any additionally demanded \cmd{\vspace} from +% \cmd{\FN@outervsize} before calling a special output, so that we can +% afterwards compensate for it. +% \begin{macrocode} + \FN@nest@iterate{\FN@insertouterspace\global\advance\FN@outervsize + \dimexpr\ht\@cclv}% + \global\setbox\@cclv\vbox{\unvbox\@cclv\boxmaxdepth\maxdepth}% % \end{macrocode} % Now we invalidate the cache boxes for all insertions that had -% changed due to the recent additions to the page. +% changed due to the recent additions to the page (this does +% \emph{not} affect \cmd{\FN@vsize}). % \begin{macrocode} \FN@nest@iterate\FN@maybeinvalidatecache % \end{macrocode} @@ -2006,20 +2086,16 @@ \ifnum\FN@outputpenalty=-13749 \@ne\fi \ifnum\FN@outputpenalty=-13751 \@ne\fi \tw@ \or +% \end{macrocode} +% \cmd{\outputpenalty} is restored to the original value before the +% total page is glued together. +% \begin{macrocode} \FN@vsadjustlist %<trace> \if\foottrace8\message{receiving special penalty %<trace> \FN@outputpenalty, dissing box 255:}% %<trace> {\showboxdepth4 \showboxbreadth400 %<trace> \tracingonline=\@ne\showbox\@cclv}\fi % \end{macrocode} -% We don't need to insert either discards or outputpenalties anywhere: -% those are exclusively derived from our own inserted code. -% Since the \cmd{\pagediscards} derive from our own insertion, we -% clear them out. \cmd{\outputpenalty} is restored to the original -% value before the total page is glued together. -% \begin{macrocode} - \global\setbox\@cclv\vbox{\pagediscards}% -% \end{macrocode} % This special penalty means that we have been collecting floated % insertions right now. So |\box255| is actually empty except for % filler material. We restore the old box into it. @@ -2032,6 +2108,10 @@ \FN@normaloutput \else \the\FN@output + \@pageht-\vsize + \let\@currbox\footins + \@reinserts + \global\vsize-\@pageht \fi \else \dimen@\topskip @@ -2043,31 +2123,62 @@ % \end{macrocode} % Ok, now we reconstruct the box from its parts. We add the material % together, taking the previous output penalty and the current page -% discards for glueing the stuff together. The previous output +% discards (if it belongs between those boxes, otherwise we leave it +% on the list) for glueing the stuff together. The previous output % penalty then is irrelevant for further purposes and we replace it % again. \cmd{\FN@outervsize} has been % adjusted by the accumulated contributions of insertions to the page % size. Fiddling with it would not appear necessary or even prudent. % \begin{macrocode} - \global\setbox\@cclv\vbox{\unvbox\z@ - \ifnum\outputpenalty<\@M \penalty\outputpenalty\fi - \pagediscards +%<trace>\if\foottrace8 +%<trace> \message{Box 255 before reglue +%<trace> (outputpenalty=\the\outputpenalty):}% +%<trace> {\showboxdepth4\showboxbreadth100\showbox\@cclv}\fi + \global\setbox\@cclv\vbox{% % \end{macrocode} % Now we might have had a \cmd{\topskip} value designed for requesting % a given number of lines. We need to remove anything of that kind. -% Splitting again achieves that. +% Splitting again achieves that. If the current page was empty except +% for insertions, this means that we gain a new breakpoint. But +% insertions with discardable material before them would be unusual. +% +% The only exception to this may happen if the current page contained +% only insertions: in this case \TeX\ has made a page break before the +% actually inserted \cmd{\topskip} glue (which will then arrive one +% page later). +% +% Note that the pagediscards contain material corresponding to the +% last breakpoint chosen, so they will either start with a penalty +% of~10000 (which is what an actual outputpenalty gets replaced with) +% or will start with discardable material. We clean it for that +% reason. % \begin{macrocode} - \ifvbox\@cclv - \global\setbox\@cclv\vbox{\break\unvbox\@cclv}% - {\splittopskip-\maxdimen \setbox\z@\vsplit\@cclv to\z@}% - \unvbox\@cclv + \unvbox\z@ + \global\setbox\@cclv\vbox{\break\unvbox\@cclv}% + {\splittopskip-\maxdimen \setbox\z@\vsplit\@cclv to\z@} + \ifnum\outputpenalty=\@M + \setbox\z@\vbox{\pagediscards + \FN@cleanpagepenalty}% + \unvbox\z@ + \else + \penalty\outputpenalty + \pagediscards \fi + \unvbox\@cclv \boxmaxdepth\maxdepth}% +%<trace>\if\foottrace8 +%<trace> \message{Box 255 reglued (outputpenalty=\FN@outputpenalty):}% +%<trace> {\showboxdepth4\showboxbreadth100\showbox\@cclv}\fi \global\outputpenalty\FN@outputpenalty\relax % \end{macrocode} % Ok, now if \cmd{\topskip} is actually \emph{positive}, we have been % collecting material tentatively without having proper marks. We -% then need to fill in the marks into the list and try again. +% then need to fill in the marks into the list and try again. Note +% that we are not reinserting anything in order to compensate for +% \cmd{\outputpenalty} being replaced by a nobreak: this is the job of +% \cmd{\FN@normaloutput} when it decides to place material back on the +% page. That is: when code is written that will make use of +% pagediscards, it has to cater for their proper structure. % \begin{macrocode} \ifdim\dimen@>\z@ %<trace> \if\foottrace8 @@ -2076,9 +2187,11 @@ \hrule\@height\z@\@depth\z@ \unvcopy\FN@topmarkbox \penalty-13750 + \penalty\FN@outputflag \hrule\@height\z@\@depth\z@ \FN@insertmarks \penalty-13749 + \penalty\FN@outputflag \FN@prepareoutput \global\topskip-\maxdimen \global\vsize0.5\maxdimen @@ -2095,9 +2208,10 @@ % Now we have recovered a sensible state and glued everything together % that has been necessary. All insertion parameters are at their % standard values, and any insertions have been collected in the -% respective boxes. If the whole exercise has been +% respective boxes. % \begin{macrocode} \def\FN@normaloutput{% +%<trace> \if\foottrace8\message{^^JEntering \string\FN@normaloutput:^^J}\fi % \end{macrocode} % \cmd{\FN@vsize} is now being set to the vertical size taken up by % the insertions, according to \TeX. Note that this does not include @@ -2107,23 +2221,28 @@ % size was taken from \cmd{\pagegoal}, and we reconstitute it in this % manner. % \begin{macrocode} - \FN@nest@iterate{\FN@insertouterspace\global\FN@vsize\dimexpr\z@}% + \global\FN@vsize\FN@outervsize + \global\advance\FN@vsize-\ht\@cclv\relax\relax % \end{macrocode} % Now we sort the inserts and regenerate the cache. % \begin{macrocode} \FN@nest@iterate\FN@sortinsert \FN@nest@iterate\FN@clearcache - \xdef\FN@config{\noexpand\@elt{\number0\botmarks\FN@slave}% + \xdef\FN@config{\@elt{\number0\botmarks\FN@slave}% {\number\maxdimen}}% +%<trace> \if\foottrace8% +%<trace> \message{\noexpand\FN@normaloutput start config: \FN@config^^J}% +%<trace> \fi \FN@nest@iterate\FN@reconfig % \end{macrocode} % Note that \cmd{\FN@reconfig} subtracts the \emph{actual} size of all % insertions (after paragraphs have been combined and too early % insertions moved to the next page) and also subtracts the flexible % glues associated with the insertions' skip registers, so this -% flexibility is typically negative. +% flexibility is typically negative. Since the cache registers have +% been explicitly cleared, \cmd{\FN@reconfig} starts from the state +% where indeed no insertions are present. % \begin{macrocode} - \global\advance\FN@vsize\FN@outervsize\relax \ifcase \ifnum\insertpenalties>\z@ \@ne\fi % \end{macrocode} @@ -2150,53 +2269,71 @@ % \begin{macrocode} \ifdim\FN@vsize<\glueshrink\FN@vsize \thr@@ \fi % \end{macrocode} -% % page has appropriate size or we have special penalty. If we have % come here not the first time, we might have arrived at a non-optimal % break. So we attempt a split. % \begin{macrocode} \ifx\FN@vsadjustlist\@empty \else \thr@@\fi\z@ - \ifvbox\@cclv - {\vbadness\maxdimen - \global\setbox\@cclv\vbox - spread\FN@vsize{\unvbox\@cclv\boxmaxdepth\maxdepth}}% - \fi +% \end{macrocode} +% Ok, now we get the default case in our big routine: case~0. We just +% pass the result onto the output routine. +% \begin{macrocode} + {\vbadness\@M + \vfuzz\maxdimen + \global\setbox\@cclv\vbox + spread\FN@vsize{\unvbox\@cclv\boxmaxdepth\maxdepth}}% \the\FN@output + \let\@currbox\footins + \@pageht-\vsize + \@reinserts + \global\vsize-\@pageht \FN@nest@iterate\FN@clearcache \or % \end{macrocode} -% Case 1: We just pull in remaining insertions and are done. +% Case 1: We just pull in remaining insertions and are done. Note +% that the special penalty here will get turned into an explicit +% nobreak. So if we have no record of an actual outputpenalty, we +% need to insert an artificial penalty of 0 here. % \begin{macrocode} \FN@restartoutput \penalty -13749 + \penalty \FN@outputflag + \or % \end{macrocode} -% Now we want to gather additional material. This is somewhat weird. -% We first gather our material with a `normal' setting of topskip, and -% then we'll have another go at the material using proper marks. We -% can't actually insert anything right now in order not to introduce a -% premature breakpoint. +% Case 2: Now we want to gather additional material. This is somewhat +% weird. We first gather our material with a `normal' setting of +% topskip, and then we'll have another go at the material using proper +% marks. We can't actually insert anything right now in order not to +% introduce a premature breakpoint. % \begin{macrocode} - \or \dimen@=\dimexpr\FN@vsize-\glueshrink\FN@vsize\relax \FN@prepareoutput \global\topskip \normalbaselineskip - \global\vsize \dimen@ + \global\vsize \dimen@ \global\advance\FN@outervsize-\vsize \global\deadcycles\z@ \else % \end{macrocode} -% Fake our output box into something looking like a cache box +% This is case 3: Fake our output box into something looking like a +% cache box and do the optimal split routine. The output cache box +% has a few deficiencies: its inner box is \emph{not} depth-extended +% to some default measurement. That means that where page size +% calculations are involved, one needs to \emph{disregard} its actual +% depth and instead use \cmd{\maxdepth}. This is somewhat awkward and +% prone to problems. One alternative might be to mark the box as +% split, extend its depth in the split part and let it be followed by +% nothing as lower part of the split. But we still would need to +% account for the missing depth at the end. % \begin{macrocode} \edef\FN@masterid{\number\maxdimen}% \def\FN@masterslot{-1}% - \global\setbox\@cclv\vbox{% - \box\@cclv}% + \global\setbox\@cclv\vbox{\box\@cclv}% \xdef\FN@config{\noexpand\@elt{\number0\botmarks\FN@slave}% {\number\maxdimen}}% %<trace> \ifvoid\FN@savebox \else \PackageError{bigfoot}{\FN@savebox %<trace> \space should be void!}{}\fi \global\setbox\FN@savebox\vbox{}% - \gdef\FN@badness{0}% + \gdef\FN@penalties{0}% \edef\FN@defaultpenalty{\ifnum\outputpenalty<\@M \number\outputpenalty \else @@ -2206,46 +2343,64 @@ \let\@elt\relax %<trace> \if\foottrace8{\showboxdepth4\showboxbreadth100\showbox\@cclv}\fi \global\setbox\FN@savebox\box\voidb@x - \count@\vbadness - \vbadness\maxdimen - \global\setbox\@cclv\vbox spread\FN@vsize\bgroup - \unvbox\@cclv - \ifnum\lastpenalty>\z@ - \unpenalty - \global\setbox\FN@tempbox\lastbox - \else - \global\setbox\FN@tempbox\box\voidb@x - \fi - \setbox\z@\lastbox - \ifvoid\z@ - \ifvbox\FN@tempbox - \ifnum\outputpenalty<\@M - \global\setbox\FN@tempbox{\unvbox\FN@tempbox - \penalty\outputpenalty}% - \fi - \global\outputpenalty=\@M + {% + \vbadness\@M + \vfuzz\maxdimen + \global\setbox\@cclv\vbox spread\FN@vsize{% + \unvbox\@cclv + \ifnum\lastpenalty>\z@ + \unpenalty + \global\setbox\FN@tempbox\lastbox + \else + \global\setbox\FN@tempbox\box\voidb@x \fi - \egroup \global\setbox\@cclv\box\voidb@x - \else - \MFL@removevboxes - \unvbox\z@ - \let\FN@defaultpenalty\@M - \FN@getbreakpenalty \setbox\z@\lastbox - \ifcase - \ifvbox\FN@tempbox \@ne\fi - \ifvoid\z@ \else \@ne\fi \z@ - \or - \global\setbox\FN@tempbox\vbox{\unvbox\z@ - \unvbox\FN@tempbox +% \end{macrocode} +% Now if a split has been done, |\box\FN@tempbox| contains the lower +% part of the split. In either case, |\box\z@| contains the upper +% part of the split (in a prepared form with the splitdiscards in a +% box of their own). This may be void if there is no main text but +% only footnotes. If we have carryover material, we add the current +% outputpenalty there and set outputpenalty to a value indicating that +% we have no outputpenalty to add at the end of the current list. +% \begin{macrocode} + \ifvoid\z@ + \ifvbox\FN@tempbox \ifnum\outputpenalty<\@M - \penalty\outputpenalty - \fi}% - \global\outputpenalty\FN@breakpenalty +% The output penalty originally from below the split box gets appended +% to the end of the split box. + \global\setbox\FN@tempbox{\unvbox\FN@tempbox + \penalty\outputpenalty}% + \fi + \global\outputpenalty=\@M + \fi + \else +% \end{macrocode} +% Ok, we have material to go to the next page. We unpack it and fish +% out the break penalty from the last box. After checking it, put it in +% box~0. A prospective current break penalty gets appended to the +% carryover material. The fished-out break penalty becomes the new +% value of outputpenalty. +% \begin{macrocode} + \MFL@removevboxes + \unvbox\z@ + \edef\FN@defaultpenalty{\number\@M}% + \FN@getbreakpenalty + \setbox\z@\lastbox + \global\setbox\FN@tempbox\vbox\bgroup\unvbox\z@ + \unvbox\FN@tempbox + \ifnum\lastnodetype<\z@ + \egroup\global\setbox\FN@tempbox\box\voidb@x + \else + \ifnum\outputpenalty<\@M + \penalty\outputpenalty + \fi + \egroup + \global\outputpenalty\FN@breakpenalty + \fi \fi - \boxmaxdepth\maxdepth\egroup - \fi - \vbadness\count@ + \boxmaxdepth\maxdepth}% + }% \setbox\z@\box\FN@tempbox \let\@elt\relax % \end{macrocode} @@ -2259,25 +2414,32 @@ % general, we assume that if box~0 is nonvoid, we take the resulting % split. Otherwise, if the page appears underfull, we pull in more % material. If the page is not underfull, we can pass it to the -% output routine. +% output routine. If box~0 is void, the break was chosen at the +% ultimate end of the vertical list. If it was not a forced break, +% and if it is not an overfull case already, we pull in more material +% in order to avoid widows in the main text. % \begin{macrocode} \dimen@=\dimexpr\FN@vsize-\glueshrink\FN@vsize\relax \ifcase - \ifvoid\z@ \else\thr@@\fi + \ifvoid\z@ \ifnum\outputpenalty>-\@M + \ifdim\dimen@<\z@ \else \@ne \fi + \fi + \else \thr@@ + \fi \ifdim\ht\@cclv<\normalbaselineskip \@ne\fi \ifdim\dimen@<\normalbaselineskip \tw@\fi \@ne \or \FN@prepareoutput \global\topskip \normalbaselineskip \ifdim\dimen@<\normalbaselineskip \dimen@=2\baselineskip\fi - \global\vsize \dimen@ + \global\vsize \dimen@ \global\advance\FN@outervsize-\vsize \global\deadcycles\z@ \or %<trace> \if\foottrace8% %<trace> \message{^^JOutput: config is \FN@config...}\fi - \setbox\tw@\vbox{% - \the\FN@output + \setbox\tw@\vbox{% + \the\FN@output %<trace> \if\foottrace8% %<trace> \ifnum\lastnodetype=\m@ne %<trace> \message{^^JOutput: end without carryover^^J}% @@ -2287,16 +2449,27 @@ %<trace> \tracingonline=\@ne\showbox\tw@ %<trace> \fi %<trace> \fi - }% - \unvbox\tw@ - \unvbox\z@ - \FN@nest@iterate\FN@clearcache - \or + }% + \unvbox\tw@ + \unvbox\z@ + \let\@currbox\footins + \@pageht-\vsize + \@reinserts + \global\vsize-\@pageht + \FN@nest@iterate\FN@clearcache + \or \FN@restartoutput \penalty -13751 + \penalty\FN@outputflag \unvbox\z@ + \ifnum\outputpenalty>\@M + \else \penalty + \ifnum\outputpenalty=\@M \z@ \else\outputpenalty\fi + \fi + \fi \fi - \fi} +%<trace> \if\foottrace8\message{^^JExiting \string\FN@normaloutput^^J}\fi +} % \end{macrocode} % \end{macro} % \begin{macro}{\FN@prepareoutput} @@ -2313,7 +2486,7 @@ % distance, we might have a problem here. There is no obvious way % to avoid it, though. % \begin{macrocode} -\def\FN@prepareoutput{% +\def\FN@prepareoutput{% {\let\@elt\FN@recordinsertparam \xdef\FN@vsadjustlist{% \global\vsize=\the\vsize @@ -2348,6 +2521,7 @@ \hrule\@height\z@\@depth\z@ \unvcopy\FN@topmarkbox \penalty -13750 + \penalty\FN@outputflag \hrule\@height\z@\@depth\z@ \FN@insertmarks \FN@prepareoutput @@ -2452,11 +2626,11 @@ \nointerlineskip\copy\z@ \setbox\z@ \vbox{\unvbox\z@ - \count@\FN@defaultpenalty\relax + \count@\@M \FN@getbreakpenaltyii \xdef\FN@tempinfo{\edef\noexpand\FN@breakpenalty{% - \number\ifnum\count@>-\@M \count@ - \else -\@M \fi}}}}% + \number\ifnum\count@=\@M \FN@defaultpenalty \else \count@\fi + }}}}% \FN@tempinfo} \def\FN@getbreakpenaltyii{% @@ -2477,6 +2651,38 @@ \fi} % \end{macrocode} % \end{macro} +% \begin{macro}{\FN@cleanpagepenalty} +% This is used for removing initial infinite penalties from the +% pagediscards: those are artifacts of the page break routine. +% \begin{macrocode} +\def\FN@cleanpagepenalty{% + \ifcase + \ifnum\lastnodetype<\z@ \m@ne\fi + \ifnum\lastnodetype<11 \@ne\fi + \ifnum\lastnodetype>13 \@ne\fi + \numexpr\lastnodetype-9\relax + \or + \PackageError{bigfoot}{Illegal node type}{This can't happen}% + \or + \skip@=\lastskip \unskip + \expandafter \FN@cleanpagepenalty \expandafter\vskip\the + \expandafter\skip@ + \or + \dimen@=\lastkern \unkern + \expandafter \FN@cleanpagepenalty \expandafter\kern\the + \expandafter\dimen@ + \or + \count@\lastpenalty \unpenalty + \ifnum\count@=\FN@outputflag + \unpenalty\expandafter\expandafter\expandafter\FN@cleanpagepenalty + \else + \expandafter\FN@cleanpagepenalty\expandafter + \penalty\the\expandafter\expandafter\expandafter\count@ + \fi + \fi + \relax} +% \end{macrocode} +% \end{macro} % \begin{macro}{\FN@mainsplitreturn} % This is merely an argument delimiting control sequence to make it % possible to figure out which recursion levels still need visiting. @@ -2505,7 +2711,7 @@ % the remaining space. % \begin{macrocode} \def\FN@getbadness#1{% - {\hfuzz\maxdimen\hbadness\maxdimen\setbox\z@\hbox to\z@{\hskip-#1}}} + {\hfuzz\maxdimen\hbadness\@M\setbox\z@\hbox to\z@{\hskip-#1}}} % \end{macrocode} % \end{macro} % \begin{macro}{\FN@newlevel} @@ -2513,38 +2719,73 @@ % footnote level, recursing if necessary. The level list is % delimited with \cmd{\FN@mainsplitreturn}. The whole thing is % looped through while the splits are being optimized. While -% recursing, \cmd{\FN@badness} contains the badness of the current -% split configuration: a penalty of $10000$ for any split, plus the -% penalty at the split points. \cmd{\FN@ebadness} is the same, but -% also counting in the stretch badness for one particular -% configuration. Ebadness does not make sense to evaluate more than -% temporarily: it is not passed through the levels. Since -% \cmd{\FN@badness} is globally tampered with, its value at entry is -% saved in \cmd{\FN@entrybadness}. +% recursing, \cmd{\FN@penalties} contains the accumulated penalities +% of the current split configuration: a penalty of $10000$ for any +% split (except the main list), plus the penalty at the split points +% plus a `hangover' badness for the percentage of material carried +% over to the following pages. If nothing is carried over, this +% is~0, if more is carried over, we get a penalty according to the +% proportion of carryover material, raised to the third power. +% \begin{macro}{\footnotecarryratio} +% The fractional variable \cmd{\footnotecarryratio} is used for +% scaling the leftover material dimensions. After scaling with +% \cmd{\footnotecarryratio}, the carried material is treated like +% missing material in a glue calculation, while the stretchability +% for this calculation is given by the total size of material before +% breaking. So with a setting of~1, there should always be enough +% stretchability, causing at most a penalty of~100. That's not very +% effective, so we scale this up. +% +% The default value of~2 seems to provide a reasonable penalty for +% leftover material. The actual purpose for this component of the +% scoring is to penalize footnote blocks that seem to carry over +% disproportionally much material to later pages. +% \begin{macrocode} +\providecommand\footnotecarryratio{2} +% \end{macrocode} +% \end{macro} +% \cmd{\FN@ebadness} is an augmented value, but also counting in the +% stretch badness for one particular configuration. Ebadness does +% not make sense to evaluate more than temporarily: it is not passed +% through the levels. Since \cmd{\FN@penalties} is globally +% tampered with, its value at entry is saved in +% \cmd{\FN@entrypenalties}. Whenever we recurse or return, +% \cmd{\FN@vsize} contains the full information about the available +% space on the page, even though locally we use \cmd{\FN@myvsize}, a +% local value, to keep track of the locally reserved space. The +% only time when we need to save \cmd{\FN@myvsize} should be when we +% temporarily leave boxes in order to save the current +% configuration. % \begin{macrocode} \def\FN@newlevel#1#2#3\FN@mainsplitreturn{% \count@\FN@cache#2% \ifvoid\count@ %<trace> \if\foottrace1\message{Page=\thepage #2 is empty, recursing with %<trace> \the\FN@vsize^^J}% -%<trace> \message{Config=\FN@config^^J}\fi +%<trace> \message{Config=\unexpanded\expandafter{\FN@config}^^J}\fi #3\FN@mainsplitreturn %<trace> \if\foottrace1% -%<trace> \message{Page=\thepage #2 was empty, returning with \the\FN@vsize^^J}% -%<trace> \message{Config=\FN@config^^J}\fi +%<trace> \message{Page=\thepage #2 was empty, +%<trace> returning with \the\FN@vsize^^J}% +%<trace> \message{Config=\unexpanded\expandafter{\FN@config}^^J}\fi \else -%<trace> \if\foottrace1\message{Entering #2 with \FN@badness}\fi +%<trace> \if\foottrace1\message{Entering #2 with \FN@penalties, +%<trace> \FN@vsize=\the\FN@vsize,^^J% +%<trace> Config=\unexpanded\expandafter{\FN@config}^^J}\fi {\def\FN@currentinsertion{#2}% \def\FN@currentrecursion{#3}% \let\FN@entryconfig\FN@config - \let\FN@entrybadness\FN@badness + \let\FN@entrypenalties\FN@penalties \splittopskip\csname FN@ht\number#2\endcsname\relax \splitmaxdepth\csname FN@dp\number#2\endcsname\relax - \vbadness=\maxdimen + \hsize\csname FN@wd\number#2\endcsname\relax + \vbadness=\@M \vfuzz\maxdimen \let\@elt\relax \expandafter\FN@newleveli\expandafter}% -%<trace> \if\foottrace1\message{Exiting #2 with \FN@badness}\fi +%<trace> \if\foottrace1\message{Exiting #2 with \FN@penalties, +%<trace> \FN@vsize=\the\FN@vsize,^^J% +%<trace> Config=\unexpanded\expandafter{\FN@config}^^J}\fi \fi} % \end{macrocode} % \end{macro} @@ -2559,7 +2800,12 @@ % insertion, so we just subtract the whole insertion-related % content. We'll add stuff into it when recursing. % \begin{macrocode} - \dimen@\dimexpr\ht\count@+\dp\count@\relax + \dimen@\dimexpr\ht\count@ + \ifnum\FN@currentinsertion=\FN@savebox + +\maxdepth + \else + +\dp\count@ + \fi\relax \global\advance\FN@vsize\dimexpr \dimen@ *\count\FN@currentinsertion/\@m\relax\relax % \end{macrocode} @@ -2573,7 +2819,7 @@ % meaning of boxes on the various levels are:\par\noindent % \begin{tabularx}{\linewidth}{ll@{:\hskip\tabcolsep}X} % 0&box0&where stuff gets collected as tentative material to be -% unboxed with |\FN@removevboxes| once the insertion gets readied +% unboxed with \cmd{\FN@removevboxes} once the insertion gets readied % for shipout\\ % 0&box2&the previous best split that was found\\\hline % 1&box0&the material that gets worked off, the tail of the split\\ @@ -2595,12 +2841,20 @@ \ifnum\lastpenalty=\z@ \setbox\tw@\box\voidb@x \setbox\z@\lastbox - \FN@myvsize=\dimexpr\dimen@-\ht\z@-\dp\z@\relax + \FN@myvsize=\ifnum\lastnodetype<\z@ + \z@ + \else + \dimexpr\dimen@-\ht\z@-\dp\z@\relax + \fi \else % \end{macrocode} % Now if the box has been split previously, we glue it back together -% again. +% again. Since the lower part of the split has been \emph{subtracted} +% from the total in \cmd{\dimen@}, we need to put it back into the +% equation here. \cmd{\dimen@} contains the size of the box after +% padding split material has been added. % \begin{macrocode} +%<trace> \if\foottrace1\message{Regluing box 2}\fi \unpenalty \setbox\tw@\lastbox \setbox\z@\lastbox @@ -2618,10 +2872,14 @@ % these definitions here are made in \emph{inner} level, so they can't % make it outside as the result of the optimization. If we drop out % of here without superceding them, something's completely rotten. +% ^^A Fixme: Alpha pruning could be implemented by calling with +% ^^A \FN@bestcost already set at entry to the best badness at +% ^^A the respective level. % \begin{macrocode} - \edef\FN@bestebadness{\number\maxdimen}% + \edef\FN@bestcost{\number\maxdimen}% + \let\FN@bestbadness\FN@bestcost \let\FN@bestconfig\@undefined - \let\FN@bestvsize\z@skip + \def\FN@bestvsize{-\maxdimen}% \let\FN@splitcolors\@empty % \end{macrocode} % Ok, first attempt. One interesting feature is that we will never @@ -2631,13 +2889,16 @@ % bother about contributing too much. What we put in the box here % can stay. % -% First we split to the remaining size. After having done so, we -% continue splitting until we get the necessary mark of the last -% footnote into our grasp: we can't split before that. +% First we split to the remaining size. Since we still have all +% subordinate footnotes considered fully, we need at least this split +% size (in case of a configuration change, we will need more). After +% having done the initial split, we continue splitting until we get +% the necessary mark of the last footnote into our grasp: we can't +% split before that. % \begin{macrocode} \ifnum\FN@currentinsertion=\FN@savebox \else - \def\FN@defaultpenalty{-\@M}% + \edef\FN@defaultpenalty{\number-\@M}% \edef\FN@masterslot{\number\dp\z@}% \edef\FN@masterid{\FN@slotget\FN@masterslot}% \fi @@ -2653,15 +2914,19 @@ % split, we want to have all available page stretchability properly % taken into account. So we take the box, and add the available page % stretchability at the top. Note that the stretchability is -% registered negatively. +% registered negatively. If we are on the main vertical list, an +% empty page can be an acceptable option, so we add a penalty of zero +% to account for that. Note that any prospective true penalties will +% already have disappeared into the page break. % \begin{macrocode} \let\FN@splitcolors\@empty \setbox\z@\vbox{\vskip-\glueexpr(\FN@vsize-\dimexpr\FN@vsize \relax\@minus\glueshrink\FN@vsize)% *\@m/\count\FN@currentinsertion + \penalty\z@ \unvbox\z@ \ifnum\FN@defaultpenalty>-\@M - \penalty\FN@defaultpenalty\nointerlineskip + \penalty\FN@defaultpenalty\relax\nointerlineskip \vbox to\maxdimen{}% \fi}% % \end{macrocode} @@ -2672,10 +2937,11 @@ % \begin{macrocode} \setbox\tw@\vsplit\z@ to% \dimexpr\FN@vsize*\@m/\count\FN@currentinsertion - -\FN@myvsize + -\FN@myvsize-\splitmaxdepth \relax \ifnum\FN@defaultpenalty>-\@M \setbox\z@\vbox\bgroup\unvbox\z@\setbox\z@\lastbox + \unskip \unpenalty \ifnum\lastnodetype<\z@ \egroup \setbox\z@\box\voidb@x @@ -2694,29 +2960,12 @@ *\@m/\count\FN@currentinsertion \unvbox\tw@\boxmaxdepth\splitmaxdepth}% % \end{macrocode} -% Ok, now rinse and repeat if we don't have reached the last footnote -% in the block. Or, if we are in the main block and have not reached -% the necessary minimum size. +% Ok, now rinse and repeat if we haven't reached the last footnote +% in the block. % \begin{macrocode} \ifnum\FN@currentinsertion=\FN@savebox \edef\FN@slaveid{\splitbotmarks\FN@slave}% \FN@contribute@tw@ - \ifdim\FootnoteMainMinimum>\FN@myvsize - \loop - \setbox\tw@\vsplit\z@ to\z@ - \edef\FN@slaveid{\splitbotmarks\FN@slave}% - \FN@contribute@tw@ - \ifcase\ifdim\FootnoteMainMinimum>\FN@myvsize - \ifvoid\z@ - \@ne - \else - \tw@ - \fi\fi \z@ - \or - \PackageWarning{bigfoot}{too little main material}% - \else - \repeat - \fi \else \ifnum0\splitbotmarks\FN@master=\FN@masterslot \else \loop @@ -2774,7 +3023,7 @@ \dimexpr\FN@myvsize*\count\FN@currentinsertion/\@m \relax\relax} % \end{macrocode} % \end{macro} -% +% % \subsubsection{Main label for reconsideration} % When we are here, then there is not yet a split in the next footnote % blocks scheduled. We might have to restitch stuff together here, @@ -2806,20 +3055,43 @@ % the best previous one. Also we calculate the badness of the current % situation. % \begin{macrocode} - \xdef\FN@badness{\number\FN@entrybadness}% + \xdef\FN@penalties{\number\FN@entrypenalties}% \FN@checkcurrent % \end{macrocode} % No point in recursing if we can't beat the current best one. % However, if we find a forced break, this is considered perfect as % long as we are not overfull. Note that recursion can only increase -% the badness if we are still underfull here. +% the badness if we are still underfull here, so there is no point in +% using \cmd{\FN@penalties} as the deciding factor of whether there may +% be a point in recursing: the current ebadness (which is never less +% than the badness) already is minimal. % \begin{macrocode} \ifnum - \ifdim\skip@>\z@ \FN@ebadness \else \FN@badness \fi >\FN@bestebadness + \ifdim\skip@>\z@ \FN@ebadness \else \FN@penalties \fi + >\FN@bestcost\relax +%<trace> \if\foottrace1% +%<trace> \message{no recursion: \skip@=\the\skip@, +%<trace> \noexpand\FN@bestvsize=\FN@bestvsize, +%<trace> \noexpand\FN@ebadness=\FN@ebadness, +%<trace> \noexpand\FN@penalties=\FN@penalties, +%<trace> \noexpand\FN@bestcost=\FN@bestcost.}\fi \else - \xdef\FN@badness{\number\FN@entrybadness}% +%<trace> \if\foottrace1% +%<trace> \message{before recursion: \skip@=\the\skip@, +%<trace> \noexpand\FN@bestvsize=\FN@bestvsize, +%<trace> \noexpand\FN@ebadness=\FN@ebadness, +%<trace> \noexpand\FN@penalties=\FN@penalties, +%<trace> \noexpand\FN@bestcost=\FN@bestcost.^^J +%<trace> recurse with \noexpand\FN@penalties=\number\FN@entrypenalties.}\fi + \xdef\FN@penalties{\number\FN@entrypenalties}% \FN@vsizerecurse \FN@checkcurrent +%<trace> \if\foottrace1% +%<trace> \message{after recursion: \skip@=\the\skip@, +%<trace> \noexpand\FN@bestvsize=\FN@bestvsize, +%<trace> \noexpand\FN@ebadness=\FN@ebadness, +%<trace> \noexpand\FN@penalties=\FN@penalties, +%<trace> \noexpand\FN@bestcost=\FN@bestcost.}\fi \fi % \end{macrocode} % Don't look further if we had a forced break or are overfull or are @@ -2839,25 +3111,60 @@ \FN@contribute@tw@ \expandafter \FN@splitfurther \fi} +% \end{macrocode} % \end{macro} % \begin{macro}{\FN@checkcurrent} -% Check out the badness of the current configuration. +% Check out the badness of the current configuration. The last box +% on the list is the material constituting the discardable material +% after a split. % \begin{macrocode} \def\FN@checkcurrent{% + \FN@getbreakpenalty + \ifnum\FN@breakpenalty<-\@M + \edef\FN@breakpenalty{\number-\@M}% + \fi + \ifnum\FN@currentinsertion=\FN@savebox + \else + \ifdim\FN@specific\FN@currentinsertion\footnotecarryratio\p@>\z@ + \skip@ + \ifdim\FN@specific\FN@currentinsertion\footnotecarryratio\p@>\p@ + \dimexpr\ht\z@+\dp\z@\relax + \@plus-\dimexpr((\FN@myvsize+\ht\z@+\dp\z@) + *\p@/\dimexpr + \FN@specific\FN@currentinsertion + \footnotecarryratio\p@)\relax + \else + \FN@specific\FN@currentinsertion + \footnotecarryratio + \dimexpr\ht\z@+\dp\z@\relax + \@plus-\dimexpr\FN@myvsize+\ht\z@+\dp\z@\relax + \fi + \relax + \FN@getbadness\skip@ + \xdef\FN@penalties{\number\numexpr\FN@penalties+\badness}% + \fi + \fi \skip@\glueexpr\FN@vsize-\FN@myvsize *\count\FN@currentinsertion/\@m\relax - \FN@getbreakpenalty \FN@getbadness\skip@ - \xdef\FN@badness{\number\numexpr\FN@badness+% + \xdef\FN@penalties{\number\numexpr\FN@penalties+% \FN@breakpenalty+\@M}% \ifnum\badness>\@M \edef\FN@ebadness{\number\numexpr\maxdimen-\@ne}% \else \ifnum\badness=\@M - \edef\FN@ebadness{\number\numexpr\maxdimen-\tw@}% + \ifdim\skip@<\vsize + \edef\FN@ebadness{\number\numexpr\maxdimen-\tw@}% + \else + \edef\FN@ebadness{\number\numexpr\maxdimen}% + \fi \else \edef\FN@ebadness{\number\numexpr - \FN@badness+\badness}% + \FN@penalties+\badness + \ifdim\FN@specific\FN@currentinsertion\FootnoteMinimum>\FN@myvsize + 1000000 + \fi + }% \fi \fi \dimen@\glueexpr\FN@bestvsize\relax @@ -2881,13 +3188,13 @@ % So we check if it is at least better than the last one, in which % case we need to replace the previous best. % \begin{macrocode} - \ifnum\FN@bestebadness>\FN@ebadness \@ne\fi - \ifnum\FN@bestebadness<\FN@ebadness \tw@\fi + \ifnum\FN@bestcost>\FN@ebadness \@ne\fi + \ifnum\FN@bestcost<\FN@ebadness \tw@\fi \ifdim\skip@<\z@ - \ifdim\dimen@<\skip@ \@ne \else \tw@\fi + \ifdim\dimen@<\skip@ \@ne \fi \tw@ \fi \ifdim\dimen@>\skip@ \@ne\fi \tw@} -% \end{macrocode} +% \end{macrocode} % \end{macro} % \begin{macro}{\FN@mayberecordbest} % This checks whether the current configuration is better than a @@ -2904,8 +3211,8 @@ \FN@checkforbest \or \xdef\FN@tempinfo{\def\noexpand\FN@bestvsize{\the\skip@}% - \def\noexpand\FN@bestebadness{\FN@ebadness}% - \def\noexpand\FN@bestbadness{\number\FN@badness}% + \def\noexpand\FN@bestcost{\FN@ebadness}% + \def\noexpand\FN@bestbadness{\number\FN@penalties}% \def\noexpand\FN@bestconfig{\FN@config}% \def\noexpand\FN@bestslaveid{\FN@slaveid}% \def\noexpand\FN@bestsplitcolors{\FN@splitcolors}% @@ -2933,9 +3240,7 @@ \copy\z@\break\nointerlineskip \copy\FN@tempbox\penalty\FN@tempbox \let\@elt\FN@copycachebox - \FN@currentrecursion - \xdef\FN@tempinfo{\FN@myvsize=\the\FN@myvsize\relax}}% - \FN@tempinfo + \FN@currentrecursion}% \setbox\z@ \vbox\bgroup \unvbox\z@ @@ -2950,8 +3255,8 @@ \ifcase\FN@checkforbest \or \xdef\FN@tempinfo{\def\noexpand\FN@bestvsize{\the\skip@}% - \def\noexpand\FN@bestebadness{\FN@ebadness}% - \def\noexpand\FN@bestbadness{\number\FN@badness}% + \def\noexpand\FN@bestcost{\FN@ebadness}% + \def\noexpand\FN@bestbadness{\number\FN@penalties}% \def\noexpand\FN@bestconfig{\FN@config}% \def\noexpand\FN@bestslaveid{\FN@slaveid}% \def\noexpand\FN@bestsplitcolors{\FN@splitcolors}% @@ -2974,7 +3279,7 @@ \or \global\let\FN@config\FN@bestconfig \global\FN@vsize\FN@bestvsize - \global\let\FN@badness\FN@bestbadness + \global\let\FN@penalties\FN@bestbadness \egroup % \end{macrocode} % Restore the saved configuration. @@ -2990,7 +3295,7 @@ \ifnum\FN@currentinsertion=\FN@savebox \else \setbox\z@\vbox{% - \dimen@\dp\z@ + \prevdepth\dp\z@ \unvbox\z@ \ifvoid\FN@tempbox \else @@ -2998,16 +3303,18 @@ \marks\FN@master{\FN@masterslot}% \marks\FN@slave{\FN@slaveid}% \FN@coloraftersplit\FN@splitcolors + \FN@specific\FN@currentinsertion\FN@afterbreak \nobreak \unvbox\FN@tempbox}% + \FN@specific\FN@currentinsertion\FN@beforebreak \ht\FN@tempbox \dimexpr\ht\FN@tempbox+\dp\FN@tempbox-\FN@masterslot sp\relax \dp\FN@tempbox\FN@masterslot sp\relax \wd\FN@tempbox\maxdimen \fi - \ifdim\dimen@<\splitmaxdepth - \hrule\@height-\dimen@ \@width\z@ - \@depth \splitmaxdepth \relax \fi}% + \ifdim\prevdepth<\splitmaxdepth + \hrule\@height-\prevdepth \@width\z@ + \@depth \splitmaxdepth \relax \fi}% \ht\z@=\dimexpr\ht\z@+\dp\z@-\FN@masterslot sp\relax \dp\z@=\FN@masterslot sp \fi @@ -3019,7 +3326,10 @@ \ifvoid\FN@tempbox \egroup % \end{macrocode} % If not, we add the carried-over box to the list, flag it with a -% \cmd{\nobreak}, and subtract its size from the finished box. +% \cmd{\nobreak}, and subtract its size from the finished box. Please +% note that the \cmd{\expandafter} chain will expand just +% |\cmd\dimen@|, but everything following it will be evaluated only +% after \cmd{\egroup}, thus using the new height of the box. % \begin{macrocode} \else \dimen@-\dimexpr\ht\FN@tempbox+\dp\FN@tempbox\relax @@ -3032,7 +3342,7 @@ } % \end{macrocode} % \end{macro} -% +% % \begin{macro}{\FN@contribute@tw@} % This will go from the state where we have the previous % \cmd{\splitdiscards} struttified on the current list some material @@ -3155,6 +3465,7 @@ % \cmd{\FN@reconfig}. % \begin{macrocode} \def\FN@rejoin#1#2{{% +%<trace> \if\foottrace1\message{^^JRejoining #2}\fi \count@\FN@cache#2% \ifvoid\count@\else \global\advance\FN@vsize\dimexpr @@ -3181,7 +3492,7 @@ \fi}} % \end{macrocode} % \end{macro} -% +% % \begin{macro}{\FN@retainkept} % This relies on \cmd{\@elt} being set to \cmd{\FN@removecheck} which % expands to \cmd{\@ne} if |\box0| is strictly between the two values @@ -3197,13 +3508,13 @@ \ifcase \ifvoid\z@\m@ne\fi \FN@config\z@ %<trace> \if\foottrace8\message{^^J\string\FN@retainkept: -%<trace> retaining box \FN@slotget{\number\dp\z@}}\fi +%<trace> retaining Id \FN@slotget{\number\dp\z@}}\fi %<trace> \if\foottrace{16}{\showboxdepth4 \showboxbreadth400 %<trace> \tracingonline=\@ne\showbox\z@}\fi {\FN@retainkept \nointerlineskip \box\z@}% \or %<trace> \if\foottrace8\message{^^J\string\FN@retainkept: -%<trace> dropping box \FN@slotget{\number\dp\z@}}\fi +%<trace> dropping Id \FN@slotget{\number\dp\z@}}\fi %<trace> \if\foottrace{16}{\showboxdepth4 \showboxbreadth400 %<trace> \tracingonline=\@ne\showbox\z@}\fi \FN@retainkept @@ -3246,20 +3557,17 @@ \csname MFL@start#1\endcsname{#2}\fi#3} \@onlypreamble\FN@maybestart \AtBeginDocument{\@ifundefined{footinsdefault}% - {\DeclareNewFootnote[plain]{default}% + {\newfootnote[plain]{default}% {\let\@elt\FN@maybestart - \MFL@list\relax}}{}% - \let\c@footnote\c@footnotedefault - \let\thefootnote\thefootnotedefault - \def\thefootnotedefault{\thefootnote}% -} + \MFL@list\relax} + }{}% % \end{macrocode} % And since LaTeX's macros are inferior to our own (and would probably % not match too well), we reroot them to the default footnote style. % \begin{macrocode} -\def\footnote{\footnotedefault} -\def\footnotemark{\footnotemarkdefault} -\def\footnotetext{\footnotetextdefault} + \def\@footnotetext{\Footnotetextdefault{}} + \def\p@footnotedefault{\p@footnote} +} %</style> % \end{macrocode} % @@ -3272,7 +3580,7 @@ % is supposed to cater for the installation itself. % \begin{macrocode} %<installer> \input docstrip -%<installer&make> \askforoverwritefalse +%<installer&make> \askforoverwritefalse \nopreamble %<installer> \generate{ %<installer> \file{bigfoot.drv}{\from{bigfoot.dtx}{driver}} %<installer> \file{perpage.drv}{\from{perpage.dtx}{driver}} diff --git a/Master/texmf-dist/source/latex/bigfoot/bigfoot.ins b/Master/texmf-dist/source/latex/bigfoot/bigfoot.ins index 6f3200db1f4..f445cedcd79 100644 --- a/Master/texmf-dist/source/latex/bigfoot/bigfoot.ins +++ b/Master/texmf-dist/source/latex/bigfoot/bigfoot.ins @@ -1,28 +1,9 @@ %% -%% This is file `bigfoot.ins', -%% generated with the docstrip utility. -%% -%% The original source files were: -%% -%% bigfoot.dtx (with options: `installer') -%% -%% IMPORTANT NOTICE: -%% -%% For the copyright see the source file. -%% -%% Any modified versions of this file must be renamed -%% with new filenames distinct from bigfoot.ins. -%% -%% For distribution of the original source see the terms -%% for copying and modification in the file bigfoot.dtx. -%% -%% This generated file may be distributed as long as the -%% original source files, as listed above, are part of the -%% same distribution. (The sources need not necessarily be -%% in the same archive or directory.) -%% %% bigfoot is part of the bigfoot bundle for critical typesetting -%% Copyright 2004, 05, 06 David Kastrup <dak@gnu.org> +%% Copyright 2004--2014 David Kastrup <dak@gnu.org> +%% +%% The license notice and corresponding source code for this file are +%% contained in bigfoot.dtx. %% \input docstrip \generate{ diff --git a/Master/texmf-dist/source/latex/bigfoot/perpage.drv b/Master/texmf-dist/source/latex/bigfoot/perpage.drv index d90ad19647f..1a520416b48 100644 --- a/Master/texmf-dist/source/latex/bigfoot/perpage.drv +++ b/Master/texmf-dist/source/latex/bigfoot/perpage.drv @@ -22,7 +22,10 @@ %% in the same archive or directory.) %% %% perpage is part of the bigfoot bundle for critical typesetting -%% Copyright 2002, 03, 04, 05, 06 David Kastrup <dak@gnu.org> +%% Copyright 2002--2014 David Kastrup <dak@gnu.org> +%% +%% The license notice and corresponding source code for this file are +%% contained in perpage.dtx. %% \documentclass{ltxdoc} \usepackage{perpage} @@ -32,18 +35,6 @@ \AlsoImplementation \DocInput{perpage.dtx} \end{document} -\def\pp@ppagectr#1#2#3#4{\@ifundefined{c@pp@a@#1}{}{% - \def\next{#3}% - \expandafter\ifx\csname pp@page@#1\endcsname\next - \addtocounter{pp@a@#1}\@ne - \else - \setcounter{pp@a@#1}{\value{pp@r@#1}}% - \fi - \global\expandafter\let\csname pp@page@#1\endcsname\next - \edef\next{\noexpand - \@newl@bel{pp@r@#1}{#2}{{\number\value{pp@a@#1}}{#3}% - {#4}}}\next}} - \endinput %% %% End of file `perpage.drv'. diff --git a/Master/texmf-dist/source/latex/bigfoot/perpage.dtx b/Master/texmf-dist/source/latex/bigfoot/perpage.dtx index 0209aa9e5d2..ad4be3ad782 100644 --- a/Master/texmf-dist/source/latex/bigfoot/perpage.dtx +++ b/Master/texmf-dist/source/latex/bigfoot/perpage.dtx @@ -1,7 +1,10 @@ % \iffalse %% %% perpage is part of the bigfoot bundle for critical typesetting -%% Copyright 2002, 03, 04, 05, 06 David Kastrup <dak@gnu.org> +%% Copyright 2002--2014 David Kastrup <dak@gnu.org> +%% +%% The license notice and corresponding source code for this file are +%% contained in perpage.dtx. %% % This program is free software; you can redistribute it and/or modify % it under the terms of the GNU General Public License as published by @@ -17,7 +20,7 @@ % along with this program; if not, write to the Free Software % Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA % \fi -% \CheckSum{363} +% \CheckSum{396} % \GetFileInfo{perpage.sty} % \date{\filedate} % \author{David Kastrup\thanks{\texttt{dak@gnu.org}}} @@ -63,15 +66,15 @@ % \begin{quote} % |\renewcommand{\thefigure}{\thepage-\arabic{figure}}| % \end{quote} -% you'll have the problem that \thepage is updated asynchronously with -% the real page, since \TeX\ does not know which page the figure will -% end up. If you have used the |perpage| package for modifying the -% figure counter, however, at the point where the counter is -% incremented, the macro \cmd{\theperpage} will be set to the correct -% value corresponding to the actual page location. Note that this -% macro is shared between all counters, so advancing a different -% counter under control of |perpage| will render \cmd{\thefigure} -% incorrect. +% you'll have the problem that \cmd{\thepage} is updated +% asynchronously with the real page, since \TeX\ does not know which +% page the figure will end up. If you have used the |perpage| package +% for modifying the figure counter, however, at the point where the +% counter is incremented, the macro \cmd{\theperpage} will be set to +% the correct value corresponding to the actual page location. Note +% that this macro is shared between all counters, so advancing a +% different counter under control of |perpage| will render +% \cmd{\thefigure} incorrect. % % \DescribeMacro{\MakeSorted} % \begin{quote} @@ -152,18 +155,58 @@ % \end{macrocode} % % \section{The package interfaces} -% First identification. We just use date and version from CVS. +% First identification. % \begin{macrocode} %<*style> \NeedsTeXFormat{LaTeX2e} -\def\next$#1: #2 #3${#2} -\ProvidesPackage{perpage}[\next$Date: 2006/07/15 21:43:23 $ - \next$Revision: 1.12 $ Reset/sort counters per page] +\ProvidesPackage{perpage}[2014/10/25 2.0 Reset/sort counters per page] +% \end{macrocode} +% \begin{macro}{\pp@cl@begin} +% \begin{macro}{\pp@cl@end} +% These macros are considerable tricky. They are called as +% artificial `dependent' counters when the counter they are hooked +% into is advanced. The way in which those counters are called are +% one of the following: +% \begin{quote} +% \begin{verbatim} +% \def\@stpelt#1{\global\csname c@#1\endcsname \z@} +% \end{verbatim} +% \end{quote} +% which is the default way of resetting a subordinate counter used +% in \LaTeX, or +% \begin{quote} +% \begin{verbatim} +% \def\@stpelt#1{\global\csname c@#1\endcsname \m@ne\stepcounter{#1}} +% \end{verbatim} +% \end{quote} +% which is a little present from |fixltx2e.sty| as of 2014/05/01, +% quite complicating this feat. +% +% The startup code swallows either |\global \advance| or |\global|. +% \begin{macrocode} +\def\pp@cl@begin{\z@\z@ \begingroup} % \end{macrocode} +% The command used for ending our fake counters checks for the +% |\m@ne| condition. We don't want to bump our auxiliary counters +% twice, so we remove the following |\stepcounter| command. Things +% will go haywire if there is none, of course. +% \begin{macrocode} +\def\pp@cl@end{\afterassignment\pp@cl@end@ii \count@} +\def\pp@cl@end@ii{% + \relax + \expandafter\endgroup + \ifnum\count@<\z@ + \expandafter\pp@cl@end@iii + \fi} +\def\pp@cl@end@iii\stepcounter#1{} +% \end{macrocode} +% \end{macro} +% \end{macro} +% % \begin{macro}{\AddAbsoluteCounter} -% adds a counter with prefix |abs| to a given counter. It typesets as -% an arabic number and never gets reset. And it is advanced with the -% unprefixed counter. +% adds a counter with prefix |abs| to a given counter. It typesets +% as an arabic number and never gets reset. And it is advanced +% whenever the unprefixed counter gets advanced. % \begin{macrocode} \newcommand\AddAbsoluteCounter[1] {\@ifundefined{c@abs#1}{% @@ -172,9 +215,9 @@ \global\expandafter\let\csname cl@abs#1\endcsname\@empty \expandafter\xdef\csname theabs#1\endcsname{% \noexpand\number \csname c@abs#1\endcsname}% - \global\@namedef{c@pabs@#1}{\z@=\z@{% - \stepcounter{abs#1}% - \afterassignment}\count@}% + \global\@namedef{c@pabs@#1}{\pp@cl@begin + \stepcounter{abs#1}% + \pp@cl@end}% \@addtoreset{pabs@#1}{#1}}{}} % \end{macrocode} % \end{macro} @@ -294,7 +337,8 @@ \addtocounter{pp@a@#1}\m@ne \@addtoreset{pchk@#1}{#1}% \AtBeginDocument{\setcounter{pp@a@#1}\z@}% - \edef\next{\noexpand\AtEndDocument{\noexpand\setcounter{pp@a@#1}{% + \edef\next{\noexpand\AtEndDocument + {\noexpand\setcounter{pp@a@#1}{% \number\value{pp@a@#1}}}}\next} \@onlypreamble\pp@makeperpage % \end{macrocode} @@ -329,12 +373,12 @@ % \begin{macrocode} \def\pp@fetchctr#1{\expandafter\expandafter\expandafter\pp@fetchctrii \csname pp@r@#1@\number\value{pp@a@#1}\endcsname - \@empty\@empty} + {}{}} \global\let\theperpage\@empty -\def\pp@fetchctrii#1#2#3{\edef\pp@label{#1}% - \edef\pp@page{#2}% +\def\pp@fetchctrii#1#2#3{\def\pp@label{#1}% + \def\pp@page{#2}% \gdef\theperpage{#3}} % \end{macrocode} % \end{macro} @@ -352,8 +396,7 @@ % generic command. That is the reason we start off this command by % giving \cmd{\global} something to chew on. % \begin{macrocode} -\def\c@pchk@#1{\z@=\z@ - \begingroup +\def\c@pchk@#1{\pp@cl@begin % \end{macrocode} % Now we fetch the page value corresponding to the not yet adjusted % value of the absolute counter to see whether the previous counter @@ -379,18 +422,28 @@ % \begin{macro}{\pp@writectr} % This is the common ending of all pseudo reset counters. It writes % out an appropriate command to the |.aux| file with all required -% information. +% information. We try to replicate any sentinel kerns or penalties. % \begin{macrocode} \def\pp@writectr#1#2#3{\edef\next{% \string#1{#2}{\number\value{pp@a@#2}}{#3}{\noexpand\thepage}}% \pp@chkvlist \dimen@=\lastkern \ifdim\dimen@=\z@ \else \unkern\fi + \count@=\lastpenalty \protected@write\@auxout{}{\next}% - \ifdim\dimen@=\z@ \nobreak \else \kern\dimen@\fi - \afterassignment\endgroup\count@} + \ifdim\dimen@=\z@ + \penalty \ifnum\count@<\@M \@M \else \count@ \fi + \else \kern\dimen@\fi + \pp@cl@end} % \end{macrocode} % \end{macro} +% \begin{macro}{\pp@labeldef} +% This is a helper macro. +% \begin{macrocode} +\def\pp@labeldef#1#2#3#4#5{\@newl@bel{pp@r@#2}{#3}{{#1}{#4}{#5}}} +% \end{macrocode} +% \end{macro} +% % \begin{macro}{\pp@pagectr} % This is the workhorse for normal per page counters. It is called % whenever the |.aux| file is read in and establishes the @@ -399,9 +452,8 @@ % \begin{macrocode} \def\pp@pagectr#1#2#3#4{\@ifundefined{c@pp@a@#1}{}{% \addtocounter{pp@a@#1}\@ne - \edef\next{\noexpand - \@newl@bel{pp@r@#1}{#2}{{\number\value{pp@a@#1}}{#3}% - {#4}}}\next}} + \expandafter\pp@labeldef\expandafter + {\number\value{pp@a@#1}}{#1}{#2}{#3}{#4}}} % \end{macrocode} % \end{macro} % \begin{macro}{\c@schk@} @@ -413,8 +465,7 @@ % get reset, too, so that the check for changed |.aux| files will % still work. % \begin{macrocode} -\def\c@schk@#1{\z@=\z@ - \begingroup +\def\c@schk@#1{\pp@cl@begin \addtocounter{pp@a@#1}\@ne \ifnum\value{#1}=\@ne \expandafter\xdef\csname pp@g@#1\endcsname{\number\value{pp@a@#1}}% @@ -436,9 +487,8 @@ \count@0\csname pp@g@#1@#3\endcsname \advance\count@\@ne \expandafter\xdef\csname pp@g@#1@#3\endcsname{\number\count@}% - \edef\next{\noexpand - \@newl@bel{pp@r@#1}{#2}{{\number\count@}{#3}% - {#4}}}\next}} + \expandafter\pp@labeldef\expandafter + {\number\count@}{#1}{#2}{#3}{#4}}} % \end{macrocode} % \end{macro} % \begin{macro}{\c@spchk@} @@ -448,14 +498,12 @@ % and it would be hard to decide what to do in case count groups and % page positions overlap. % \begin{macrocode} -\def\c@spchk@#1{\z@=\z@ - \begingroup +\def\c@spchk@#1{\pp@cl@begin \addtocounter{pp@a@#1}\@ne \pp@fetchctr{#1}% \ifx\pp@page\@empty \else \setcounter{#1}{\pp@label}\fi \pp@writectr\pp@ppagectr{#1}{\noexpand\theabspage}} -%</style> % \end{macrocode} % \end{macro} % \begin{macro}{\pp@ppagectr} @@ -468,16 +516,32 @@ \setcounter{pp@a@#1}{\value{pp@r@#1}}% \fi \global\expandafter\let\csname pp@page@#1\endcsname\next - \edef\next{\noexpand - \@newl@bel{pp@r@#1}{#2}{{\number\value{pp@a@#1}}{#3}% - {#4}}}\next}} + \expandafter\pp@labeldef\expandafter + {\number\value{pp@a@#1}}{#1}{#2}{#3}{#4}}} +% \end{macrocode} +% \end{macro} +% \begin{macro}{\@testdef} +% \LaTeX's current (2007) definition of this macro causes save stack +% overflow. We fix this by an additional grouping. Delay to the +% beginning of document to keep Babel happy. +% \begin{macrocode} +\AtBeginDocument{% + \begingroup + \@testdef{}{undefined}{}% + \expandafter + \endgroup + \ifx\@undefined\relax + \let\pp@@testdef\@testdef + \def\@testdef#1#2#3{{\pp@@testdef{#1}{#2}{#3}% + \if@tempswa\aftergroup\@tempswatrue\fi}}% + \fi} +%</style> % \end{macrocode} % \end{macro} % -% \Finale{} +% \Finale % \endinput % Local Variables: % mode: doctex % TeX-master: "perpage.drv" % End: - diff --git a/Master/texmf-dist/source/latex/bigfoot/suffix.drv b/Master/texmf-dist/source/latex/bigfoot/suffix.drv index b77eddc6d27..cdf92eb2af4 100644 --- a/Master/texmf-dist/source/latex/bigfoot/suffix.drv +++ b/Master/texmf-dist/source/latex/bigfoot/suffix.drv @@ -21,8 +21,11 @@ %% same distribution. (The sources need not necessarily be %% in the same archive or directory.) %% -%% perpage is part of the bigfoot bundle for critical typesetting -%% Copyright 2002, 03, 04, 05, 06 David Kastrup <dak@gnu.org> +%% suffix is part of the bigfoot bundle for critical typesetting +%% Copyright 2002--2006 David Kastrup <dak@gnu.org> +%% +%% The license notice and corresponding source code for this file are +%% contained in suffix.dtx. %% \documentclass{ltxdoc} \usepackage{hyperref} diff --git a/Master/texmf-dist/source/latex/bigfoot/suffix.dtx b/Master/texmf-dist/source/latex/bigfoot/suffix.dtx index 04f2e9a868a..9a6478e73a7 100644 --- a/Master/texmf-dist/source/latex/bigfoot/suffix.dtx +++ b/Master/texmf-dist/source/latex/bigfoot/suffix.dtx @@ -1,7 +1,10 @@ % \iffalse %% -%% perpage is part of the bigfoot bundle for critical typesetting -%% Copyright 2002, 03, 04, 05, 06 David Kastrup <dak@gnu.org> +%% suffix is part of the bigfoot bundle for critical typesetting +%% Copyright 2002--2006 David Kastrup <dak@gnu.org> +%% +%% The license notice and corresponding source code for this file are +%% contained in suffix.dtx. %% % This program is free software; you can redistribute it and/or modify % it under the terms of the GNU General Public License as published by @@ -17,7 +20,7 @@ % along with this program; if not, write to the Free Software % Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA % \fi -% \CheckSum{206} +% \CheckSum{198} % \GetFileInfo{suffix.sty} % \author{David Kastrup\thanks{\href{mailto:dak@gnu.org} % {Email: \texttt{dak@gnu.org}}}} @@ -96,11 +99,7 @@ % First we announce the package and check for e\TeX~2. % \begin{macrocode} %<*style> -\def\next$#1: #2 #3${#2} -\edef\next{\noexpand - \ProvidesPackage{suffix}[\next$Date: 2006/07/15 21:24:56 $ - \next$Revision: 1.5 $ Variant command support]} -\next +\ProvidesPackage{suffix}[2006/07/15 1.5a Variant command support] \ifcase\ifx\eTeXversion\@undefined \@ne\fi \ifnum\eTeXversion<\tw@ \@ne\fi\z@ \else diff --git a/Master/texmf-dist/tex/latex/bigfoot/bigfoot.sty b/Master/texmf-dist/tex/latex/bigfoot/bigfoot.sty index 4a27b6154ee..ce4c14b6e6f 100644 --- a/Master/texmf-dist/tex/latex/bigfoot/bigfoot.sty +++ b/Master/texmf-dist/tex/latex/bigfoot/bigfoot.sty @@ -22,12 +22,13 @@ %% in the same archive or directory.) %% %% bigfoot is part of the bigfoot bundle for critical typesetting -%% Copyright 2004, 05, 06 David Kastrup <dak@gnu.org> +%% Copyright 2004--2014 David Kastrup <dak@gnu.org> +%% +%% The license notice and corresponding source code for this file are +%% contained in bigfoot.dtx. %% \NeedsTeXFormat{LaTeX2e} -\def\FN@next $#1: #2 #3${#2} -\ProvidesPackage{bigfoot}[\FN@next $Date: 2006/07/15 21:24:56 $ - \FN@next $Revision: 1.25 $ makes footnotes work]%} +\ProvidesPackage{bigfoot}[2014/10/23 2.0 makes footnotes work] \DeclareOption{para}{\PackageInfo{bigfoot}{Compatibility option `para' has no effect:^^J% @@ -41,6 +42,9 @@ \else\@makefnmark\nobreak\fi}} \DeclareOption{ruled}{\PassOptionsToPackage{ruled}{manyfoot}} +\DeclareOption{robust}{\def\FN@makefncall{\FN@makefnrobust}} +\DeclareOption{fragile}{\def\FN@makefncall{\FN@makefnfragile}} +\ExecuteOptions{robust} \DeclareOption{verbose}{\AtBeginDocument{% \def\@testdef #1#2#3{% \def\reserved@a{#3}% @@ -78,12 +82,13 @@ }% } -\def\MFL@minipage{% - \ifinner\else - \let\MFL@mpinsertsave\MFL@insert - \MFL@reinsert \let\MFL@insert\MFL@mpinsert - \fi -} +\def\FN@divert{% + \let\MFL@mpinsertsave\MFL@insert + \MFL@reinsert \let\MFL@insert\MFL@mpinsert} +\def\FN@enddivert{{\let\@elt\MFL@mpreinsert \MFL@list}} + +\def\MFL@minipage{\ifinner\else \FN@divert\fi} +\def\MFL@endminipage{\ifinner\else \FN@enddivert\fi} \def\MFL@mpreinsert#1#2{% \ifvoid#2\else \setbox\@tempboxa\vbox\bgroup\unvbox#2% @@ -193,6 +198,12 @@ \let\@elt\relax \expandafter\protected@xdef\csname FN@stack@#1\endcsname{% \iffalse}\fi} +\ifx\FN@beforebreak\@undefined + \let\FN@beforebreak\@empty +\fi +\ifx\FN@afterbreak\@undefined + \let\FN@afterbreak\@empty +\fi \def\FN@cache#1{\csname FN@cache\number#1\endcsname} \def\FN@sortlist{{% \setbox\z@\lastbox @@ -233,7 +244,7 @@ \global\setbox\FN@cache#2=\box\voidb@x} \def\@makefnvtext#1{% \FN@specific\FN@masterinsert\@makefntext{% - \clubpenalties\tw@\@MM\clubpenalty + \clubpenalties\thr@@\@MM\clubpenalty\z@ \vadjust{\nobreak\vskip-\baselineskip}\nobreak\hfill\break#1}} \ifx\@preparefnhtext\@undefined \def\@preparefnhtext{{% @@ -255,6 +266,9 @@ \FN@tempinfo} \fi \def\@makefnstartbox{% + \ifdefined\setspace@singlespace + \def\baselinestretch{\setspace@singlespace}% + \fi \reset@font\footnotesize \hsize\MFL@columnwidth \@parboxrestore \interlinepenalty\FN@specific\FN@masterinsert\interfootnotelinepenalty @@ -274,7 +288,7 @@ \ifx\@makefnvbox\@undefined \def\@makefnvbox#1{\vbox{% \@makefnstartbox - \clubpenalties\tw@\@MM\clubpenalty + \clubpenalties\thr@@\@MM\clubpenalty\z@ \let\@thefnmark\@empty \FN@specific\FN@masterinsert\@makefntext{\rule\z@\footnotesep \nobreak @@ -282,7 +296,7 @@ \@makefnendbox}}} \fi \def\hfootfraction{0.9} -\def\vtypefraction{0.6} +\def\vtypefraction{0.7} \def\FN@assembleboxes{% \ifhbox\z@ \dimen@\dp\z@ @@ -298,12 +312,13 @@ \setbox\z@\@makefnvbox{% {\unhbox\FN@tempbox}% \setbox\z@\lastbox\FN@joinhboxes}% - \ifdim\FN@vfound>\dimexpr\vtypefraction\p@*\FN@found\relax - \ifdim\dimexpr \ht\z@+\dp\z@>\hfootfraction\dimen@ii - \global\setbox\FN@tempbox\box\tw@ - \setbox\z@\@makefnvbox{\let\@makefnbreak\FN@pseudofillbreak - {\unhbox\FN@tempbox}\setbox\z@\lastbox\FN@joinhboxes}% - \fi + \ifcase + \ifdim\FN@vfound>\dimexpr\vtypefraction\p@*\FN@found\relax \@ne\fi + \ifdim\dimexpr \ht\z@+\dp\z@>\hfootfraction\dimen@ii \@ne\fi \z@ + \or + \global\setbox\FN@tempbox\box\tw@ + \setbox\z@\@makefnvbox{\let\@makefnbreak\FN@pseudofillbreak + {\unhbox\FN@tempbox}\setbox\z@\lastbox\FN@joinhboxes}% \fi \setbox\tw@\box\voidb@x \ht\z@\dimexpr \ht\z@+\dp\z@-\dimen@\relax @@ -338,8 +353,8 @@ \xdef\FN@found{\number\numexpr\FN@found+\@ne}% } \def\FN@pseudobreak{% - {\parskip\z@skip\parfillskip\z@skip\parindent\z@\vadjust{}\par\noindent - \vadjust{\nobreak\vskip-\baselineskip}\nobreak\hfill\break}} + {\parskip\z@skip\parfillskip\z@skip\parindent\z@\vadjust{}\par\noindent + \vadjust{\nobreak\vskip-\baselineskip}\nobreak\hfill\break}} \def\FN@pseudofillbreak{\nobreak\hskip\parfillskip\FN@pseudobreak} \def\@makefnbreak{\FN@magicglue {\footnotesep+\dp\strutbox}% {\footnotesep+\dp\strutbox+\baselineskip}% @@ -398,7 +413,7 @@ \stepcounter{FN@totalid}% \NCC@makemark{#3}% \ifnum#2<\FN@masterinsert - \FN@colorstackbgroup\MFL@minipage + \FN@colorstackbgroup\FN@divert \FN@newslot\FN@masterslot \count@\FN@id \dimen@=\dimexpr64\p@*\FN@masterinsert-\c@FN@totalid sp\relax @@ -419,43 +434,60 @@ \ifx\FN@boxtype\vbox \normalcolor\nobreak \else \FN@specific{#2}\@preparefnhtext \normalcolor \fi - \FN@specific{#2}\@makefntext - \iffalse\fi - \expandafter\xdef\csname FN@ht\number#2\endcsname{\the\footnotesep}% - \expandafter\xdef\csname FN@dp\number#2\endcsname{\the\dp\strutbox}% - \marks\FN@master{\FN@masterslot}% - \marks\FN@slave{\number\FN@id}% - \nobreak - \bgroup - \aftergroup\FN@commonending - \ifx\FN@boxtype\vbox - \rule\z@\footnotesep - \else - \ifx\FN@par\par\else - \let\FN@@par\par - \let\FN@@noindent\noindent - \let\FN@@indent\indent - \fi - \everyvbox\expandafter{\expandafter\everyvbox - \expandafter{\the\everyvbox}% - \let\par\FN@@par - \let\noindent\FN@@noindent - \let\indent\FN@@indent - \the\everyvbox}% - \let\par\FN@par - \let\noindent\FN@noindent - \let\indent\FN@indent - \fi - \afterassignment\ignorespaces - \expandafter\FN@fnotecommonii - \else + \expandafter \FN@makefncall + \else \PackageError{bigfoot}{#2 forbidden in \FN@masterinsert.}% {Higher-placed footnotes can't be anchored in inferior ones.^^J% I am not putting this text in a footnote. History:% \FN@errorstack}% \rule{1em}{\ht\strutbox}% \fi} -\def\FN@fnotecommonii#{\let\next} +\providecommand{\FN@seitenobreak}{\nobreak} +\def\FN@makefnstart{% + \expandafter\xdef\csname FN@ht\number\FN@masterinsert\endcsname + {\the\footnotesep}% + \expandafter\xdef\csname FN@dp\number\FN@masterinsert\endcsname + {\the\dp\strutbox}% + \expandafter\xdef\csname FN@wd\number\FN@masterinsert\endcsname + {\the\hsize}% + \marks\FN@master{\FN@masterslot}% + \marks\FN@slave{\number\FN@id}% + \nobreak + \ifx\FN@boxtype\vbox + \rule\z@\footnotesep + \else + \ifx\FN@par\par\else + \let\FN@@par\par + \let\FN@@noindent\noindent + \let\FN@@indent\indent + \fi + \everyvbox\expandafter{\expandafter\everyvbox + \expandafter{\the\everyvbox}% + \let\par\FN@@par + \let\noindent\FN@@noindent + \let\indent\FN@@indent + \the\everyvbox}% + \let\par\FN@par + \let\noindent\FN@noindent + \let\indent\FN@indent + \fi + \FN@seitenobreak + \afterassignment\ignorespaces} +\def\FN@makefnrobust#{% + \FN@specific\FN@masterinsert\@makefntext + \iffalse\fi + \bgroup + \aftergroup\FN@robustending + \FN@makefnstart + \let\next} +\def\FN@robustending{% + \expandafter\expandafter\expandafter + \expandafter\expandafter\expandafter\expandafter + \iffalse \FN@specific\FN@masterinsert\@makefntext\fi + \FN@commonending} +\long\def\FN@makefnfragile#1{% + \FN@specific\FN@masterinsert\@makefntext + {\FN@makefnstart#1\FN@commonending}} \newmarks\FN@color \def\FN@colorstackbgroup{\let\FN@savecolorstack\FN@colorstack \global\let\FN@colorstack\@empty @@ -469,8 +501,8 @@ \let\reset@color\FN@reset@color \let\color@begingroup\FN@color@begingroup} -\def\FN@colorstackegroup{\egroup\ifx\FN@colorstack\@empty - \global\let\FN@colorstack\FN@savecolorstack \fi} +\def\FN@colorstackegroup{\egroup + \global\let\FN@colorstack\FN@savecolorstack} \def\FN@colorstackfinish{\def\@elt##1##2{\FN@@reset@color##2}% \FN@colorstack @@ -505,9 +537,6 @@ #1% \let\@elt\relax} \def\FN@commonending{% - \expandafter\expandafter\expandafter - \expandafter\expandafter\expandafter\expandafter - \iffalse \FN@specific\FN@masterinsert\@makefntext\fi \@makefnendbox \ifx\FN@boxtype\vbox\@finalstrut\strutbox \else \unskip \fi \FN@colorstackfinish @@ -525,9 +554,12 @@ \wd\z@\dimen@ \dp\z@\FN@masterslot sp\relax \MFL@insert\FN@masterinsert{\nointerlineskip\box\z@}% + \ifdim\lastkern=\z@ \let\FN@next\@empty\else + \edef\FN@next{\kern\the\lastkern\relax}\unkern + \fi \marks\FN@slave{\number\FN@id}% - \MFL@endminipage - \FN@colorstackegroup + \expandafter\FN@enddivert\expandafter\FN@colorstackegroup + \FN@next } \dimen\footins\maxdimen \gdef\FN@nestlist{} @@ -542,7 +574,7 @@ \ifcase \ifvoid\z@\m@ne\fi \FN@config\z@ \ifnum\dp\z@=\count@\else \FN@freeslot{\number\dp\z@}\fi - \FN@retaindelayed + \expandafter\FN@retaindelayed \or {\FN@retaindelayed \nointerlineskip \box\z@}% \else \unpenalty \setbox\z@\lastbox @@ -592,8 +624,9 @@ \expandafter\expandafter\expandafter\let\FN@cache\FN@savebox=\@cclv -\expandafter\def\csname FN@ht\number\FN@savebox\endcsname{\topskip}% +\expandafter\def\csname FN@ht\number\FN@savebox\endcsname{\z@skip}% \expandafter\def\csname FN@dp\number\FN@savebox\endcsname{\maxdepth} +\expandafter\def\csname FN@wd\number\FN@savebox\endcsname{\columnwidth} \def\FN@list{\MFL@list\@elt{}\footins} @@ -654,7 +687,8 @@ \def\FN@insertmarks{% {\setbox\z@\copy\@cclv \splittopskip-\maxdimen\relax - \vbadness=\maxdimen + \vbadness=\@M + \vfuzz=\maxdimen \loop \ifvoid\z@\else {\let\@elt\FN@pseudomarks @@ -666,9 +700,16 @@ {\setbox\z@\vsplit\z@ to\maxdimen}% \next \repeat}} +\def\FootnoteMinimum{1sp} \def\FootnoteMainMinimum{0pt} +\expandafter\def\csname\string\FootnoteMinimum\number\FN@savebox +\endcsname{\FootnoteMainMinimum} \savingvdiscards=\@ne +\newcount\FN@outputflag +\FN@outputflag=3158345 \output{% + \let\@elt\relax + \ifvoid\@cclv \PackageError{bigfoot}{Empty box 255 in \output}\fi \ifnum\outputpenalty=-13750 \ifnum\insertpenalties>\z@ \PackageError{bigfoot}{Too much insertion material}{% @@ -676,7 +717,7 @@ gather all floating insertions in a single pass.^^J% Complain to the author if you consider this a bug}% \fi - \global\advance\FN@outervsize\dimexpr\ht\@cclv-\vsize\relax + \global\advance\FN@outervsize\dimexpr\ht\@cclv-\vsize \global\setbox\@cclv\box\voidb@x \else \edef\FN@outputpenalty{\number\outputpenalty}% @@ -684,21 +725,16 @@ \ifvoid\@holdpg \FN@sweeptopmarks \fi - \ifvoid\@cclv - \global\FN@outervsize\z@ - \else - \global\FN@outervsize\ht\@cclv - \global\setbox\@cclv\vbox{\unvbox\@cclv\boxmaxdepth\maxdepth}% - \global\advance\FN@outervsize-\ht\@cclv\relax - \fi + \FN@nest@iterate{\FN@insertouterspace\global\FN@outervsize + \dimexpr\z@}% + \global\advance\FN@outervsize\ht\@cclv + \global\setbox\@cclv\vbox{\unvbox\@cclv\boxmaxdepth\maxdepth}% \global\let\FN@vsadjustlist\@empty \FN@normaloutput \else - \ifvbox\@cclv - \dimen@\ht\@cclv - \global\setbox\@cclv\vbox{\unvbox\@cclv\boxmaxdepth\maxdepth}% - \global\advance\FN@outervsize\dimexpr\dimen@-\ht\@cclv\relax - \fi + \FN@nest@iterate{\FN@insertouterspace\global\advance\FN@outervsize + \dimexpr\ht\@cclv}% + \global\setbox\@cclv\vbox{\unvbox\@cclv\boxmaxdepth\maxdepth}% \FN@nest@iterate\FN@maybeinvalidatecache \vskip\z@skip \unvbox\FN@savebox @@ -714,36 +750,46 @@ \ifnum\FN@outputpenalty=-13751 \@ne\fi \tw@ \or \FN@vsadjustlist - \global\setbox\@cclv\vbox{\pagediscards}% \global\setbox\@cclv\lastbox \unskip \ifnum\FN@outputpenalty=-13749 \FN@normaloutput \else \the\FN@output + \@pageht-\vsize + \let\@currbox\footins + \@reinserts + \global\vsize-\@pageht \fi \else \dimen@\topskip \FN@vsadjustlist \setbox\z@\lastbox \unskip - \global\setbox\@cclv\vbox{\unvbox\z@ - \ifnum\outputpenalty<\@M \penalty\outputpenalty\fi - \pagediscards - \ifvbox\@cclv - \global\setbox\@cclv\vbox{\break\unvbox\@cclv}% - {\splittopskip-\maxdimen \setbox\z@\vsplit\@cclv to\z@}% - \unvbox\@cclv + \global\setbox\@cclv\vbox{% + \unvbox\z@ + \global\setbox\@cclv\vbox{\break\unvbox\@cclv}% + {\splittopskip-\maxdimen \setbox\z@\vsplit\@cclv to\z@} + \ifnum\outputpenalty=\@M + \setbox\z@\vbox{\pagediscards + \FN@cleanpagepenalty}% + \unvbox\z@ + \else + \penalty\outputpenalty + \pagediscards \fi + \unvbox\@cclv \boxmaxdepth\maxdepth}% \global\outputpenalty\FN@outputpenalty\relax \ifdim\dimen@>\z@ \hrule\@height\z@\@depth\z@ \unvcopy\FN@topmarkbox \penalty-13750 + \penalty\FN@outputflag \hrule\@height\z@\@depth\z@ \FN@insertmarks \penalty-13749 + \penalty\FN@outputflag \FN@prepareoutput \global\topskip-\maxdimen \global\vsize0.5\maxdimen @@ -755,13 +801,13 @@ \fi \fi} \def\FN@normaloutput{% - \FN@nest@iterate{\FN@insertouterspace\global\FN@vsize\dimexpr\z@}% + \global\FN@vsize\FN@outervsize + \global\advance\FN@vsize-\ht\@cclv\relax\relax \FN@nest@iterate\FN@sortinsert \FN@nest@iterate\FN@clearcache - \xdef\FN@config{\noexpand\@elt{\number0\botmarks\FN@slave}% + \xdef\FN@config{\@elt{\number0\botmarks\FN@slave}% {\number\maxdimen}}% \FN@nest@iterate\FN@reconfig - \global\advance\FN@vsize\FN@outervsize\relax \ifcase \ifnum\insertpenalties>\z@ \@ne\fi \ifnum\outputpenalty>-\@M @@ -770,16 +816,20 @@ \fi \ifdim\FN@vsize<\glueshrink\FN@vsize \thr@@ \fi \ifx\FN@vsadjustlist\@empty \else \thr@@\fi\z@ - \ifvbox\@cclv - {\vbadness\maxdimen - \global\setbox\@cclv\vbox - spread\FN@vsize{\unvbox\@cclv\boxmaxdepth\maxdepth}}% - \fi + {\vbadness\@M + \vfuzz\maxdimen + \global\setbox\@cclv\vbox + spread\FN@vsize{\unvbox\@cclv\boxmaxdepth\maxdepth}}% \the\FN@output + \let\@currbox\footins + \@pageht-\vsize + \@reinserts + \global\vsize-\@pageht \FN@nest@iterate\FN@clearcache \or \FN@restartoutput \penalty -13749 + \penalty \FN@outputflag \or \dimen@=\dimexpr\FN@vsize-\glueshrink\FN@vsize\relax \FN@prepareoutput @@ -790,12 +840,11 @@ \else \edef\FN@masterid{\number\maxdimen}% \def\FN@masterslot{-1}% - \global\setbox\@cclv\vbox{% - \box\@cclv}% + \global\setbox\@cclv\vbox{\box\@cclv}% \xdef\FN@config{\noexpand\@elt{\number0\botmarks\FN@slave}% {\number\maxdimen}}% \global\setbox\FN@savebox\vbox{}% - \gdef\FN@badness{0}% + \gdef\FN@penalties{0}% \edef\FN@defaultpenalty{\ifnum\outputpenalty<\@M \number\outputpenalty \else @@ -804,51 +853,55 @@ \@elt{}\FN@savebox\FN@nestlist\FN@mainsplitreturn \let\@elt\relax \global\setbox\FN@savebox\box\voidb@x - \count@\vbadness - \vbadness\maxdimen - \global\setbox\@cclv\vbox spread\FN@vsize\bgroup - \unvbox\@cclv - \ifnum\lastpenalty>\z@ - \unpenalty - \global\setbox\FN@tempbox\lastbox - \else - \global\setbox\FN@tempbox\box\voidb@x - \fi - \setbox\z@\lastbox - \ifvoid\z@ - \ifvbox\FN@tempbox - \ifnum\outputpenalty<\@M - \global\setbox\FN@tempbox{\unvbox\FN@tempbox - \penalty\outputpenalty}% - \fi - \global\outputpenalty=\@M + {% + \vbadness\@M + \vfuzz\maxdimen + \global\setbox\@cclv\vbox spread\FN@vsize{% + \unvbox\@cclv + \ifnum\lastpenalty>\z@ + \unpenalty + \global\setbox\FN@tempbox\lastbox + \else + \global\setbox\FN@tempbox\box\voidb@x \fi - \egroup \global\setbox\@cclv\box\voidb@x - \else - \MFL@removevboxes - \unvbox\z@ - \let\FN@defaultpenalty\@M - \FN@getbreakpenalty \setbox\z@\lastbox - \ifcase - \ifvbox\FN@tempbox \@ne\fi - \ifvoid\z@ \else \@ne\fi \z@ - \or - \global\setbox\FN@tempbox\vbox{\unvbox\z@ - \unvbox\FN@tempbox + \ifvoid\z@ + \ifvbox\FN@tempbox \ifnum\outputpenalty<\@M - \penalty\outputpenalty - \fi}% - \global\outputpenalty\FN@breakpenalty + \global\setbox\FN@tempbox{\unvbox\FN@tempbox + \penalty\outputpenalty}% + \fi + \global\outputpenalty=\@M + \fi + \else + \MFL@removevboxes + \unvbox\z@ + \edef\FN@defaultpenalty{\number\@M}% + \FN@getbreakpenalty + \setbox\z@\lastbox + \global\setbox\FN@tempbox\vbox\bgroup\unvbox\z@ + \unvbox\FN@tempbox + \ifnum\lastnodetype<\z@ + \egroup\global\setbox\FN@tempbox\box\voidb@x + \else + \ifnum\outputpenalty<\@M + \penalty\outputpenalty + \fi + \egroup + \global\outputpenalty\FN@breakpenalty + \fi \fi - \boxmaxdepth\maxdepth\egroup - \fi - \vbadness\count@ + \boxmaxdepth\maxdepth}% + }% \setbox\z@\box\FN@tempbox \let\@elt\relax \dimen@=\dimexpr\FN@vsize-\glueshrink\FN@vsize\relax \ifcase - \ifvoid\z@ \else\thr@@\fi + \ifvoid\z@ \ifnum\outputpenalty>-\@M + \ifdim\dimen@<\z@ \else \@ne \fi + \fi + \else \thr@@ + \fi \ifdim\ht\@cclv<\normalbaselineskip \@ne\fi \ifdim\dimen@<\normalbaselineskip \tw@\fi \@ne \or @@ -859,18 +912,28 @@ \global\advance\FN@outervsize-\vsize \global\deadcycles\z@ \or - \setbox\tw@\vbox{% - \the\FN@output - }% - \unvbox\tw@ - \unvbox\z@ - \FN@nest@iterate\FN@clearcache - \or + \setbox\tw@\vbox{% + \the\FN@output + }% + \unvbox\tw@ + \unvbox\z@ + \let\@currbox\footins + \@pageht-\vsize + \@reinserts + \global\vsize-\@pageht + \FN@nest@iterate\FN@clearcache + \or \FN@restartoutput \penalty -13751 + \penalty\FN@outputflag \unvbox\z@ + \ifnum\outputpenalty>\@M + \else \penalty + \ifnum\outputpenalty=\@M \z@ \else\outputpenalty\fi + \fi + \fi \fi - \fi} +} \def\FN@prepareoutput{% {\let\@elt\FN@recordinsertparam \xdef\FN@vsadjustlist{% @@ -888,6 +951,7 @@ \hrule\@height\z@\@depth\z@ \unvcopy\FN@topmarkbox \penalty -13750 + \penalty\FN@outputflag \hrule\@height\z@\@depth\z@ \FN@insertmarks \FN@prepareoutput @@ -900,11 +964,11 @@ \nointerlineskip\copy\z@ \setbox\z@ \vbox{\unvbox\z@ - \count@\FN@defaultpenalty\relax + \count@\@M \FN@getbreakpenaltyii \xdef\FN@tempinfo{\edef\noexpand\FN@breakpenalty{% - \number\ifnum\count@>-\@M \count@ - \else -\@M \fi}}}}% + \number\ifnum\count@=\@M \FN@defaultpenalty \else \count@\fi + }}}}% \FN@tempinfo} \def\FN@getbreakpenaltyii{% @@ -923,12 +987,39 @@ \count@\lastpenalty \unpenalty \expandafter\FN@getbreakpenaltyii \fi} +\def\FN@cleanpagepenalty{% + \ifcase + \ifnum\lastnodetype<\z@ \m@ne\fi + \ifnum\lastnodetype<11 \@ne\fi + \ifnum\lastnodetype>13 \@ne\fi + \numexpr\lastnodetype-9\relax + \or + \PackageError{bigfoot}{Illegal node type}{This can't happen}% + \or + \skip@=\lastskip \unskip + \expandafter \FN@cleanpagepenalty \expandafter\vskip\the + \expandafter\skip@ + \or + \dimen@=\lastkern \unkern + \expandafter \FN@cleanpagepenalty \expandafter\kern\the + \expandafter\dimen@ + \or + \count@\lastpenalty \unpenalty + \ifnum\count@=\FN@outputflag + \unpenalty\expandafter\expandafter\expandafter\FN@cleanpagepenalty + \else + \expandafter\FN@cleanpagepenalty\expandafter + \penalty\the\expandafter\expandafter\expandafter\count@ + \fi + \fi + \relax} \def\FN@mainsplitreturn{} \newdimen\FN@myvsize \newcount\bigfoottolerance \bigfoottolerance=100 \def\FN@getbadness#1{% - {\hfuzz\maxdimen\hbadness\maxdimen\setbox\z@\hbox to\z@{\hskip-#1}}} + {\hfuzz\maxdimen\hbadness\@M\setbox\z@\hbox to\z@{\hskip-#1}}} +\providecommand\footnotecarryratio{2} \def\FN@newlevel#1#2#3\FN@mainsplitreturn{% \count@\FN@cache#2% \ifvoid\count@ @@ -937,23 +1028,33 @@ {\def\FN@currentinsertion{#2}% \def\FN@currentrecursion{#3}% \let\FN@entryconfig\FN@config - \let\FN@entrybadness\FN@badness + \let\FN@entrypenalties\FN@penalties \splittopskip\csname FN@ht\number#2\endcsname\relax \splitmaxdepth\csname FN@dp\number#2\endcsname\relax - \vbadness=\maxdimen + \hsize\csname FN@wd\number#2\endcsname\relax + \vbadness=\@M \vfuzz\maxdimen \let\@elt\relax \expandafter\FN@newleveli\expandafter}% \fi} \def\FN@newleveli{% - \dimen@\dimexpr\ht\count@+\dp\count@\relax + \dimen@\dimexpr\ht\count@ + \ifnum\FN@currentinsertion=\FN@savebox + +\maxdepth + \else + +\dp\count@ + \fi\relax \global\advance\FN@vsize\dimexpr \dimen@ *\count\FN@currentinsertion/\@m\relax\relax \global\setbox\count@\vbox\bgroup\unvbox\count@ \ifnum\lastpenalty=\z@ \setbox\tw@\box\voidb@x \setbox\z@\lastbox - \FN@myvsize=\dimexpr\dimen@-\ht\z@-\dp\z@\relax + \FN@myvsize=\ifnum\lastnodetype<\z@ + \z@ + \else + \dimexpr\dimen@-\ht\z@-\dp\z@\relax + \fi \else \unpenalty \setbox\tw@\lastbox @@ -967,13 +1068,14 @@ \ht\z@=\dimexpr\ht\z@+\dp\z@-\dimen@\relax \dp\z@\dimen@ \fi - \edef\FN@bestebadness{\number\maxdimen}% + \edef\FN@bestcost{\number\maxdimen}% + \let\FN@bestbadness\FN@bestcost \let\FN@bestconfig\@undefined - \let\FN@bestvsize\z@skip + \def\FN@bestvsize{-\maxdimen}% \let\FN@splitcolors\@empty \ifnum\FN@currentinsertion=\FN@savebox \else - \def\FN@defaultpenalty{-\@M}% + \edef\FN@defaultpenalty{\number-\@M}% \edef\FN@masterslot{\number\dp\z@}% \edef\FN@masterid{\FN@slotget\FN@masterslot}% \fi @@ -983,17 +1085,19 @@ \setbox\z@\vbox{\vskip-\glueexpr(\FN@vsize-\dimexpr\FN@vsize \relax\@minus\glueshrink\FN@vsize)% *\@m/\count\FN@currentinsertion + \penalty\z@ \unvbox\z@ \ifnum\FN@defaultpenalty>-\@M - \penalty\FN@defaultpenalty\nointerlineskip + \penalty\FN@defaultpenalty\relax\nointerlineskip \vbox to\maxdimen{}% \fi}% \setbox\tw@\vsplit\z@ to% \dimexpr\FN@vsize*\@m/\count\FN@currentinsertion - -\FN@myvsize + -\FN@myvsize-\splitmaxdepth \relax \ifnum\FN@defaultpenalty>-\@M \setbox\z@\vbox\bgroup\unvbox\z@\setbox\z@\lastbox + \unskip \unpenalty \ifnum\lastnodetype<\z@ \egroup \setbox\z@\box\voidb@x @@ -1009,22 +1113,6 @@ \ifnum\FN@currentinsertion=\FN@savebox \edef\FN@slaveid{\splitbotmarks\FN@slave}% \FN@contribute@tw@ - \ifdim\FootnoteMainMinimum>\FN@myvsize - \loop - \setbox\tw@\vsplit\z@ to\z@ - \edef\FN@slaveid{\splitbotmarks\FN@slave}% - \FN@contribute@tw@ - \ifcase\ifdim\FootnoteMainMinimum>\FN@myvsize - \ifvoid\z@ - \@ne - \else - \tw@ - \fi\fi \z@ - \or - \PackageWarning{bigfoot}{too little main material}% - \else - \repeat - \fi \else \ifnum0\splitbotmarks\FN@master=\FN@masterslot \else \loop @@ -1069,12 +1157,13 @@ \fi \FN@currentrecursion \let\@elt\relax - \xdef\FN@badness{\number\FN@entrybadness}% + \xdef\FN@penalties{\number\FN@entrypenalties}% \FN@checkcurrent \ifnum - \ifdim\skip@>\z@ \FN@ebadness \else \FN@badness \fi >\FN@bestebadness + \ifdim\skip@>\z@ \FN@ebadness \else \FN@penalties \fi + >\FN@bestcost\relax \else - \xdef\FN@badness{\number\FN@entrybadness}% + \xdef\FN@penalties{\number\FN@entrypenalties}% \FN@vsizerecurse \FN@checkcurrent \fi @@ -1093,20 +1182,52 @@ \expandafter \FN@splitfurther \fi} \def\FN@checkcurrent{% + \FN@getbreakpenalty + \ifnum\FN@breakpenalty<-\@M + \edef\FN@breakpenalty{\number-\@M}% + \fi + \ifnum\FN@currentinsertion=\FN@savebox + \else + \ifdim\FN@specific\FN@currentinsertion\footnotecarryratio\p@>\z@ + \skip@ + \ifdim\FN@specific\FN@currentinsertion\footnotecarryratio\p@>\p@ + \dimexpr\ht\z@+\dp\z@\relax + \@plus-\dimexpr((\FN@myvsize+\ht\z@+\dp\z@) + *\p@/\dimexpr + \FN@specific\FN@currentinsertion + \footnotecarryratio\p@)\relax + \else + \FN@specific\FN@currentinsertion + \footnotecarryratio + \dimexpr\ht\z@+\dp\z@\relax + \@plus-\dimexpr\FN@myvsize+\ht\z@+\dp\z@\relax + \fi + \relax + \FN@getbadness\skip@ + \xdef\FN@penalties{\number\numexpr\FN@penalties+\badness}% + \fi + \fi \skip@\glueexpr\FN@vsize-\FN@myvsize *\count\FN@currentinsertion/\@m\relax - \FN@getbreakpenalty \FN@getbadness\skip@ - \xdef\FN@badness{\number\numexpr\FN@badness+% + \xdef\FN@penalties{\number\numexpr\FN@penalties+% \FN@breakpenalty+\@M}% \ifnum\badness>\@M \edef\FN@ebadness{\number\numexpr\maxdimen-\@ne}% \else \ifnum\badness=\@M - \edef\FN@ebadness{\number\numexpr\maxdimen-\tw@}% + \ifdim\skip@<\vsize + \edef\FN@ebadness{\number\numexpr\maxdimen-\tw@}% + \else + \edef\FN@ebadness{\number\numexpr\maxdimen}% + \fi \else \edef\FN@ebadness{\number\numexpr - \FN@badness+\badness}% + \FN@penalties+\badness + \ifdim\FN@specific\FN@currentinsertion\FootnoteMinimum>\FN@myvsize + 1000000 + \fi + }% \fi \fi \dimen@\glueexpr\FN@bestvsize\relax @@ -1117,10 +1238,10 @@ \@ne \fi \fi - \ifnum\FN@bestebadness>\FN@ebadness \@ne\fi - \ifnum\FN@bestebadness<\FN@ebadness \tw@\fi + \ifnum\FN@bestcost>\FN@ebadness \@ne\fi + \ifnum\FN@bestcost<\FN@ebadness \tw@\fi \ifdim\skip@<\z@ - \ifdim\dimen@<\skip@ \@ne \else \tw@\fi + \ifdim\dimen@<\skip@ \@ne \fi \tw@ \fi \ifdim\dimen@>\skip@ \@ne\fi \tw@} \def\FN@mayberecordbest{% @@ -1128,8 +1249,8 @@ \FN@checkforbest \or \xdef\FN@tempinfo{\def\noexpand\FN@bestvsize{\the\skip@}% - \def\noexpand\FN@bestebadness{\FN@ebadness}% - \def\noexpand\FN@bestbadness{\number\FN@badness}% + \def\noexpand\FN@bestcost{\FN@ebadness}% + \def\noexpand\FN@bestbadness{\number\FN@penalties}% \def\noexpand\FN@bestconfig{\FN@config}% \def\noexpand\FN@bestslaveid{\FN@slaveid}% \def\noexpand\FN@bestsplitcolors{\FN@splitcolors}% @@ -1144,9 +1265,7 @@ \copy\z@\break\nointerlineskip \copy\FN@tempbox\penalty\FN@tempbox \let\@elt\FN@copycachebox - \FN@currentrecursion - \xdef\FN@tempinfo{\FN@myvsize=\the\FN@myvsize\relax}}% - \FN@tempinfo + \FN@currentrecursion}% \setbox\z@ \vbox\bgroup \unvbox\z@ @@ -1157,8 +1276,8 @@ \ifcase\FN@checkforbest \or \xdef\FN@tempinfo{\def\noexpand\FN@bestvsize{\the\skip@}% - \def\noexpand\FN@bestebadness{\FN@ebadness}% - \def\noexpand\FN@bestbadness{\number\FN@badness}% + \def\noexpand\FN@bestcost{\FN@ebadness}% + \def\noexpand\FN@bestbadness{\number\FN@penalties}% \def\noexpand\FN@bestconfig{\FN@config}% \def\noexpand\FN@bestslaveid{\FN@slaveid}% \def\noexpand\FN@bestsplitcolors{\FN@splitcolors}% @@ -1173,7 +1292,7 @@ \or \global\let\FN@config\FN@bestconfig \global\FN@vsize\FN@bestvsize - \global\let\FN@badness\FN@bestbadness + \global\let\FN@penalties\FN@bestbadness \egroup \setbox\z@\vbox{\unvbox\tw@ \FN@restoreboxes}% \let\FN@splitcolors\FN@bestsplitcolors @@ -1184,7 +1303,7 @@ \ifnum\FN@currentinsertion=\FN@savebox \else \setbox\z@\vbox{% - \dimen@\dp\z@ + \prevdepth\dp\z@ \unvbox\z@ \ifvoid\FN@tempbox \else @@ -1192,16 +1311,18 @@ \marks\FN@master{\FN@masterslot}% \marks\FN@slave{\FN@slaveid}% \FN@coloraftersplit\FN@splitcolors + \FN@specific\FN@currentinsertion\FN@afterbreak \nobreak \unvbox\FN@tempbox}% + \FN@specific\FN@currentinsertion\FN@beforebreak \ht\FN@tempbox \dimexpr\ht\FN@tempbox+\dp\FN@tempbox-\FN@masterslot sp\relax \dp\FN@tempbox\FN@masterslot sp\relax \wd\FN@tempbox\maxdimen \fi - \ifdim\dimen@<\splitmaxdepth - \hrule\@height-\dimen@ \@width\z@ - \@depth \splitmaxdepth \relax \fi}% + \ifdim\prevdepth<\splitmaxdepth + \hrule\@height-\prevdepth \@width\z@ + \@depth \splitmaxdepth \relax \fi}% \ht\z@=\dimexpr\ht\z@+\dp\z@-\FN@masterslot sp\relax \dp\z@=\FN@masterslot sp \fi @@ -1300,16 +1421,13 @@ \csname MFL@start#1\endcsname{#2}\fi#3} \@onlypreamble\FN@maybestart \AtBeginDocument{\@ifundefined{footinsdefault}% - {\DeclareNewFootnote[plain]{default}% + {\newfootnote[plain]{default}% {\let\@elt\FN@maybestart - \MFL@list\relax}}{}% - \let\c@footnote\c@footnotedefault - \let\thefootnote\thefootnotedefault - \def\thefootnotedefault{\thefootnote}% + \MFL@list\relax} + }{}% + \def\@footnotetext{\Footnotetextdefault{}} + \def\p@footnotedefault{\p@footnote} } -\def\footnote{\footnotedefault} -\def\footnotemark{\footnotemarkdefault} -\def\footnotetext{\footnotetextdefault} \endinput %% %% End of file `bigfoot.sty'. diff --git a/Master/texmf-dist/tex/latex/bigfoot/perpage.sty b/Master/texmf-dist/tex/latex/bigfoot/perpage.sty index 3f4d8e216f4..6ddf546230e 100644 --- a/Master/texmf-dist/tex/latex/bigfoot/perpage.sty +++ b/Master/texmf-dist/tex/latex/bigfoot/perpage.sty @@ -22,12 +22,22 @@ %% in the same archive or directory.) %% %% perpage is part of the bigfoot bundle for critical typesetting -%% Copyright 2002, 03, 04, 05, 06 David Kastrup <dak@gnu.org> +%% Copyright 2002--2014 David Kastrup <dak@gnu.org> +%% +%% The license notice and corresponding source code for this file are +%% contained in perpage.dtx. %% \NeedsTeXFormat{LaTeX2e} -\def\next$#1: #2 #3${#2} -\ProvidesPackage{perpage}[\next$Date: 2006/07/15 21:43:23 $ - \next$Revision: 1.12 $ Reset/sort counters per page] +\ProvidesPackage{perpage}[2014/10/25 2.0 Reset/sort counters per page] +\def\pp@cl@begin{\z@\z@ \begingroup} +\def\pp@cl@end{\afterassignment\pp@cl@end@ii \count@} +\def\pp@cl@end@ii{% + \relax + \expandafter\endgroup + \ifnum\count@<\z@ + \expandafter\pp@cl@end@iii + \fi} +\def\pp@cl@end@iii\stepcounter#1{} \newcommand\AddAbsoluteCounter[1] {\@ifundefined{c@abs#1}{% \expandafter\newcount\csname c@abs#1\endcsname @@ -35,9 +45,9 @@ \global\expandafter\let\csname cl@abs#1\endcsname\@empty \expandafter\xdef\csname theabs#1\endcsname{% \noexpand\number \csname c@abs#1\endcsname}% - \global\@namedef{c@pabs@#1}{\z@=\z@{% - \stepcounter{abs#1}% - \afterassignment}\count@}% + \global\@namedef{c@pabs@#1}{\pp@cl@begin + \stepcounter{abs#1}% + \pp@cl@end}% \@addtoreset{pabs@#1}{#1}}{}} \AddAbsoluteCounter{page} \def\theabspage{\ifx\thepage\relax @@ -63,7 +73,8 @@ \addtocounter{pp@a@#1}\m@ne \@addtoreset{pchk@#1}{#1}% \AtBeginDocument{\setcounter{pp@a@#1}\z@}% - \edef\next{\noexpand\AtEndDocument{\noexpand\setcounter{pp@a@#1}{% + \edef\next{\noexpand\AtEndDocument + {\noexpand\setcounter{pp@a@#1}{% \number\value{pp@a@#1}}}}\next} \@onlypreamble\pp@makeperpage \def\pp@chkvlist{% @@ -84,15 +95,14 @@ \fi} \def\pp@fetchctr#1{\expandafter\expandafter\expandafter\pp@fetchctrii \csname pp@r@#1@\number\value{pp@a@#1}\endcsname - \@empty\@empty} + {}{}} \global\let\theperpage\@empty -\def\pp@fetchctrii#1#2#3{\edef\pp@label{#1}% - \edef\pp@page{#2}% +\def\pp@fetchctrii#1#2#3{\def\pp@label{#1}% + \def\pp@page{#2}% \gdef\theperpage{#3}} -\def\c@pchk@#1{\z@=\z@ - \begingroup +\def\c@pchk@#1{\pp@cl@begin \pp@fetchctr{#1}\let\next\pp@page \addtocounter{pp@a@#1}\@ne \pp@fetchctr{#1}% @@ -107,16 +117,18 @@ \pp@chkvlist \dimen@=\lastkern \ifdim\dimen@=\z@ \else \unkern\fi + \count@=\lastpenalty \protected@write\@auxout{}{\next}% - \ifdim\dimen@=\z@ \nobreak \else \kern\dimen@\fi - \afterassignment\endgroup\count@} + \ifdim\dimen@=\z@ + \penalty \ifnum\count@<\@M \@M \else \count@ \fi + \else \kern\dimen@\fi + \pp@cl@end} +\def\pp@labeldef#1#2#3#4#5{\@newl@bel{pp@r@#2}{#3}{{#1}{#4}{#5}}} \def\pp@pagectr#1#2#3#4{\@ifundefined{c@pp@a@#1}{}{% \addtocounter{pp@a@#1}\@ne - \edef\next{\noexpand - \@newl@bel{pp@r@#1}{#2}{{\number\value{pp@a@#1}}{#3}% - {#4}}}\next}} -\def\c@schk@#1{\z@=\z@ - \begingroup + \expandafter\pp@labeldef\expandafter + {\number\value{pp@a@#1}}{#1}{#2}{#3}{#4}}} +\def\c@schk@#1{\pp@cl@begin \addtocounter{pp@a@#1}\@ne \ifnum\value{#1}=\@ne \expandafter\xdef\csname pp@g@#1\endcsname{\number\value{pp@a@#1}}% @@ -132,11 +144,9 @@ \count@0\csname pp@g@#1@#3\endcsname \advance\count@\@ne \expandafter\xdef\csname pp@g@#1@#3\endcsname{\number\count@}% - \edef\next{\noexpand - \@newl@bel{pp@r@#1}{#2}{{\number\count@}{#3}% - {#4}}}\next}} -\def\c@spchk@#1{\z@=\z@ - \begingroup + \expandafter\pp@labeldef\expandafter + {\number\count@}{#1}{#2}{#3}{#4}}} +\def\c@spchk@#1{\pp@cl@begin \addtocounter{pp@a@#1}\@ne \pp@fetchctr{#1}% \ifx\pp@page\@empty @@ -150,10 +160,18 @@ \setcounter{pp@a@#1}{\value{pp@r@#1}}% \fi \global\expandafter\let\csname pp@page@#1\endcsname\next - \edef\next{\noexpand - \@newl@bel{pp@r@#1}{#2}{{\number\value{pp@a@#1}}{#3}% - {#4}}}\next}} - + \expandafter\pp@labeldef\expandafter + {\number\value{pp@a@#1}}{#1}{#2}{#3}{#4}}} +\AtBeginDocument{% + \begingroup + \@testdef{}{undefined}{}% + \expandafter + \endgroup + \ifx\@undefined\relax + \let\pp@@testdef\@testdef + \def\@testdef#1#2#3{{\pp@@testdef{#1}{#2}{#3}% + \if@tempswa\aftergroup\@tempswatrue\fi}}% + \fi} \endinput %% %% End of file `perpage.sty'. diff --git a/Master/texmf-dist/tex/latex/bigfoot/suffix.sty b/Master/texmf-dist/tex/latex/bigfoot/suffix.sty index f78ef43636b..4d38f2b7631 100644 --- a/Master/texmf-dist/tex/latex/bigfoot/suffix.sty +++ b/Master/texmf-dist/tex/latex/bigfoot/suffix.sty @@ -21,14 +21,13 @@ %% same distribution. (The sources need not necessarily be %% in the same archive or directory.) %% -%% perpage is part of the bigfoot bundle for critical typesetting -%% Copyright 2002, 03, 04, 05, 06 David Kastrup <dak@gnu.org> +%% suffix is part of the bigfoot bundle for critical typesetting +%% Copyright 2002--2006 David Kastrup <dak@gnu.org> %% -\def\next$#1: #2 #3${#2} -\edef\next{\noexpand - \ProvidesPackage{suffix}[\next$Date: 2006/07/15 21:24:56 $ - \next$Revision: 1.5 $ Variant command support]} -\next +%% The license notice and corresponding source code for this file are +%% contained in suffix.dtx. +%% +\ProvidesPackage{suffix}[2006/07/15 1.5a Variant command support] \ifcase\ifx\eTeXversion\@undefined \@ne\fi \ifnum\eTeXversion<\tw@ \@ne\fi\z@ \else |