我正在排版一本包含未编号和编号章节的书。未编号章节是与内容无关的页面,而编号章节是实际的书本故事。
内容使用了enotez
,并且由于该书有超过 500 条尾注,我将 enotez 设置为按章节拆分并重置尾注计数器:
split=chapter,
reset=true,
当前状态
这是最小化的代码:
\documentclass[paper = 155mm:220mm]{scrbook}
\usepackage{blindtext}
\usepackage{libertine}
% important to see if solution will break my running head!
\usepackage[headsepline,autooneside=false]{scrlayer-scrpage}
\renewcommand*\chaptermark[1]{%
\markboth{\ifnumbered{chapter}{Chapter \chaptermarkformat}{#1}}{#1}%
}
% enotez part
\usepackage{enotez}
\setenotez{
list-heading = \addchap{#1}, % us this
list-name = {Supplemental material by chapter},
backref,
% totoc=chapter,
% counter-format=Roman,
split=chapter,
reset=true,
split-title={\chaptername\ <ref>: <title>}
}
\DeclareInstance{enotez-list}{chapter}{paragraph}{heading=\chapter{#1}}
\NewSplitTitleTag{title}{\nameref{ch:<split-level-id>}}
% something needs to be adjusted here, I guess
\usepackage{letltxmacro}
\LetLtxMacro\origchapter\chapter
\RenewDocumentCommand\chapter{som}{%
\IfBooleanTF{#1}
{% starred chapter, no label then
\origchapter*{#3}%
}
{% else add a label
\IfNoValueTF{#2}
{\origchapter{#3}}
{\origchapter[#2]{#3}}%
\expanded{\noexpand\label{ch:\arabic{chapter}}}%
}%
}
\usepackage{hyperref}
\begin{document}
\tableofcontents
\addchap{Prologue}
The first unnumberd chapter is the prologue.\endnote{That is the prologues’ endnote. An prologue is section at the very beginning of a book.}
\Blindtext[7]
\chapter{The First Day}
The first numbered chapter. This is something\endnote{That is the first day’s endnote. Something is a word.} you should consider.
\Blindtext[7]
\chapter{The Second Day}
The second numbered chapter. This is another\endnote{That is the second day’s endnote. Another is a word.} thing you should consider.
\Blindtext[7]
\chapter{The Third Day}
The third numbered chapter. I have no\endnote{That is the third day’s endnote. No means no yet.} idea what to talk about.
\Blindtext[7]
\addchap{Epilogue}
The last unnumberd chapter is the epilogue.\endnote{That is the epilogue’s endnote. An epilogue is section at the end of a book.}
\Blindtext[7]
\printendnotes
\Blindtext[7]
\addchap{References}
Another unnumberd chapter for references.
\addchap{Literature}
Another chapter.
\end{document}
我想要的是
左边是我从前面的代码中得到的结果。右边是我想要的。
这意味着我需要解决两个问题:
- 修复第 3 章和第 4 章错误的章节名称
- 删除未编号章节的“章节”
我将非常感谢您对这个问题的任何帮助,因为这可能涉及到一些 tex 编程,而我对此绝对是一个新手。