脚注位置与顶部齐平

脚注位置与顶部齐平

我正在尝试将脚注向上移动,以便它们直接放在文本下方,而不是页面底部(见图)。

背景是,我正在尝试将一些非平凡的文档排版为单个大页面。这很好,但最后一行文本和脚注开头之间有相当大的距离,我想避免这种情况。

编辑:这专门涉及脚注相对于正文的位置,而不是有关各个脚注的组织方式。

另外,我尝试过\raggedbottom,但并没有改变任何东西:

\documentclass[a4paper]{scrartcl}

\usepackage{lipsum}
\raggedbottom

\begin{document}
\lipsum[1]Footnote.\footnote{Footnote}
\lipsum[2]
\end{document}

例子

使用 TeX 解决方案在 LaTeX 中放置脚注并不能解决我的问题。使用正常页面高度(没有\textheight=120pt)执行该代码仍然会在正文和脚注之间留出空间,即脚注的位置保持不变:

\documentclass{article}

\newcount\specfootnum % for global counting the footnotes
\newcount\fnotenum    % for footnote marks
\newif\ifrepeat

\tracingpages=1

\def\footnote{\global\advance\fnotenum by1 \fnmark\footnoteA}  
\def\footnoteA#1{\global\advance\specfootnum by1
   \edef\tmp{\indent\llap{\fnmark\kern2pt}}%   
   \expandafter\gdef\csname specfoot:\the\specfootnum
                    \expandafter\endcsname\expandafter{\tmp#1}%
   \setbox0=\hbox{\tmp#1}%
   \ifdim\wd0<.45\hsize \dimen0=.5\baselineskip
   \else \ifdim\wd0>\hsize \setbox0=\vbox{\tmp\strut#1\strut\par\kern0pt}\dimen0=\ht0
         \else\dimen0=\baselineskip 
   \fi\fi
   \insert\footins{\floatingpenalty=20000
                   \vbox to\dimen0{\vss\penalty\specfootnum}\penalty0}%
}
\def\fnmark{$^{\the\fnotenum}$}

\catcode`@=11
\def\pagecontents{\ifvoid\topins\else\unvbox\topins\fi
  \dimen@=\dp\@cclv \unvbox\@cclv % open up \box255
  \ifvoid\footins\else % footnote info is present
    \vskip\skip\footins \footnoterule \printspecfoot \fi
  \ifr@ggedbottom \kern-\dimen@ \vfil \fi
}


\gdef \@makecol {%
   \ifvoid\footins
     \setbox\@outputbox \box\@cclv
   \else
     \setbox\@outputbox \vbox {%
       \boxmaxdepth \@maxdepth
       \unvbox \@cclv
       \vskip \skip\footins
       \color@begingroup
         \normalcolor
         \footnoterule
         \footnoterule \printspecfoot 
  \ifx\@textbottom\relax\else\kern-\dimen@ \vfil \fi
       \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
}

\catcode`@=12

\def\printspecfoot{\bgroup\def\tmp{}%
  \setbox0=\vbox{\repeattrue \unvbox\footins 
     \loop \unpenalty \setbox0=\lastbox
        \ifvoid0 \repeatfalse 
        \else \setbox0=\vbox{\unvbox0 \xdef\tmp{\the\lastpenalty,\tmp}}\fi
        \ifrepeat \repeat
                }%
    \dimen1=\hsize \rm
    \expandafter\printspecfootA\tmp,
}
\def\printspecfootA#1,{\ifx,#1,\egroup\else
   \ifdim\dimen1<.45\hsize 
      \setbox0=\hbox{\csname specfoot:#1\endcsname}%
      \ifdim\wd0<.5\hsize
          \vskip-\baselineskip \vskip-\parskip
          \noindent\hskip.5\hsize \hskip-.5\parindent \box0 \par
          \dimen1=\hsize
      \else
          \noindent\unhbox0 \newdimenone
      \fi
   \else \csname specfoot:#1\endcsname \newdimenone \fi
   \global\expandafter\let\csname specfoot:#1\endcsname=\relax
   \expandafter \printspecfootA\fi
}
\def\newdimenone{$$\global\dimen1=\predisplaysize
  \abovedisplayskip=0pt \belowdisplayskip=0pt
  \abovedisplayshortskip=0pt \belowdisplayshortskip=0pt
  $$\advance\dimen1 by-2em\vskip-\baselineskip
}

%%% the test:

\textheight=120pt
\raggedbottom

\begin{document}


  Lorem ipsum dolor sit amet, consectetuer%
\footnote{First text.}
  adipiscing elit. Ut purus elit, vestibulum ut, placerat ac,   
  adipiscing vitae, felis. Curabitur dictum gravida mauris. Nam arcu%
\footnote{Second text.}
  libero, nonummy eget, consectetuer id, vulputate a, magna. Donec
  vehicula augue eu neque. Pellentesque habitant morbi tristique  
  senectus et netus et malesuada fames ac turpis egestas. Mauris ut  
  leo. Cras viverra metus rhoncus sem. Nulla et lectus vestibulum urna%
\footnote{Third text.}
  fringilla ultrices.  Phasellus eu tellus sit amet tortor gravida  
  placerat. Integer sapien est, iaculis in, pretium quis, viverra ac,
  nunc. Praesent eget sem vel leo ultrices bibendum. Aenean faucibus.  
  Morbi dolor nulla, malesuada eu, pulvinar at, mollis ac, nulla.
  Curabitur auctor semper nulla. Donec varius orci eget risus. Duis%
\footnote{Next text.}
  nibh mi, congue eu, accumsan eleifend, sagittis quis, diam. Duis
  eget orci sit amet orci dignissim rutrum.

  Morbi auctor lorem non justo. Nam lacus%
\footnote{Nulla malesuada porttitor diam. Donec felis
erat, congue non, volutpat at, lobortis vitae, tincidunt tristique, libero.}
  libero, pretium at, lobortis vitae, ultricies et, tellus. Donec
  aliquet, tortor sed accumsan bibendum, erat ligula aliquet magna,%
\footnote{Short text.}
  vitae ornare odio metus a mi. Morbi ac orci et nisl hendrerit%
\footnote{Next short text.}
  mollis. Suspendisse ut massa. Cras nec ante. Pellentesque a nulla.%
\footnote{Intersting short text.}
  Cum sociis natoque penatibus et magnis dis parturient montes, 
  nascetur ridiculus mus. Aliquam tincidunt urna. Nulla ullamcorper
  vestibulum turpis. Pellentesque cursus luctus mauris.%
\footnote{The last footnote.}

\end{document}

示例 2

答案1

必须修补 LaTeXs 输出例程,以将任何跳过内容移至页面末尾的脚注下方:

\documentclass{article}

\makeatletter

\newskip\prefootskip
\gdef \@makecol {%
   \ifvoid\footins
     \setbox\@outputbox \box\@cclv
   \else
     \setbox\@outputbox \vbox {%
       \boxmaxdepth \@maxdepth
       \unvbox \@cclv
       \prefootskip \lastskip
       \unskip
       \vskip \skip\footins
       \color@begingroup
         \normalcolor
         \footnoterule
         \unvbox\footins
       \color@endgroup
       \vskip \prefootskip
       }%
   \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

\begin{document}
  Lorem ipsum dolor sit amet, consectetuer%
\footnote{First text.}
  adipiscing elit. Ut purus elit, vestibulum ut, placerat ac,   
  adipiscing vitae, felis. Curabitur dictum gravida mauris. Nam arcu%
\footnote{Second text.}

\end{document}

在此处输入图片描述

如果将其与 KOMA-Script 类一起使用,则必须添加负空间来取消脚注规则引入的一些空间:

\documentclass{scrartcl}

\makeatletter

\newskip\prefootskip
\gdef \@makecol {%
   \ifvoid\footins
     \setbox\@outputbox \box\@cclv
   \else
     \setbox\@outputbox \vbox {%
       \boxmaxdepth \@maxdepth
       \unvbox \@cclv
       \prefootskip \lastskip
       \unskip
       \vskip \skip\footins
       \ifx\@textbottom\relax\else\vskip \z@ \@plus-.05fil\fi
       \color@begingroup
         \normalcolor
         \footnoterule
         \unvbox\footins
       \color@endgroup
       \ifx\@textbottom\relax\else\vskip \z@ \@plus.05fil\fi
       \vskip \prefootskip
       }%
   \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

\begin{document}


  Lorem ipsum dolor sit amet, consectetuer%
\footnote{First text.}
  adipiscing elit. Ut purus elit, vestibulum ut, placerat ac,   
  adipiscing vitae, felis. Curabitur dictum gravida mauris. Nam arcu%
\footnote{Second text.}

\end{document}

相关内容