3

I've recently been having an issue with multicol and dblfnote. The solution to the issue was to change the definition in multicol of \reinsert@footnote from

\ifvoid\footins\else\insert\footins{}\fi

to

\ifvoid\footins\else\insert\footins{\unvbox\footins}\fi

Which matches the usual \@reinserts from the normal LaTeX output routine.

Why is multicol written to put in an empty footnote? Usually it doesn't make any difference, but it was sometimes accidentally adding an empty box and making dblfnote break.

It turns out that this is the result of code which patches multicol to put an ornament at the end of the environment, before \reinsert@footnote is called. Here's a MWE:

\documentclass{article}
\usepackage[papersize={17cm,24cm}]{geometry}
\usepackage{etoolbox}
\usepackage{calc}
\usepackage{multicol}
\usepackage{dblfnote}
\usepackage{adforn}
\usepackage{fourier-orns}

\def\endsecornament{\vbox{\kern12pt\centerline{%
  \adfflowerleft\hspace{-.04em}%
\raisebox{-2pt}{{\large\aldine}\hspace{-.04em}}%
 \adfflowerright}}}
 \newlength{\KunOrn}
 \settototalheight{\KunOrn}{\endsecornament}

\patchcmd\endmulticols{{multicols}\endgroup}
{{multicols}\endgroup\mcenlargepage}
{\typeout{Success! End Sec Ornament is On!}}
{\typeout{Patch failed! No end sec ornaments}\ERROR}
%\patchcmd\endmulticols{\reinsert@footnotes}{\ifdim
%\pagegoal=\maxdimen \reinsert@footnotes\fi}{\typeout{Patched
%reinsertion}}{\typeout{Failed to patch reinsertion}}
%The above is an effective solution to the issue

%----- code ------------
% 
%  #1 = min space needed
%  #2 = material to be inserted before \vspace{\multicolsep}
%       but with \nointerlineskip (arguable)

\newdimen \mctempdim

