3

I am using bibleref for referencing and indexing Bible verses. I would like to add a Bible verse to the index without having any output in the actual text. After reading the bibleref manual, it appears that bibleref does not have this feature out of the book. While I can add a Bible reference to the text, but not to the index, using \bibleverse, there is no command to add a reference to the index without adding it to the text. \ibibleverse always does both.

How can I add a command that adds a reference to the index, but not to the text?

3 Answers 3

2

First, sorry for beeing late. I was busy on octobrer, and forget to look on your problem after that (I think a framagit issue would have been better).

D.R. Driver explained the three already existing macros

  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)

He or she provides a new macro \ibiblex which only indexes. I have tested this macro, and added it to the official bibleref (v. 1.25), send today on CTAN.

The only differences with D.R. Driver code are the following :

  • as I am not the maintener of bibleref-parse, I didn't provide any \pibiblex macro.
  • the official macro of bibleref is \ibible and not ibiblex as the i already stands for indexing.

Thank you D. R. Driver

3

I recently encountered the same issue, except that I wanted to have the references parsed with bibleref-parse. I have a solution that does this, too.

Basically I created the command \pibiblex on top of bibleref-parse, which in turn requires an equivalent \ibiblex on top of the parent bibleref pkg.

First, we want the underlying \ibiblex command. The bibleref package supplies three commands for indexing Bible references:

  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)

The macros get progressively longer. I modified \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
}

All three indexing ref options are mirrored in \pibiblex as follows:

  1. \pibibleverse (parses input, adds to index, prints full reference)
  2. \pibiblechvs (parses input, adds to index, prints chapter and verse only)
  3. \pibiblevs (parses input, adds to index, prints verse only)

I want a fourth one. Echoing my choice above, this one is based on the \pibiblevs command.

\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
}

Here's a relatively minimal MWE, which adds some necessary indexing things derived from the biblatex-sbl pkg. Also see this post.

% !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}

This is my first post of any kind (long time listener, first time caller). I'd certainly welcome any suggestions about how to improve the implementation above.

3
  • My original solution missed out a series of lines, which I have now added (and marked with the comment % add me, too). Without them, chapter and verse ranges would print a lonely en-dash, unaccompanied by chapter or verse. Jan 28, 2020 at 15:44
  • Also, the more manual \ibiblex has its uses, since the parse variations seem to choke on letters for half verses. I find I need to write something like the following to describe (e.g.) the Priestly creation account in \ibibleverse{Gen}(1:1)-(2:4a) with the Yahwist’s in \ibiblechvs{Gen}(2:4b)-(3:24). Jan 28, 2020 at 16:06
  • Thank for the code. You macro \ibiblex is now a part of the official \bibleref package, under the name of \ibible. See my own answer.
    – Maïeul
    Jun 22, 2020 at 13:50
0

I added a new command \indexonlyverse that takes the book name, the chapter, the starting verse and the ending verse as arguments. The reference is added to the index, but not to the text.

The approach has the following disadvantages:

  • It can only be used for verse ranges, not for referencing individual verses
  • The verse range must be in between one chapter
  • Altogether, it would be better if the chapter/verse would be referenced in the syntax used by bibref rather than by arguments in curly braces.
  • My particular implementation is built for the use case that a mapping for the books is provided and needs to be adjusted if there is no mapping.

This is my 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}

References in the text

References in the index

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.