当 KOMA 脚本addchap
用于第一章和最后一章(即分别为简介和结论)时,前者在enotez
包的尾注中显示为第 0 章,而后者显示为上一章的重复。我该如何修复此问题?
最小示例:
\documentclass[oneside]{scrbook}
\usepackage[style=verbose-ibid,notetype=endonly,autocite=footnote,backend=biber]{biblatex}
\addbibresource[location=remote]{http://mirrors.ctan.org/macros/latex/contrib/biblatex/doc/examples/biblatex-examples.bib}
\usepackage{lipsum}
\usepackage{enotez}
\setenotez{
list-heading=\addchap{#1},
split=chapter,
reset=true,
}
\let\footnote=\endnote
\begin{document}
\frontmatter
\tableofcontents
\mainmatter
\addchap{Introduction}
\lipsum[1] \autocite{aksin}
\chapter{Foo}
\lipsum[1-3] \autocite{bertram}
\chapter{Bar}
\lipsum[1-3] \autocite{doody}
\addchap{Conclusion}
\lipsum[1] \autocite{kullback}
\backmatter
\printendnotes
\end{document}
答案1
以下是针对特定问题的可能解决方案(但对于更复杂的情况,这不是通用的解决方案……):
\documentclass[oneside]{scrbook}
\usepackage[style=verbose-ibid,notetype=endonly,autocite=footnote]{biblatex}
\addbibresource{biblatex-examples.bib}
\usepackage{lipsum}
\usepackage{enotez}
\setenotez{
list-heading=\addchap{#1},
split=chapter,
reset=true
}
\let\footnote=\endnote
\ExplSyntaxOn
\tl_new:N \l_enotez_last_splittitle_tl
\AtEveryListSplit{
\tl_if_blank:VTF \l__enotez_last_split_id_tl
{ \tl_set:Nn \EnotezCurrentSplitTitle {Notes~ from~ the~ Introduction} }
{
\tl_if_eq:NNT \l_enotez_last_splittitle_tl \EnotezCurrentSplitTitle
{ \tl_set:Nn \EnotezCurrentSplitTitle {Notes~ from~ the~ Conclusion} }
}
\tl_set_eq:NN \l_enotez_last_splittitle_tl \EnotezCurrentSplitTitle
}
\ExplSyntaxOff
\begin{document}
\frontmatter
\tableofcontents
\mainmatter
\addchap{Introduction}
\lipsum[1] \autocite{aksin}
\chapter{Foo}
\lipsum[1-3] \autocite{bertram}
\chapter{Bar}
\lipsum[1-3] \autocite{doody}
\addchap{Conclusion}
\lipsum[1] \autocite{kullback}
\backmatter
\printendnotes
\end{document}