footnoterule not moving with footnote

I'm using the book documentclass and the footmisc package.

I made some changes to the original footnote macros, and this causes the following problem when the footnoted word is on the last couple of lines of the page:

A minimal (not)working example:
book.main.tex
mylayout.sty

If line 67. in mylayout.sty is commented out, the footnoterule and the footnote moves to the next page, which is the expected behaviour. It beats me why it leaves the rule on the prev. page otherwise.

-
Please add full, but minimal working example (MWE) that illustrates your problem. Also, just compile the document without your modifications and see if it changes anything. –  Martin Scharrer May 9 '11 at 10:12
True, I should have provided one. Question edited accordingly. –  Nyiti May 9 '11 at 12:15
Thanks for providing a MWE. However post here should be self-contained and therefore it should be part of the post and not use some external pastebin site. You can replace fill-texts with \lipsum or \blindtext from the packages of the same name. –  Martin Scharrer May 9 '11 at 12:37

The problem comes from this:

\begin{minipage}[t]{\footwidth}\raggedright #1\end{minipage}


Comment out the minipage environment, leaving only \raggedright #1 and you'll see the standard behaviour:

in the page where the \footnote command is invoked, the footnoterule is drawn, and, if the whole footnote text doesn't fit in the page, the text is properly split: some lines will be written in the first page, and the remaining text will continue in the next page; however, since you are enclosing the text in a minipage, and minipages don't admit page breaks, the full footnote text is moved to the next page leaving a footnoterule without text in the first page.

-
Thanks for the explanation. The designer gods above me somehow don't like that, that's why I tried putting it in a minipage. Is it possible to keep the footnote text together some other way, or they can't have their cake and eat it too? –  Nyiti May 9 '11 at 12:42
@Nyiti: Change \interfootnotelinepenalty, see tex.ac.uk/cgi-bin/texfaq2html?label=splitfoot –  Ulrike Fischer May 9 '11 at 12:52
Thanks, I'll experiment with that value. –  Nyiti May 9 '11 at 12:58