在脚注底部添加材料

在脚注底部添加材料

我想在脚注底部添加垂直材料。我预计这将涉及检查\footins分页符之前是否为非空(\ifvoid\footins\else …)并有条件地插入垂直材料(… \insert\footins{\vspace{1cm}}\fi)。但是,我似乎找不到正确的命令来修补;我尝试修改\@makecol,并\@opcol从 LaTeX 的\output例程(\let\old@makecol=\@makecol\renewcommand\@makecol{\ifvoid\footins … \fi\old@makecol})中修改 ,但没有成功。

下图说明了我的动机。有一个页脚,页脚上方是脚注,脚注上方是正文。当有脚注时,我想将它们稍微升高一点,如红色箭头所示。

显示页脚和脚注的图像

以下 MWE 基于GuM 的回答将文档排版如上图所示。

% My standard header for TeX.SX answers:
\documentclass[a4paper]{article} % To avoid confusion, let us explicitly 
                                 % declare the paper format.

\usepackage[T1]{fontenc}         % Not always necessary, but recommended.
% End of standard header.  What follows pertains to the problem at hand.

\usepackage{fancyhdr}
\usepackage{lipsum}

% The fancy page style:
\fancyhf{}
\fancyfoot[C]{\thepage}
\renewcommand*{\footrulewidth}{.4pt}
\pagestyle{fancy}



\begin{document}

This should be a page without footnotes.

\lipsum[1-4]

Here we place a footnote.\footnote{This one.}  Then we add more text.

\lipsum[5-15]

A long footnote occurs here.\footnote{\lipsum*[16]}.

\lipsum[17-20]

\end{document}

答案1

如果我正确理解了您的问题,您只需要在脚注下方(和页脚上方)添加一些空间。请尝试以下操作(解释在评论中):

% My standard header for TeX.SX answers:
\documentclass[a4paper]{article} % To avoid confusion, let us explicitly 
                                 % declare the paper format.

\usepackage[T1]{fontenc}         % Not always necessary, but recommended.
% End of standard header.  What follows pertains to the problem at hand.

\usepackage{fancyhdr}
\usepackage{lipsum}

\newlength\WitikoAdditionalspace
\setlength\WitikoAdditionalspace{1cm} % you said so

\makeatletter

% Add our additional space to the space to subtract from the page goal on pages 
% where at least one footnote occur:
\addtolength{\skip\footins}{\WitikoAdditionalspace}

% Patch the output routine (without "etoolbox"):
\gdef \@makecol {%
   \ifvoid\footins
     \setbox\@outputbox \box\@cclv
   \else
     \setbox\@outputbox \vbox {%
       \boxmaxdepth \@maxdepth
       \unvbox \@cclv
       % Only the amount of space originally devised by LaTeX should go above 
       % the footnotes:
       \skip@ \skip\footins
       \advance \skip@ -\WitikoAdditionalspace
       \vskip \skip@
       % (We could also say
       % \vskip \dimexpr \skip\footins -\WitikoAdditionalspace \relax
       % but let's keep the LaTeX kernel independent of eTeX extensions...)
       \color@begingroup
         \normalcolor
         \footnoterule
         \unvbox \footins
         % Add our space below the footnotes:
         \vskip \WitikoAdditionalspace
       \color@endgroup
       }%
   \fi
   \let\@elt\relax
   \xdef\@freelist{\@freelist\@midlist}%
   \global \let \@midlist \@empty
   \@combinefloats
   \ifvbox\@kludgeins
     \@makespecialcolbox
   \else
     \setbox\@outputbox \vbox to\@colht {%
       \@texttop
       \dimen@ \dp\@outputbox
       \unvbox \@outputbox
       \vskip -\dimen@
       \@textbottom
       }%
   \fi
   \global \maxdepth \@maxdepth
}

\makeatother

% The fancy page style:
\fancyhf{}
\fancyfoot[C]{\thepage}
\renewcommand*{\footrulewidth}{.4pt}
\pagestyle{fancy}



\begin{document}

This should be a page without footnotes.

\lipsum[1-4]

Here we place a footnote.\footnote{This one.}  Then we add more text.

\lipsum[5-15]

A long footnote occurs here.\footnote{\lipsum*[16]}.

\lipsum[17-20]

\end{document}

添加: 回答@Witiko 的评论不,没有特别的理由避免使用 eTeX 扩展或软件包etoolbox。但是,由于补丁并非简单地替换一个或两个标记,因此明确写下修补后的宏应该是什么样子可能会更安全。

\patchcmd下面是一个使用和的示例\glueexpr不是 \dimexpr!):

% My standard header for TeX.SX answers:
\documentclass[a4paper]{article} % To avoid confusion, let us explicitly 
                                 % declare the paper format.

\usepackage[T1]{fontenc}         % Not always necessary, but recommended.
% End of standard header.  What follows pertains to the problem at hand.

\usepackage{etoolbox}
\usepackage{fancyhdr}
\usepackage{lipsum}

\newlength\WitikoAdditionalSpace
\setlength\WitikoAdditionalSpace{1cm} % you said so

\makeatletter

% Add our additional space to the space to subtract from the page goal on pages 
% where at least one footnote occur:
\addtolength{\skip\footins}{\WitikoAdditionalSpace}

% Patch the output routine with "etoolbox":
\patchcmd{\@makecol}
    {\vskip \skip\footins}
    {\vskip \glueexpr \skip\footins -\WitikoAdditionalSpace \relax}
    {\typeout{1st patch succeeded.}}
    {\typeout{1st patch FAILED!}}
\patchcmd{\@makecol}
    {\unvbox \footins}
    {\unvbox \footins \vskip \WitikoAdditionalSpace}
    {\typeout{2nd patch succeeded.}}
    {\typeout{2nd patch FAILED!}}

\makeatother

% The fancy page style:
\fancyhf{}
\fancyfoot[C]{\thepage}
\renewcommand*{\footrulewidth}{.4pt}
\pagestyle{fancy}



\begin{document}

This should be a page without footnotes.

\lipsum[1-8]

Here we place a footnote.\footnote{This one.}  Then we add more text.

\lipsum[9-15]

A long footnote occurs here.\footnote{\lipsum*[16]}.

\lipsum[17-24]

\end{document}

相关内容