以特定方式排列脚注的解决方案有三个意想不到的效果。这些效果可以修复/撤消吗?
这是最初的问题:
多行脚注后面的短段落脚注;如果脚注进入第二行,则防止脚注被分段
用户擦拭在 TeX 中给出了极好的解决方案这里。大卫·卡莱尔演示了如何在 LaTeX 中使用该答案这里。
但是,如果我在 LaTeX 序言中使用它,除了按预期排列脚注之外,它还会做出三处不必要的更改。
- 脚注文本现在与正文大小相同(而不是更小)。
- 脚注行距现在与正文相同(而不是单倍行距);也就是说,setspace 现在也会更改脚注行距。
- 无论文档指定了何种字体(通过 fontspec),正文和脚注块中的脚注数字的字体现在都是 Computer Modern。
用于说明其效果的 MWE 为:
\documentclass[12pt]{article}
\usepackage[onehalfspacing]{setspace}
\usepackage{fontspec}
\defaultfontfeatures{Mapping=tex-text}
\setromanfont[Mapping=tex-text,Numbers=OldStyle]{Arial}
\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:
\raggedbottom
\begin{document}
This is text in Arial to illustrate that the footnote number in the body text is in Computer Modern.\footnote{As it also is down here.} The footnotes do arrange themselves as intended.\footnote{In this way.} But the footnote text is both the same size as the body text and has the same spacing.\footnote{As you can see in this footnote, which is long enough to extend over two lines and illustrate the point. Neither of these effects are intended.}
\end{document}
这对我来说呈现为:
你能明白为什么这会产生这三种影响吗?以及如何消除这些影响(它们是非预期的和不想要的)?
答案1
\footnotesize
我在 的定义中添加了 的两个实例\printspecfootA
,添加了unicode-math
包并调用\setmathfont{Arial}
,因为脚注标记在数学模式中定义为\def\fnmark{$^{\the\fnotenum}$}
。
编辑以处理该setspace
问题,尽管它需要使用负片。我通过在进入组时\vspace
添加来实现这一点。但是,我还必须添加一个关联的负片来克服脚注行和实际脚注之间增加的垂直空间。我既不明白也不喜欢为什么要这样做。\singlespacing
\printspecfoot
\vspace
\documentclass[12pt]{article}
\usepackage[onehalfspacing]{setspace}
\usepackage{fontspec,unicode-math}
\defaultfontfeatures{Mapping=tex-text}
\setromanfont[Mapping=tex-text,Numbers=OldStyle]{Arial}
\setmathfont{Arial}
\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{\vspace{-12pt}\bgroup\singlespacing\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{\footnotesize\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 \footnotesize\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:
\raggedbottom
\begin{document}
This is text in Arial to illustrate that the footnote number in the body text is in Computer Modern.\footnote{As it also is down here.} The footnotes do arrange themselves as intended.\footnote{In this way.} But the footnote text is both the same size as the body text and has the same spacing.\footnote{As you can see in this footnote, which is long enough to extend over two lines and illustrate the point. Neither of these effects are intended.}
\end{document}