为什么 multicol 中的重新插入与平常不同?

为什么 multicol 中的重新插入与平常不同?

我最近遇到了 multicol 和 dblfnote 的问题。解决该问题的方法是将 multicol 中的定义更改\reinsert@footnote

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

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

\@reinserts与正常的 LaTeX 输出程序相符。

为什么multicol要写一个空的脚注?通常这不会有什么区别,但有时会意外添加一个空框并导致 dblfnote 中断。

\reinsert@footnote事实证明,这是代码修补 multicol 的结果,在调用之前在环境末尾放置一个装饰。这是一个 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}

手动粘贴文本比使用 lipsum 更容易,因为它需要特定的长度。

答案1

事实证明,它之所以不执行正常\unvbox操作是因为没有意义。\box\footins仅包含输出例程中的可访问材料,并且当我们在页面上时会调用此代码。

正如所写,重新插入会给 dblfnote 带来问题,因为该包除了使用通常的插入机制外,还保留了一个并行列表,当添加一个空框而不在该并行列表中时,就会出现问题。将其更改为\unvbox可能只会让我们插入一个空框,这不会弄乱列表。

相关内容