如何在 egreg 宏中调整每章尾注之间的垂直间距

如何在 egreg 宏中调整每章尾注之间的垂直间距

以下代码已根据 egreg 在https://tex.stackexchange.com/questions/ask

\documentclass[12pt,openany]{book}

\usepackage{endnotes,chngcntr}
\counterwithin*{endnote}{chapter}  % Reset endnote numbering every new chapter


\let\latexchapter\chapter
\makeatletter
\renewcommand\enoteheading{%
  \setcounter{secnumdepth}{-2}
  \latexchapter*{\notesname\markboth{NOTES}{}}
  \mbox{}\par\vskip-\baselineskip
  \let\@afterindentfalse\@afterindenttrue
}
\makeatother

\usepackage{xparse}


\RenewDocumentCommand{\chapter}{som}{%
\IfBooleanTF{#1}
  {\latexchapter*{#3}%
   \setcounter{endnote}{0}%
   \addtoendnotes{%
     \noexpand\enotedivision{\noexpand\subsection}
       {\unexpanded{#3}}}%
  }
  {\IfNoValueTF{#2}
     {\latexchapter{#3}}
     {\latexchapter[#2]{#3}}%
   \addtoendnotes{%
     \noexpand\enotedivision{\noexpand\subsection}
       {\chaptername\ \thechapter. \unexpanded{#3}}}%
  }%
}
\makeatletter
\def\enotedivision#1#2{\@ifnextchar\enotedivision{}{#1{#2}}}
\makeatletter


\begin{document}
\chapter*{Chapter I}
This is Chapter I.\endnote{First endnote.} This is a sentence in Chapter I.\endnote{Second note.}

\chapter*{Chapter II}
In this Chapter II.\endnote{The only endnote in Chapter II.}

\chapter*{Chapter III}
This is Chapter III.\endnote{This is part of a long endnote. This is part of a long endnote. This is part of a long endnote. This is part of a long endnote. This is part of a long endnote. This is part of a long endnote.} This is a sentence in Chapter III.\endnote{This is part of another long endnote. This is part of another long endnote. This is part of another long endnote. This is part of another long endnote. This is part of another long endnote.}

%\cleardoublepage
\theendnotes
\end{document}

并给出尾注列表:

在此处输入图片描述

如果我想调整每个章节中实际尾注之间的间距(在这种情况下似乎没有),我该如何指定这样的垂直间距?

另外,顺便说一句,该命令\cleardoublepage在代码中被注释掉了。如果我添加它,出于某种奇怪的原因,我在尾注列表之前插入了一个额外的页面。这可能是为什么?

答案1

设置 \setlength{\skipnote}{<length>}为在音符之间添加更多空间。

A

\documentclass[12pt,openany]{book}

\usepackage{endnotes,chngcntr}
\counterwithin*{endnote}{chapter}  % Reset endnote numbering every new chapter


\newlength{\skipnote}
\setlength{\skipnote}{2ex} % set inter notes vertical space <<<<<<<<<<<

\let\latexchapter\chapter
\makeatletter
\renewcommand\enoteheading{%
    \setcounter{secnumdepth}{-2}
    \latexchapter*{\notesname\markboth{NOTES}{}}
    \mbox{}\par\vskip-\baselineskip
    \let\@afterindentfalse\@afterindenttrue
}
% **************** added <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<,
\def\@endanenote{\par\vskip\skipnote\endgroup}%
% ****************  

\makeatother

\usepackage{xparse}

\RenewDocumentCommand{\chapter}{som}{%
    \IfBooleanTF{#1}
    {\latexchapter*{#3}%
        \setcounter{endnote}{0}%
        \addtoendnotes{%
            \noexpand\enotedivision{\noexpand\subsection}
            {\unexpanded{#3}}}%
    }
    {\IfNoValueTF{#2}
        {\latexchapter{#3}}
        {\latexchapter[#2]{#3}}%
        \addtoendnotes{%
            \noexpand\enotedivision{\noexpand\subsection}
            {\chaptername\ \thechapter. \unexpanded{#3}}}%
    }%
}
\makeatletter
\def\enotedivision#1#2{\@ifnextchar\enotedivision{}{#1{#2}\vskip0pt}}
\makeatletter


\begin{document}
    \chapter*{Chapter I}
    This is Chapter I.\endnote{First endnote.} This is a sentence in Chapter I.\endnote{Second note.}
    
    \chapter*{Chapter II}
    In this Chapter II.\endnote{The only endnote in Chapter II.}
    
    \chapter*{Chapter III}
    This is Chapter III.\endnote{This is part of a long endnote. This is part of a long endnote. This is part of a long endnote. This is part of a long endnote. This is part of a long endnote. This is part of a long endnote.} This is a sentence in Chapter III.\endnote{This is part of another long endnote. This is part of another long endnote. This is part of another long endnote. This is part of another long endnote. This is part of another long endnote.}
    
    %\cleardoublepage
    \theendnotes
\end{document}

\cleardoublepage或者\clearpage是不必要的。

\theendnote就像一个章节一样,从而开始新的一页。

相关内容