使用 bibleref 仅将圣经参考添加到索引中,而不添加到文本中

使用 bibleref 仅将圣经参考添加到索引中,而不添加到文本中

我使用bibleref来引用和索引圣经经文。我想将圣经经文添加到索引中,而不在实际文本中输出任何内容。阅读手册后bibleref,似乎bibleref没有此功能。虽然我可以使用 将圣经引用添加到文本中,但不能添加到索引中,但\bibleverse没有命令可以将引用添加到索引中而不将其添加到文本中。\ibibleverse总是同时执行两者。

如何添加一个命令来添加对索引的引用,但不添加对文本的引用?

答案1

首先,抱歉来晚了。10 月份我很忙,之后就忘了看你的问题了(我觉得 framagit 的问题会更好)。

DR Driver 解释了三个已经存在的宏

  1. \ibibleverse(添加到索引,打印完整参考)
  2. \ibiblechvs(添加到索引,仅打印章节和诗句)
  3. \ibiblevs(添加到索引,仅打印诗句)

他或她提供了一个\ibiblex仅索引的新宏。我已经测试了这个宏,并将其添加到官方的 bibleref (v. 1.25) 中,今天在 CTAN 上发送。

与 DR 驱动程序代码的唯一区别如下:

  • 由于我不是 bibleref-parse 的维护者,所以我没有提供任何宏\pibiblex
  • 的官方宏bibleref\ibible,而不是ibiblex已经i代表的indexing

谢谢 DR 司机

答案2

我最近遇到了同样的问题,只是我想用 解析引用bibleref-parse。我也有一个解决方案可以做到这一点。

\pibiblex基本上,我在 之上创建了命令bibleref-parse,而该命令又需要\ibiblex在父 pkg 之上创建一个等效命令bibleref

首先,我们需要底层\ibiblex命令。该bibleref软件包提供了三个用于索引圣经参考的命令:

  1. \ibibleverse(添加到索引,打印完整参考)
  2. \ibiblechvs(添加到索引,仅打印章节和诗句)
  3. \ibiblevs(添加到索引,仅打印诗句)

宏变得越来越长。我修改了\ibiblevs

