![如何调整边注脚注的垂直位置?](https://linux22.com/image/306477/%E5%A6%82%E4%BD%95%E8%B0%83%E6%95%B4%E8%BE%B9%E6%B3%A8%E8%84%9A%E6%B3%A8%E7%9A%84%E5%9E%82%E7%9B%B4%E4%BD%8D%E7%BD%AE%EF%BC%9F.png)
我正在重新定义\footnote
将它们放在页边距中\marginpar
。有时,当注释出现在页面末尾附近时,段落会延伸到文本块底部以下。我假设我可以使用将\vspace
其向上移动,但由于某种原因,这会使注释的第一行保持不变并拉出其余行。这似乎与使用插入脚注计数器的值有关\the
;如果我省略,\themynote
则按\vspace
预期工作。
更具体地说,在下面的例子中,有四个脚注。在第一段中,两个脚注浮动以避免相互冲突。第三个脚注从第二段的第一行开始;\vspace{-\baselineskip}
按预期将整个段落向上移动。第四个脚注与第三个脚注相同,只是宏包括\themynote
打印脚注计数器的值。在这种情况下,脚注的第一行不会移动。
- 为什么会发生这种情况?
- 在这种情况下,调整音符的垂直位置的更好方法是什么?
其他可能的修复方法:
- 我知道 marginfix 包,但这似乎弄乱了脚注的基线(脚注将从正文基线略上方开始,而它们通常恰好从正文基线上开始)。我试图在页面布局中保持垂直网格,所以这是不可取的。
- marginnote 包没有浮动注释,因此下面第一段中的两个注释会发生冲突。
平均能量损失
\documentclass{article}
\newcounter{mynote}
\renewcommand{\footnote}[1]{%
\marginpar{\footnotesize #1}%
}
\newcommand{\footnoteB}[1]{%
\marginpar{\footnotesize\themynote #1}%
}
\begin{document}
Lorem ipsum dolor sit amet, consectetur\footnote{Lorem ipsum dolor sit amet,
consectetur adipisicing elit.} adipisicing elit, sed do eiusmod tempor
incididunt ut labore et dolore magna aliqua. Ut \footnote{Lorem ipsum dolor
sit amet, consectetur adipisicing elit.}enim ad minim veniam, quis nostrud
exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis
aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu
fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in
culpa qui officia deserunt mollit anim id est laborum. Lorem ipsum dolor sit
amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore
et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation
ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor
in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla
pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui
officia deserunt mollit anim id est laborum.
Lorem ipsum dolor sit amet, consectetur\footnote{\vspace{-\baselineskip}Lorem
ipsum dolor sit amet, consectetur adipisicing elit.} adipisicing elit, sed do
eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim
veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea
commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit
esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat
non proident, sunt in culpa qui officia deserunt mollit anim id est
laborum.\footnoteB{\vspace{-\baselineskip}Lorem ipsum dolor sit amet,
consectetur adipisicing eli.}
\end{document}
答案1
使用\marginnote
而不是\marginpar
。\marginnote
接受垂直偏移量作为可选参数,因此您可以将脚注的定义重写为
\renewcommand{\footnote}[2][0pt]{%
\refstepcounter{mynote}%
\mbox{\textsuperscript{\tiny\sffamily\themynote}}%
\marginnote{\sffamily\makebox[0pt][r]{\tiny\textsuperscript{\themynote}}\footnotesize #2}[#1]%
}
并像使用它一样
\footnote[-\baselineskip]{...}
梅威瑟:
\documentclass{article}
\usepackage{mathpazo}
\usepackage{marginnote}
\newcounter{mynote}
\renewcommand{\footnote}[2][0pt]{%
\refstepcounter{mynote}%
\mbox{\textsuperscript{\tiny\sffamily\themynote}}%
\marginnote{\sffamily\makebox[0pt][r]{\tiny\textsuperscript{\themynote}}\footnotesize #2}[#1]%
}
\begin{document}
Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod
tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam,
quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo
consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse
cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non
proident, sunt in culpa qui officia deserunt mollit anim id est
laborum.\footnote{Lorem ipsum dolor sit amet, consectetur adipisicing elit.}
Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod
tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam,
quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo
consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse
cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non
proident, sunt in culpa qui officia deserunt mollit anim id est
laborum.\footnote[-\baselineskip]{Lorem ipsum dolor sit amet,
consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et
dolore magna aliqua.}
\end{document}
如果您希望继续使用,\marginpar
这里有一个可以重现上述内容的解决方案:
\renewcommand{\footnote}[2][]{%
\refstepcounter{mynote}%
\ifx\relax#1\else{\setlength{\baselineskip}{12pt}\vspace*{#1}}\fi%
\mbox{\textsuperscript{\tiny\sffamily\themynote}}%
\marginpar{\sffamily\makebox[0pt][r]{\tiny\textsuperscript{\themynote}}\footnotesize #2}%
}
平均能量损失
\documentclass{article}
\usepackage{mathpazo}
\newcounter{mynote}
\renewcommand{\footnote}[2][]{%
\refstepcounter{mynote}%
\ifx\relax#1\else{\setlength{\baselineskip}{12pt}\vspace*{#1}}\fi%
\mbox{\textsuperscript{\tiny\sffamily\themynote}}%
\marginpar{\sffamily\makebox[0pt][r]{\tiny\textsuperscript{\themynote}}\footnotesize #2}%
}
\begin{document}
Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod
tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam,
quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo
consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse
cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non
proident, sunt in culpa qui officia deserunt mollit anim id est
laborum.\footnote{Lorem ipsum dolor sit amet, consectetur adipisicing elit.}
Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod
tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam,
quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo
consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse
cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non
proident, sunt in culpa qui officia deserunt mollit anim id est
laborum.\footnote[-\baselineskip]{Lorem ipsum dolor sit amet,
consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et
dolore magna aliqua.}
\end{document}
输出: