summaryrefslogtreecommitdiff
path: root/macros/latex/contrib/footmisc/footmisc.dtx
diff options
context:
space:
mode:
Diffstat (limited to 'macros/latex/contrib/footmisc/footmisc.dtx')
-rw-r--r--macros/latex/contrib/footmisc/footmisc.dtx29
1 files changed, 18 insertions, 11 deletions
diff --git a/macros/latex/contrib/footmisc/footmisc.dtx b/macros/latex/contrib/footmisc/footmisc.dtx
index c3a31d2e6a..bafdb76df3 100644
--- a/macros/latex/contrib/footmisc/footmisc.dtx
+++ b/macros/latex/contrib/footmisc/footmisc.dtx
@@ -38,7 +38,7 @@
%<+package>\DeclareCurrentRelease{}{2022-02-14}
%<package>\ProvidesPackage{footmisc}%
%<*!debugins>
- [2022/03/07 v6.0c
+ [2022/03/08 v6.0d
%</!debugins>
%<package> a miscellany of footnote facilities%
%<*dtx>
@@ -1865,24 +1865,31 @@
% resets footnotes at each chapter start. As a result the first
% footnote on the first page of a chapter starts with 2. We
% therefore alter one \LaTeX{} internal if \pkg{perpage} is in use:
-% \changes{v6.0c}{2022/03/07}{Fix an issue in perpage packag (gh/03)}
+% \changes{v6.0c}{2022/03/07}{Fix an issue in perpage package (gh/03)}
+% \changes{v6.0d}{2022/03/07}{Also support optional arg of \cs{MakePerPage} (gh/03)}
% \begin{macrocode}
\def\@stpelt#1{\global\csname c@#1\endcsname \m@ne
\stepcounter{#1}%
- \setcounter{#1}{0}%
+ \pp@fix@MakePerPage{#1}%
+ }
+ \def\pp@fix@MakePerPage#1{%
+ \ifnum \value{#1}>\z@
+ \addtocounter{#1}\m@ne\fi
}
% \end{macrocode}
-% The above code may look a bit odd: the \cs{stepcounter} sets
-% the counter to zero and then the \cs{setcounter} does the
-% same. The reason is that \cs{stepcounter} resets other counters
-% and when perpage is loaded this results in updating counters on
-% the reset list to 1, which is precisely the problem here. So
-% the second \cs{setcounter} undoes this if it happens.
+% The above code may look a bit odd: the \cs{stepcounter} sets the
+% counter to zero and then we alter it if it is not zero. The
+% reason is that \cs{stepcounter} resets other counters and when
+% perpage is loaded this results in updating counters on the reset
+% list to 1 (or to a higher starting value if \cs{MakePerPage} is
+% used with an optional argument, which is precisely the problem
+% here. By subtracting 1 in that case we set it back to 1 lower
+% than the starting value.
%
-% But to make this fully work we also need to update a suport
+% But to make this fully work we also need to update a support
% command in \pkg{perpage}:
% \begin{macrocode}
- \def\pp@cl@end@iii\stepcounter#1\setcounter#2#3{}
+ \def\pp@cl@end@iii\stepcounter#1\pp@fix@MakePerPage#2{}
% \end{macrocode}
%
% \begin{macrocode}