\newcommand*{\ibiblex}[1][\bvidxpgformat]{%
  \let\@bv@current@titlestyle\BRbooktitlestyle
  \let\@bv@current@chapterstyle\BRchapterstyle
  \let\@bv@current@versestyle\BRversestyle% added on analogy with previous line
  \let\@bv@current@bkchsep\BRbkchsep
  \let\@bv@current@chvsep\BRchvsep
  \let\@bv@current@vrsep\BRvrsep% add me, too!
  \def\@bv@restore{%
    \let\BRbooktitlestyle\@bv@current@titlestyle
    \let\BRchapterstyle\@bv@current@chapterstyle
    \let\BRversestyle\@bv@current@versestyle% added on analogy with previous line
    \let\BRbkchsep\@bv@current@bkchsep
    \let\BRchvsep\@bv@current@chvsep
    \let\BRvrsep\@bv@current@vrsep% add me, too!
  }%
  \def\BRbooktitlestyle##1{}%
  \def\BRchapterstyle##1{}%
  \def\BRversestyle##1{}% added on analogy with previous line
  \def\BRbkchsep{}%
  \def\BRchvsep{}%
  \def\BRvrsep{}% add me, too!
  \def\@bv@idxpgformat{#1}%
  \@bv@idxtrue\def\@bv@idxentry{}\@bible@verse
}

所有三个索引引用选项均镜像\pibiblex如下:

  1. \pibibleverse(解析输入,添加到索引,打印完整参考)
  2. \pibiblechvs(解析输入,添加到索引,仅打印章节和诗句)
  3. \pibiblevs(解析输入,添加到索引,仅打印诗句)

我想要第四个。与我上面的选择相呼应,这个是基于命令的\pibiblevs

\newcommand{\pibiblex}[2][]{%
  \brp@parse[#1]{#2}%
  \brp@convert%
  \let\brp@do\ibiblex% sends the parsed verse ref to the new cmd above
  \brp@brlist
}

这是一个相对简单的 MWE,它添加了一些从biblatex-sblpkg 派生的必要索引内容。此外参见此帖

% !TEX encoding = UTF-8 Unicode
% !TEX TS-program = XeLaTeX

\documentclass{memoir}

% Set up the indexes
% The scripture index is derived from https://tex.stackexchange.com/a/337269
% which also lives in the `biblatex-sbl' pkg (see `sbl-paper-bibleref.ist' and `sbl-paper.tex')

\usepackage{indextools}% old fork of imakeidx, which supposedly conflicts with bidi (which I need)
\usepackage{bibleref-parse}

% customize the index display
% \usepackage{filecontents} % not required since Fall 2019 TeX release
\begin{filecontents}{\jobname.ist}
preamble
"\\begin{theindex}
\\renewcommand\\item{\\bigskip\\par\\normalfont\\scshape}
\\renewcommand\\subitem{\\medskip\\par\\normalfont\\itshape}
\\newcommand\\firstsubitem{\\medskip\\par\\nobreak\\hangindent 1in\\normalfont\\itshape}
\\renewcommand\\subsubitem{\\par\\hangindent 1in\\normalfont\\hspace*{0.25in}}
\\newcommand\\firstsubsubitem{\\par\\nobreak\\hangindent 1in\\normalfont\\hspace*{0.25in}}\n"

item_01
"\n    \\firstsubitem"

item_x1
"\n    \\firstsubitem"

item_2
"\n      \\subsubitem\\raggedright\\strut\\rlap{"

item_12
"\n      \\firstsubsubitem\\raggedright\\strut\\rlap{"

item_x2
"\n      \\firstsubsubitem\\raggedright\\strut\\rlap{"

delim_0 "\\normalfont , "
delim_1 "\\normalfont , "
delim_2 "}\\normalfont\\hspace*{0.75in}%"
\end{filecontents}

% align references with SBL2 spec - also in the `biblatex-sbl' pkg (in `sbl-paper.sty') but simplified here for MWE
\makeatletter
\braltabbrvname
\renewcommand*{\BRperiod}{}
\renewcommand*{\BRchsep}{;\space}
\renewcommand*{\BRvsep}{,\space}

% amend abbreviated book names (OT, Apocrypha, NT) - selections from bibleref.dtx
\def\br@Ecclesiastes{Eccl\BRperiod}
\def\br@SongofSongs{Song\BRperiod}
% FYI, I think these are all the deuterocanonical books in the `bibleref` pkg that aren't stylized in `biblatex-sbl'
\def\br@Tobit{Tob\BRperiod}
\def\br@Judith{Jdt\BRperiod}
\def\br@Wisdom{Wis\BRperiod}
\def\br@Ecclesiasticus{Sir\BRperiod}
\def\br@Baruch{Bar\BRperiod}
\def\br@IMaccabees{\BRbooknumberstyle{1}Macc\BRperiod}
\def\br@IIMaccabees{\BRbooknumberstyle{2}Macc\BRperiod}
% and some NT books that need updated short refs
\def\br@Titus{Titus\BRperiod}
\def\br@Philemon{Phlm\BRperiod}

% amend abbreviated book names (OT, Apocrypha, NT) - from bibleref.dtx (but why are we using \csdef?)
\csdef{bri@Gen}{\BRbookof Genesis}
\csdef{bri@Exod}{\BRbookof Exodus}
\csdef{bri@Lev}{\BRbookof Levitcus}
\csdef{bri@Num}{\BRbookof Numbers}
\csdef{bri@Deut}{\BRbookof Deuteronomy}
% etc
\csdef{bri@Eccl}{\BRbookof Ecclesiastes}
\csdef{bri@Song}{\BRbookof Song of Songs}
\csdef{bri@Ps}{\BRbookof Psalms}
\csdef{bri@Obad}{\BRbookof Obadiah}
% etc
% fill out that Apocrypha, as above (though this is by no means all of it)
\csdef{bri@Tob}{\BRbookof Tobit}
\csdef{bri@Jdt}{\BRbookof Judith}
\csdef{bri@Wis}{\BRbookof Wisdom of Solomon}
\csdef{bri@Sir}{\BRbookof Sirach}
\csdef{bri@Bar}{\BRbookof Baruch}
\csdef{bri@1Macc}{\BRbooknumberstyle{1}\BRbookof Maccabees}
\csdef{bri@2Macc}{\BRbooknumberstyle{2}\BRbookof Maccabees}
% and part of the NT
\csdef{bri@Matt}{\BRbookof Matthew}
\csdef{bri@Mark}{\BRbookof Mark}
\csdef{bri@Luke}{\BRbookof Luke}
\csdef{bri@John}{\BRbookof John}
% etc
\csdef{bri@Titus}{\BRbookof Titus}
\csdef{bri@Phlm}{\BRbookof Philemon}
\csdef{bri@Jude}{\BRbookof Jude}

% sort that scripture index by category (cut to make the MWE a bit more M)
\biblerefmap{Gen}{1@Old Testament!01}
\biblerefmap{Exod}{1@Old Testament!02}
\biblerefmap{Lev}{1@Old Testament!03}
\biblerefmap{Num}{1@Old Testament!04}
\biblerefmap{Deut}{1@Old Testament!05}
% etc
\biblerefmap{Eccl}{1@Old Testament!21}
\biblerefmap{Song}{1@Old Testament!22}
\biblerefmap{Ps}{1@Old Testament!19}
\biblerefmap{Psalm}{1@Old Testament!19}
\biblerefmap{Obad}{1@Old Testament!31}
% etc
\biblerefmap{Tob}{2@Deuterocanonical Works!01}
\biblerefmap{Jdt}{2@Deuterocanonical Works!02}
\biblerefmap{Wis}{2@Deuterocanonical Works!03}
\biblerefmap{Sir}{2@Deuterocanonical Works!04}
\biblerefmap{Bar}{2@Deuterocanonical Works!05}
\biblerefmap{Macc1}{2@Deuterocanonical Works!06}
\biblerefmap{Macc2}{2@Deuterocanonical Works!07}
% etc
\biblerefmap{Matt}{3@New Testament!01}
\biblerefmap{Mark}{3@New Testament!02}
\biblerefmap{Luke}{3@New Testament!03}
\biblerefmap{John}{3@New Testament!04}
% etc
\biblerefmap{Titus}{3@New Testament!17}
\biblerefmap{Phlm}{3@New Testament!18}
\biblerefmap{Jude}{3@New Testament!26}
\makeatother

% Now, here's the trick: make a \pibiblex{} cmd that parses with
% the `bibleref-parse` package, which relies on the `bibleref` package,
% neither of which provides for an index ref that does not print in the main text
%
\makeatletter
% Here's a modified version of the \ibiblevs cmd from `bibleref`. It is one of the
% three indexing ref options provided there. All of them are:
%   1. \ibibleverse (adds to index, prints full reference)
%   2. \ibiblechvs (adds to index, prints chapter and verse only)
%   3. \ibiblevs (adds to index, prints verse only)
\newcommand*{\ibiblex}[1][\bvidxpgformat]{%
  \let\@bv@current@titlestyle\BRbooktitlestyle
  \let\@bv@current@chapterstyle\BRchapterstyle
  \let\@bv@current@versestyle\BRversestyle% added on analogy with previous line
  \let\@bv@current@bkchsep\BRbkchsep
  \let\@bv@current@chvsep\BRchvsep
  \let\@bv@current@vrsep\BRvrsep% add me, too!
  \def\@bv@restore{%
    \let\BRbooktitlestyle\@bv@current@titlestyle
    \let\BRchapterstyle\@bv@current@chapterstyle
    \let\BRversestyle\@bv@current@versestyle% added on analogy with previous line
    \let\BRbkchsep\@bv@current@bkchsep
    \let\BRchvsep\@bv@current@chvsep
    \let\BRvrsep\@bv@current@vrsep% add me, too!
  }%
  \def\BRbooktitlestyle##1{}%
  \def\BRchapterstyle##1{}%
  \def\BRversestyle##1{}% added on analogy with previous line
  \def\BRbkchsep{}%
  \def\BRchvsep{}%
  \def\BRvrsep{}% add me, too!
  \def\@bv@idxpgformat{#1}%
  \@bv@idxtrue\def\@bv@idxentry{}\@bible@verse
}
% All three indexing ref options are mirrored in
%   1. \pibibleverse (adds to index, prints full reference)
%   2. \pibiblechvs (adds to index, prints chapter and verse only)
%   3. \pibiblevs (adds to index, prints verse only)
% I want a fourth one. Echoing my choice above, this one is based on `pibiblevs`
\newcommand{\pibiblex}[2][]{%
  \brp@parse[#1]{#2}%
  \brp@convert%
  \let\brp@do\ibiblex%
  \brp@brlist
}
% and we're done
\makeatother

\makeindex[name=scr,title=Scripture Index,options=-s \jobname.ist] % The scripture index
\renewcommand{\biblerefindex}{\index[scr]}
\makeindex[name=persons,title=Author Index,columns=3] % An index for author names
\makeindex[title=Subject Index] % The default index

%\title{}
%\author{}
%\date{}

\begin{document}

\mainmatter

\chapter{Quoting the Bible}

Biblical scholars are hardly the only people who read the Bible, but
those who make it past \pibibleverse{Gen 3} don't always make it to
\pibibleverse{Lev 10}. Some Protestants actively avoid Deuterocanonical
works, though Catholic and Eastern Orthodox Bibles\pibiblex{Dt 34:10} % first invisible ref, added at whim
 include books like \pibibleverse{Jdt} or \pibibleverse{Tob}.

The Bible may seem very long, but the books that make up that library
vary in the demands they put on readers. Some books (\pibibleverse{Obad;
Phlm; Jude}) are only a single chapter long (which is probably a tricky
detail to manage if you're writing a \LaTeX\ package to handle scripture
references). The Psalter has 150 chapters, 73 of which are ascribed to
David (in Hebrew; he gets 14 more in the LXX). Only one of them is ever
ascribed to Moses, however. See \pibiblechvs{Psalm 90:0}.

There's even a book that opens with a lover who says, ``Let him kiss me
with the kisses of his mouth!'' \pibiblex{Song 1:1} % second invisible ref

\backmatter

\printindex[scr] % Output the index of sources
\printindex[persons] % Output the index of author names
%\printindex % Output the default subject index

\end{document}

这是我的第一篇帖子(长期听众,第一次来电)。我当然欢迎任何关于如何改进上述实施的建议。

答案3

我添加了一个新命令\indexonlyverse,以书名、章节、开始诗句和结束诗句作为参数。参考资料已添加到索引中,但未添加到文本中。

该方法有以下缺点:

  • 它只能用于诗句范围,不能用于引用个别诗句
  • 诗句范围必须介于一章之间
  • bibref总而言之,如果使用语法来引用章节/诗句而不是使用花括号中的参数来引用会更好。
  • 我的特定实现是针对以下用例构建的:提供书籍的映射,如果没有映射则需要进行调整。

这是我的 MWE:

\documentclass[a4paper,10pt]{scrbook}
\usepackage{bibleref}
\biblerefmap{Gen}{01}
\biblerefmap{Ex}{02} 
\biblerefmap{Lev}{03} 
\biblerefmap{Num}{04} 
\biblerefmap{Dtn}{05}%dt 
\biblerefmap{Jos}{06} 
\biblerefmap{Ri}{07} 
\biblerefmap{Ru}{08} 
\biblerefmap{Ruth}{08} 
\biblerefmap{Sam1}{09} 
\biblerefmap{ISam}{09} 
\biblerefmap{Sam2}{10} 
\biblerefmap{IISam}{10} 
\biblerefmap{Kön1}{11} 
\biblerefmap{IKoen}{11} 
\biblerefmap{Kön2}{12} 
\biblerefmap{IIKoen}{12} 
\biblerefmap{Chr1}{13} 
\biblerefmap{IChr}{13} 
\biblerefmap{Chr2}{14} 
\biblerefmap{IIChr}{14} 
\biblerefmap{Esr}{15} 
\biblerefmap{Neh}{16} 
\biblerefmap{Tob}{17} 
\biblerefmap{Jdt}{18} 
\biblerefmap{Est}{19} 
\biblerefmap{Makk1}{20} 
\biblerefmap{IMakk}{20} 
\biblerefmap{Makk2}{21} 
\biblerefmap{IIMakk}{21} 
\biblerefmap{Hi}{22} 
\biblerefmap{Ps}{23} 
\biblerefmap{Pss}{23} 
\biblerefmap{Spr}{24} 
\biblerefmap{Koh}{25} 
\biblerefmap{Pred}{25} 
\biblerefmap{Hld}{26} 
\biblerefmap{Weish}{27} 
\biblerefmap{Sir}{28} 
\biblerefmap{Jes}{29} 
\biblerefmap{Jer}{30} 
\biblerefmap{Klgl}{31} 
\biblerefmap{Bar}{32} 
\biblerefmap{Ez}{33} 
\biblerefmap{Dan}{34} 
\biblerefmap{Hos}{35} 
\biblerefmap{Joel}{36} 
\biblerefmap{Am}{37} 
\biblerefmap{Obd}{38} 
\biblerefmap{Ob}{38} 
\biblerefmap{Jon}{39} 
\biblerefmap{Mi}{40} 
\biblerefmap{Nah}{41} 
\biblerefmap{Hab}{42} 
\biblerefmap{Zeph}{43} 
\biblerefmap{Hag}{44} 
\biblerefmap{Sach}{45} 
\biblerefmap{Mal}{46} 
\biblerefmap{Mt}{47} 
\biblerefmap{Mk}{48} 
\biblerefmap{Lk}{49} 
\biblerefmap{Joh}{50} 
\biblerefmap{Apg}{51} 
\biblerefmap{Röm}{52}
\biblerefmap{Kor1}{53} 
\biblerefmap{IKor}{53} 
\biblerefmap{Kor2}{54} 
\biblerefmap{IIKor}{54} 
\biblerefmap{Gal}{55} 
\biblerefmap{Eph}{56} 
\biblerefmap{Phil}{57} 
\biblerefmap{Kol}{58} 
\biblerefmap{Thess1}{59} 
\biblerefmap{IThess}{59} 
\biblerefmap{Thess2}{60} 
\biblerefmap{IIThess}{60} 
\biblerefmap{Tim1}{61} 
\biblerefmap{ITim}{61} 
\biblerefmap{Tim2}{62} 
\biblerefmap{IITim}{62} 
\biblerefmap{Tit}{63} 
\biblerefmap{Phlm}{64} 
\biblerefmap{Hebr}{65} 
\biblerefmap{Jak}{66} 
\biblerefmap{Petr1}{67} 
\biblerefmap{IPetr}{67} 
\biblerefmap{Petr2}{68} 
\biblerefmap{IIPetr}{68} 
\biblerefmap{Joh1}{69} 
\biblerefmap{IJoh}{69} 
\biblerefmap{Joh2}{70} 
\biblerefmap{IIJoh}{70} 
\biblerefmap{Joh3}{71} 
\biblerefmap{IIIJoh}{71} 
\biblerefmap{Jud}{72} 
\biblerefmap{Apk}{73} 
% \indexonlyverse{book name}{chapter}{beginning verse}{last verse}
\makeatletter
\newcommand*{\indexonlyverse}[4]{%
    \def\@bv@idxpgformat{\bvidxpgformat}%
    \@bv@idxtrue%
    \let\@bv@org@bookof\BRbookof%
    \let\@bv@org@booknumberstyle\BRbooknumberstyle%
    \let\@bv@org@epistletothe\BRepistletothe%
    \let\@bv@org@epistlenumberstyle\BRepistlenumberstyle%
    \def\BRbookof{\string\BRbookof\space}%
    \def\BRbooknumberstyle{\string\BRbooknumberstyle\space}%
    \def\BRepistletothe{\string\BRepistletothe\space}%
    \def\BRepistlenumberstyle{\string\BRepistlenumberstyle\space}%    
    \@ifundefined{bri@#1}%
    {%
    \protected@edef\@bv@mainidxentry{%
        \protect\BRbooktitlestyle{\csname br@#1\endcsname}}%
    }%
    {%
    \protected@edef\@bv@mainidxentry{%
        \protect\BRbooktitlestyle{\csname bri@#1\endcsname}}%
    }%
    \let\BRbookof\@bv@org@bookof%
    \let\BRbooknumberstyle\@bv@org@booknumberstyle%
    \let\BRepistletothe\@bv@org@epistletothe%
    \let\BRepistlenumberstyle\@bv@org@epistlenumberstyle%
    \@ifundefined{@bibleref@map@#1}{}{%
        \expandafter\let\expandafter\@@bv@tmpidxsort%
        \csname @bibleref@map@#1\endcsname%
    }%
    \expandafter\@do@bibleref@map\@@bv@tmpidxsort\relax%
    \def\@bv@tmpidxsort{\csname br@#1\endcsname}%
    \def\@bv@chidxsort{}%
    % Chapter
    \ifnum#2<10\relax%
        \@bv@addtochidxsort{00#2:}%
    \else%
        \ifnum#2<100\relax%
        \@bv@addtochidxsort{0#2:}%
        \else%
        \@bv@addtochidxsort{#2:}%
        \fi%
    \fi%
    % Beginning verse
    \ifnum#3<10\relax%
        \@bv@addtochidxsort{00#3-}%
    \else%
        \ifnum#3<100\relax%
        \@bv@addtochidxsort{0#3-}%
        \else%
        \@bv@addtochidxsort{#3-}%
        \fi%
    \fi%
    % Last verse
    \ifnum#4<10\relax%
        \@bv@addtochidxsort{00#4}%
    \else%
        \ifnum#4<100\relax%
        \@bv@addtochidxsort{0#4}%
        \else%
        \@bv@addtochidxsort{#4}%
        \fi%
    \fi%
    \biblerefindex{\@@bv@tmpidxsort \relax @\@bv@mainidxentry !\@bv@chidxsort @\protect \BRchapterstyle {#2}\protect \BRchvsep \protect \BRversestyle {#3}\protect \BRvrsep \protect \BRversestyle {#4}|\@bv@idxpgformat}%
}
\makeatother

\usepackage{makeidx}
\makeindex

\begin{document}

\ibibleverse{Mk}(14:1-3),

\ibibleverse{Ex}(2:4-8),\indexonlyverse{Gen}{1}{1}{8}

\ibibleverse{Ex}(4:6),

Mk 7:4-8\indexonlyverse{Mk}{7}{4}{8}.


\printindex
\end{document}

文中引用

索引中的参考文献

相关内容