3

Is it possible to use \renewcommand\footnoterule{} for a single page only ?

In other words, taken into account that separators are already set in pages 1-3, can I remove the footnote separator on my fourth page and set it again in my fifth page ?

Actually, I found some codes using the bigfoot/manyfoot packages, but they did not really help me to get what I want...

2

The footnote rule is typeset when the page number is already known. You can modify the definition of \footnoterule to do nothing when the page number is 4, taking advantage to the fact that the rule actually takes up no vertical space on the page.

\documentclass{article}
\usepackage[paperheight=4cm,paperwidth=3in,margin=1.3cm]{geometry}

\makeatletter
\renewcommand\footnoterule{
  \ifnum\c@page=4 \else
    \kern-3\p@
    \hrule \@width 2in \kern 2.6\p@ % the \hrule is .4pt high
  \fi
}
\makeatother

\begin{document}

a\footnote{a}\clearpage
b\footnote{b}\clearpage
c\footnote{c}\clearpage
d\footnote{d}\clearpage
e\footnote{e}

\end{document}

enter image description here

How to have a list of pages where not to use \footnoterule? Here's a way.

\documentclass{article}
\usepackage{xparse}

% just to get smaller pictures
\usepackage[paperheight=4cm,paperwidth=3in,margin=1.3cm]{geometry}

\ExplSyntaxOn

% keep the original \footnoterule
\cs_new_eq:NN \guillaume_footnoterule: \footnoterule
% redefine \footnoterule
\cs_set_protected:Npn \footnoterule
 {
  \bool_set_true:N \l_guillaume_footnoterule_bool
  \seq_map_function:NN \g_guillaume_footnoterule_pages_seq \guillaume_test:n
  \bool_if:NT \l_guillaume_footnoterule_bool { \guillaume_footnoterule: }
 }
\cs_new_protected:Nn \guillaume_test:n
 {
  \int_compare:nT { #1 = \value{page} }
   {
    \seq_map_break:n { \bool_set_false:N \l_guillaume_footnoterule_bool }
   }
 }
% save the list of pages where not to have a footnoterule
\seq_new:N \g_guillaume_footnoterule_pages_seq
\NewDocumentCommand{\nofootnoterule}{m}
 {
  \seq_gset_from_clist:Nn \g_guillaume_footnoterule_pages_seq { #1 }
 }
\ExplSyntaxOff

\nofootnoterule{1,3,4}

\begin{document}

a\footnote{a}\clearpage
b\footnote{b}\clearpage
c\footnote{c}\clearpage
d\footnote{d}\clearpage
e\footnote{e}

\end{document}

The command \nofootnoterule populates a sequence and at the moment when \footnoterule is called by the kernel, the current page number is checked against the sequence.

enter image description here

3
  • Thanks a lot @egreg. Actually, is it possible to add a OR condition to the \ifnum statement ? I.e. is it possible to specify a set of page (like \ifnum page=1 OR page=3, for instance) rather than a single page ? – Guillaume C. Jul 6 '20 at 7:28
  • @GuillaumeC. Yes, it's possible, I've just added some code. – egreg Jul 6 '20 at 7:48
  • This solved my issues. Thanks @egreg ! – Guillaume C. Jul 6 '20 at 7:52

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.