\def\mcenlargepagecode#1#2{%
 \mctempdim \dimexpr \pagegoal-\pagetotal+\pageshrink \relax
 \ifdim  \mctempdim < \dimexpr #1\relax
 \PackageWarning{multicol}%
 {Space remaining on page:
   \the\mctempdim \space < \the\dimexpr #1\relax
   \MessageBreak
   Enlarging page by
   \the\dimexpr #1-\mctempdim\relax}%
 \enlargethispage{\dimexpr #1-\mctempdim\relax}%
 \fi
 \nointerlineskip   
 #2%
}

%--- parametrization ----------

\setbox0\hbox{\endsecornament}

\def\mcenlargepage{\mcenlargepagecode{\KunOrn}%
{\endsecornament}}
\begin{document}

\begin{multicols}{2}

  Here is a whole bunch of text, used as filler.
  Here is a whole bunch of text, used as filler.
  Here is a whole bunch of text, used as filler.
  Here is a whole bunch of text, used as filler.
  Here is a whole bunch of text, used as filler.

  Here is a whole bunch of text, used as filler.
  Here is a whole bunch of text, used as filler.
  Here is a whole bunch of text, used as filler.
  Here is a whole bunch of text, used as filler.
  Here is a whole bunch of text, used as filler.

  Here is a whole bunch of text, used as filler.
  Here is a whole bunch of text, used as filler.
  Here is a whole bunch of text, used as filler.
  Here is a whole bunch of text, used as filler.
  Here is a whole bunch of text, used as filler.

  Here is a whole bunch of text, used as filler.
  Here is a whole bunch of text, used as filler.
  Here is a whole bunch of text, used as filler.
  Here is a whole bunch of text, used as filler.
  Here is a whole bunch of text, used as filler.

  Here is a whole bunch of text, used as filler.
  Here is a whole bunch of text, used as filler.
  Here is a whole bunch of text, used as filler.
  Here is a whole bunch of text, used as filler.
  Here is a whole bunch of text, used as filler.

  Here is a whole bunch of text, used as filler.
  Here is a whole bunch of text, used as filler.
  Here is a whole bunch of text, used as filler.
  Here is a whole bunch of text, used as filler.
  Here is a whole bunch of text, used as filler.

  Here is a whole bunch of text, used as filler.
  Here is a whole bunch of text, used as filler.
  Here is a whole bunch of text, used as filler.
  Here is a whole bunch of text, used as filler.
  Here is a whole bunch of text, used as filler.
  Here is a whole bunch of text, used as filler.
  Here is a whole bunch of text, used as filler.

  Here is a whole bunch of text, used as filler.
  Here is a whole bunch of text, used as filler.
  Here is a whole bunch of text, used as filler.
  Here is a whole bunch of text, used as filler.
  Here is a whole bunch of text, used as filler.
  Here is a whole bunch of text, used as filler.
  Here is a whole bunch of text, used as filler.

  Here is a whole bunch of text, used as filler.
  Here is a whole bunch of text, used as filler.
  Here is a whole bunch of text, used as filler.
  Here is a whole bunch of text, used as filler.
  Here is a whole bunch of text, used as filler.
  Here is a whole bunch of text, used as filler.
  Here is a whole bunch of text, used as filler.

  Here is a whole bunch of text, used as filler.
  Here is a whole bunch of text, used as filler.
  Here is a whole bunch of text, used as filler.
  Here is a whole bunch of text, used as filler.
  Here is a whole bunch of text, used as filler.
  Here is a whole bunch of text, used as filler.
  Here is a whole bunch of text, used as filler.

  And now, we type some more lines, to push the ornament to the
  next page\footnote{And a footnote}.
  And now, we type some more lines, to push the ornament to the
  next page

\end{multicols}


\begin{multicols}{2}

  Here is a whole bunch of text, used as filler.
  Here is a whole bunch of text, used as filler.
  Here is a whole bunch of text, used as filler.
  Here is a whole bunch of text, used as filler.
  Here is a whole bunch of text, used as filler.

\end{multicols}
\end{document}

It was easier to manually paste in the text, rather than use lipsum, because it needed to be a specific length.

7
  • 2
    multicol.dtx says % Instead of actually reinserting the footnotes we insert an empty % footnote. This will trigger insertion mechanism as well and since % the old footnotes are still in their box and we are on a fresh page % |\skip| |footins| should be correctly taken into account. % \changes{v1.3c}{1990/03/03}{\cs{unbox}ing avoided.} Sep 13 '17 at 7:02
  • how can it "sometimes" adds an empty box if it is only called when \footins is not void? please make a ME to prove that there is an issue. Sep 14 '17 at 6:30
  • @FrankMittelbach it turns out that it's not an issue with the package, persay, but with code you posted on another one of my questions. It seemed like putting an ornament at the end of the page triggered the normal output routine, which reinserted before the \endmulticols reinsertion happened. For some reason, that left me off with an extra empty box. I'm working on an MWE, but I'm not sure how important it is at this point.
    – A Gold Man
    Sep 14 '17 at 20:52
  • @AGoldMan I wouldn't be totally surprised if that extra code posted in the other other answer may need some further adjustments, but to do so one really would need an MWE for that. Still have my doubt that using \unvbox\footins could cure that. Sep 15 '17 at 9:16
  • @FrankMittelbach I added an MWE. You can see that both the \unvbox and the commented solution in the MWE solve the problem. It also seems like the code from the other question doesn't accurately take dblfnote's footnote space into account. I'll work on fixing that.
    – A Gold Man
    Sep 15 '17 at 15:17
1

It turns out that the reason it doesn't do the normal \unvbox operation is because there'd be no point. \box\footins only contains accessible material in the output routine, and this code is called when we're on the page.

As written, the reisertion creates an issue with dblfnote because that package keeps a parallel list in addition to using the usual insert mechanism, and when an empty box is added and not on that parallel list, it makes things wonky. Changing it to \unvbox presumably just made us insert a void box, which wouldn't mess up with the list.

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.