# toggle presence of footnote rule

I have two kinds of footnotes, for which I need two kinds of footnote rules. The MnWE below describes what I want to see.

I can turn off the standard rule by uncommenting the line

%\usepackage[norule]{footmisc}


but don't know how to enable it selectively.

I will rarely have both kinds of footnotes on a single page, and my document changes rarely so a hack solution is acceptable.

[][3

\documentclass{memoir}

\pagestyle{ruled}

\setstocksize{2in}{5in} % for mwe
\settrimmedsize{2in}{5in} {*}
\setlrmarginsandblock{0.3in}{0.3in}{*}%%%%
\setulmarginsandblock{0.5in}{0.5in}{*}
\checkandfixthelayout
\fixpdflayout

%\usepackage[norule]{footmisc}

\newcommand{\biblio}[1]{%
\let\thempfn\relax% Remove footnote number printing mechanism
\footnotetext[0]{%
\hrule%
\vspace{0.1in}%
#1}% Print footnote text
}
\begin{document}

First page, with a biblio footnote. It should show just my hrule, and
no footnote rule.
\biblio{Bibiographic reference}

\newpage
Second page, with just an ordinary footnote. It should show the
ordinary footnote rule.
\footnote{This is an ordinary footnote.}

\newpage
Third page both a footnote and a biblio footnote. It should show both
the footnote rule and my hrule.
\footnote{This is an ordinary footnote.}
\biblio{Bibiographic reference}

\end{document}


Something like this, perhaps?

The norule option of footmisc does redefine \footnoterule to do nothing in general as and just applies a skip instead.

I've introduced the \newif\iffootnoterule conditional, that is checked each time in \footnoterule and if true, applies the stored definition of \footnoterule (by \let\latex@@footnoterule\footnoterule).

This way it's possible to toggle with \footnoteruletrue or \footnoterulefalse.

\documentclass{memoir}

\pagestyle{ruled}

\newif\iffootnoterule

\makeatletter
\AtBeginDocument{%
\let\latex@@footnoterule\footnoterule

\renewcommand\footnoterule{%
\iffootnoterule
\latex@@footnoterule%
\else
\fi
}
}
\makeatother

\setstocksize{2in}{5in} % for mwe
\settrimmedsize{2in}{5in} {*}
\setlrmarginsandblock{0.3in}{0.3in}{*}%%%%
\setulmarginsandblock{0.5in}{0.5in}{*}
\checkandfixthelayout
\fixpdflayout

%\usepackage[norule]{footmisc}

\newcommand{\biblio}[1]{%
\let\thempfn\relax% Remove footnote number printing mechanism
\footnotetext[0]{%
\hrule%
\vspace{0.1in}%
#1}% Print footnote text
}
\begin{document}

First page, with a biblio footnote. It should show just my hrule, and
no footnote rule.
\biblio{Bibiographic reference}

\newpage
\footnoteruletrue
Second page, with just an ordinary footnote. It should show the
ordinary footnote rule.
\footnote{This is an ordinary footnote.}

\newpage
Third page both a footnote and a biblio footnote. It should show both
the footnote rule and my hrule.
\footnote{This is an ordinary footnote.}
\biblio{Bibiographic reference}

\end{document}


Edit: here is an updated version that manages the presence/absence of a footnote rule automatically, by disabling it at the start of each page and enabling it whenever there is a real footnote. It also restores footnote numbering, and tests more extensively.

\documentclass{memoir}

\pagestyle{ruled}

\setstocksize{2in}{5in} % for mwe
\settrimmedsize{2in}{5in} {*}
\setlrmarginsandblock{0.3in}{0.3in}{*}%%%%
\setulmarginsandblock{0.5in}{0.5in}{*}
\checkandfixthelayout
\fixpdflayout

\usepackage[perpage]{footmisc}

\newcommand{\biblio}[1]{%
\let\xxxx\thempfn
\let\thempfn\relax% Remove footnote number printing mechanism
\footnotetext[0]{%
\hrule%
\vspace{0.1in}%
#1}% Print footnote text
\let\thempfn\xxxx% Restore footnote number printing mechanism
}

\usepackage{bophook}

\newif\iffootnoterule

\makeatletter
\AtBeginDocument{%
\let\latex@@footnoterule\footnoterule

\renewcommand\footnoterule{%
\iffootnoterule
\latex@@footnoterule%
\else
\fi
}
}
\makeatother

\let\realfootnote\footnote

\renewcommand{\footnote}[1]{%
\global\footnoteruletrue
\realfootnote{#1}
}

\AtBeginPage{%
\global\footnoterulefalse
}
\begin{document}

First page, with a biblio footnote. It should show just my hrule, and
no footnote rule.
\biblio{Bibliographic reference}

\newpage
Second page, with two ordinary footnotes. It should show the
ordinary footnote rule.
\footnote{This is an ordinary footnote.}
\footnote{This is an another.}

\newpage
Third page with two footnotes and a biblio footnote. It should show both
the footnote rule and my hrule.
\footnote{This is an ordinary footnote.}
\footnote{This is an another.}
\biblio{Bibliographic reference}

\end{document}

• +1 thank you. I took the liberty of editing your lovely answer to show how I managed to take your idea and implement it automatically. – Ethan Bolker Jun 3 '16 at 17:42
• @EthanBolker: Well, yes, I had no idea that this should be done automatically switched on/off – user31729 Jun 3 '16 at 17:43
• You couldn't have known since I didn't ask for it ... – Ethan Bolker Jun 3 '16 at 17:44