带有分段的无缝索引?

带有分段的无缝索引?

我正在设计一本圣经,它使用索引来识别章节在参考圣经的文本中的位置,但我已将其删除。

我正在寻找一种方法来制作一个索引,其中包含索引章节页面列表,但由每本书分开。所以它看起来像这样:

创世纪

第 1 章...1

第 2 章...4

第 3 章... 8

出埃及记

第 1 章...59

第 2 章...67

等等等等

但我希望它们在一个索引中无缝流动,而不像现在这样为每个书籍部分设置分页符。是否可以通过某种索引“部分”或“项目标题”来实现这一点,或者我可以使用某种东西将索引项目分类为“书名”?

这是我的主要代码:

% UNIVERSAL SETTINGS
\documentclass[statementpaper,10pt,twoside,onecolumn,openright,extrafontsizes]{memoir} % set page properties
\usepackage[utf8x]{inputenc} % set displayable characters
\usepackage[T1]{fontenc}
\usepackage[osf]{Alegreya,AlegreyaSans} % set font face

\usepackage{canoniclayout} % canonical margins, breaks page number?
\usepackage{subfiles} % to pull chapter files in from other sub files
\usepackage{lipsum}
\usepackage{hyperref}      % provides \phantomsection

% INDEX SETTINGS
% run "makeindex index_name.idx -s style.ist" in terminal to generate each correct index files before typesetting
\makeindex[genesis]
\makeindex[exodus]
\makeindex[leviticus]

% TABLE OF CONTENTS SETTINGS
\renewcommand{\cftchapterdotsep}{\cftdotsep}% Chapters should use dots in TOC

% CHAPTER SETTINGS
\renewcommand*{\printchaptername}{\centering}
\renewcommand*{\printchapternonum}{\centering}

% PAGE HEADER SETTINGS
\nouppercaseheads % prevent all uppercase header titles
\makeatletter % put chapter title on both pages
\createmark{chapter}{both}{shownumber}{\@chapapp\ }{. \ } % put chapter title on both pages
\makeatother % put chapter title on both pages

% PARAPGRAPH SETTINGS
\usepackage{ragged2e} % indent paragraphs using ragged right
\setlength{\RaggedRightParindent}{\parindent} % indent paragraphs with ragged right
\raggedbottom % avoid paragraph spacing issues but allow bottom ragged lines
\usepackage{lettrine} % for drop caps and awesome chapter beginnings
\linespread{1.2} % line-height

\renewcommand{\chapternumberline}[1]{}% Gobble chapter number in ToC
\renewcommand{\cftchapterdotsep}{\cftdotsep}% Chapter dots in ToC

% TITLE PAGE FORMATTING
% creates the title page and printed title text
\newlength\drop
\newcommand*{\titleMain}{%
\thispagestyle{empty}
\begingroup% Gentle Madness
\drop = 0.1\textheight
\vspace*{\baselineskip}
\vfill
\hbox{%
\parbox[b]{1.0\textwidth}{
\vbox{%
\vspace{\drop}
\centering{\noindent\HUGE\bfseries Holy Bible}\\[2\baselineskip]
{\Large King James Version}\\[.37\baselineskip]
{\Large\itshape Authorized Edition}
\vspace{0.5\textheight}
}% end of vbox
}% end of parbox
}% end of hbox
\vfill
\null
\endgroup}

% Macro to typeset the sequence "[empty page] --> title page --> empty page --> chapter"
% #1: Pre title    #2: Main title (== chapter name)    #3 Sub title    #4 Label
\newcommand{\tpchapter}[4]{%
    \cleardoublepage%

    \thispagestyle{empty}%
    \vspace*{\fill}%
    \phantomsection%
    \addcontentsline{toc}{chapter}{#2}%
    \label{#4}

    % Adjust the format of the chapter titlepage in this block
    \begin{center}
    {\LARGE\textbf{#1}}\\[\baselineskip]
    {\Huge\textbf{#2}}\\[\baselineskip]
    {\LARGE\textbf{#3}}%
    \end{center}
    \vfill

    \cleardoublepage
    \chapter*{#2}%
    \thispagestyle{plain}%
    \markboth{#2}{#2}%
 }

% BEGIN THE DOCUMENT
\begin{document}
\titleMain % print title page created in preamble
\cleardoublepage % blank page after title and TOC page

% TABLE OF CONTENTS
\tableofcontents* % print table of contents page
\thispagestyle{empty} % hide page number header on TOC page

% BEGIN MAIN CONTENT MATTER
\cleardoublepage % restart page numbers

\RaggedRight % apply ragged right paragraph format
\pagenumbering{arabic} % change page numbering to numbers

\tpchapter{The First Book of Moses, called}{Genesis}{}{cha:genesis}
\subfile{tex/genesis} % print text from chapter files
\cleardoublepage

\tpchapter{The Second Book of Moses, called}{Exodus}{}{cha:exodus}
\subfile{tex/exodus}
\cleardoublepage

\tpchapter{The Third Book of Moses, called}{Leviticus}{}{cha:leviticus}
\subfile{tex/leviticus}

% BEGING BACK CONTENT MATTER
\backmatter

\addcontentsline{toc}{chapter}{\textit {Index of Chapters}} % for consolidating index in TOC
{\def\addcontentsline#1#2#3{} % for consolidating index in TOC

 % INDEX
\tpchapter{Index of Chapters}{}{Their locations having been removed}{cha:index}
\renewcommand{\indexname}{Genesis}
\printindex[genesis]
\renewcommand{\indexname}{Exodus}
\printindex[exodus]
\renewcommand{\indexname}{Leviticus}
\printindex[leviticus]

\end{document}
% END OF DOCUMENT

每个子文件如下所示:

\begin{document}

\index[genesis]{Chapter 1}
\lettrine[lines=3]{I}{}n the beginning God created the heaven and the earth.
And the earth was without form, and void; and darkness was upon the face of the deep. And the Spirit of God moved upon the face of the waters.
And God said, Let there be light: and there was light.
And God saw the light, that it was good: and God divided the light from the darkness.
And God called the light Day, and the darkness he called Night. And the evening and the morning were the first day. \par
\index[genesis]{Chapter 2} \lipsum
\index[genesis]{Chapter 3} \lipsum
\index[genesis]{Chapter 4} \lipsum
\index[genesis]{Chapter 5} \lipsum
\index[genesis]{Chapter 6} \lipsum
\index[genesis]{Chapter 7} \lipsum
\index[genesis]{Chapter 8} \lipsum
\index[genesis]{Chapter 9} \lipsum

\end{document}

答案1

我发现在章节文件中使用类似这样的内容可以达到我想要的效果:

\index[ioc]{01@Genesis!001@Chapter 1} \lipsum[1-2]
\index[ioc]{01@Genesis!002@Chapter 2} \lipsum[1-2]
\index[ioc]{02@Exodus!001@Chapter 1} \lipsum[1-2]
\index[ioc]{02@Exodus!002@Chapter 2} \lipsum[1-2]

然后在主 tex 文件中打印索引:

\printindex[ioc]

相关内容