summaryrefslogtreecommitdiff
path: root/macros/latex/contrib/bibleref
diff options
context:
space:
mode:
authorNorbert Preining <norbert@preining.info>2019-09-02 13:46:59 +0900
committerNorbert Preining <norbert@preining.info>2019-09-02 13:46:59 +0900
commite0c6872cf40896c7be36b11dcc744620f10adf1d (patch)
tree60335e10d2f4354b0674ec22d7b53f0f8abee672 /macros/latex/contrib/bibleref
Initial commit
Diffstat (limited to 'macros/latex/contrib/bibleref')
-rw-r--r--macros/latex/contrib/bibleref/CHANGES70
-rw-r--r--macros/latex/contrib/bibleref/README38
-rw-r--r--macros/latex/contrib/bibleref/bibleref.dtx2980
-rw-r--r--macros/latex/contrib/bibleref/bibleref.ins43
-rw-r--r--macros/latex/contrib/bibleref/bibleref.pdfbin0 -> 285284 bytes
-rw-r--r--macros/latex/contrib/bibleref/makefile21
-rw-r--r--macros/latex/contrib/bibleref/samples/sample-categories.pdfbin0 -> 12427 bytes
-rw-r--r--macros/latex/contrib/bibleref/samples/sample-indextools.pdfbin0 -> 9544 bytes
-rw-r--r--macros/latex/contrib/bibleref/samples/sample-xidx.pdfbin0 -> 19945 bytes
-rw-r--r--macros/latex/contrib/bibleref/samples/sample.pdfbin0 -> 40093 bytes
10 files changed, 3152 insertions, 0 deletions
diff --git a/macros/latex/contrib/bibleref/CHANGES b/macros/latex/contrib/bibleref/CHANGES
new file mode 100644
index 0000000000..f69256bc20
--- /dev/null
+++ b/macros/latex/contrib/bibleref/CHANGES
@@ -0,0 +1,70 @@
+1.23
+ * Add Tt abbreviation
+1.22
+ * Add Bar abbreviation
+1.21
+ * Add Wis abbreviation
+1.20:
+ * Before switching off `:` shorthand, test if it is a shorthand.
+1.19:
+ * \bibleverse and \ibibleverse are now robust, and so can be used in section title, caption, etc.
+ * Fix bug when using french and frenchb option of babel with pdflatex (because `:` character is active with this configuration).
+1.18:
+ * Fix bug with indexing when using non unicode engine.
+1.17:
+ * Use / to mark the two numbering of the Psalms : \bibleverse{Ps}{23/24}
+1.16:
+ * Don't add the \bvidxpgformat in the .idx file if defined as empty.
+
+1.15:
+ * Correct indexing for book without chapter. Thanks to Raphaël Pinson.
+
+1.14:
+
+ * added
+
+ \ibiblechvs - only displays chapter and verse,
+ but indexes under book, chapter and verse.
+ \ibiblevs - only displays verse, but indexes under book,
+ chapter and verse.
+
+ \biblerefcategory - sets up reference categories.
+
+ * Index now displayed using bibleref style current at \makeindex
+ rather than style in use when \ibibleref used.
+
+ * If there are chapter lists/ranges with no verses, can now
+ put the list in a single (chapter list:) for example
+ \ibibleverse{Gen}(1-5,9:)
+
+ * Added new package bibleref-xidx:
+
+ - extended bibleref indexing support
+
+ - verses added as subitems to chapters in index
+
+ - options to suppress the verses or chapters appearing in index
+
+1.13:
+ * Changed \@ifnextchar to \new@ifnextchar to prevent spaces being
+ ignored after bible references. (amsgen.sty now a required
+ package.)
+
+ * Removed spurious space when setting some of the styles
+
+1.12:
+ * Fixed bug occurring when the verse number has a suffix.
+
+1.11:
+ * Fixed sorting for 3-digit chapters
+
+1.10:
+ * Fixed bug causing unwanted @ in verse index subitem
+ * Entries sorted according to verses as well as book title and
+ * chapter.
+ * Added \setindexbooktitle
+
+1.09:
+ * Added \addbiblebook
+ * Added \biblerefindex
+ * Added \biblerefmap
diff --git a/macros/latex/contrib/bibleref/README b/macros/latex/contrib/bibleref/README
new file mode 100644
index 0000000000..1d92d98050
--- /dev/null
+++ b/macros/latex/contrib/bibleref/README
@@ -0,0 +1,38 @@
+LaTeX Class File : bibleref
+
+Author : Nicola Talbot (inactive) and Maïeul Rouquette (still active)
+
+Files : bibleref.dtx - documented source file
+ bibleref.ins - installation script
+
+LPPL 1.3 https://www.ctan.org/license/lppl1.3
+Feature requests: https://framagit.org/maieul/bibleref/issues
+
+
+The package file bibleref.sty can be used to ensure
+consistent formatting of bible citations. Also comes with
+bibleref-xidx.sty for extended bibleref indexing functions.
+
+INSTALLATION
+
+To extract the code do:
+
+latex bibleref.ins
+
+Put bibleref somewhere on TeX's path and refresh the database.
+
+To extract the documentation do:
+
+latex bibleref.dtx
+
+A sample file, sample.tex, is provided. This will be extracted
+along with the style file bibleref.sty.
+
+REQUIREMENTS
+
+ifthen
+fmtcount
+amsgen
+
+This material is subject to the LaTeX Project Public License.
+See https://www.latex-project.org/lppl/ for the details of that license.
diff --git a/macros/latex/contrib/bibleref/bibleref.dtx b/macros/latex/contrib/bibleref/bibleref.dtx
new file mode 100644
index 0000000000..ff5130502c
--- /dev/null
+++ b/macros/latex/contrib/bibleref/bibleref.dtx
@@ -0,0 +1,2980 @@
+%\iffalse
+%<*package>
+%% \CharacterTable
+%% {Upper-case \A\B\C\D\E\F\G\H\I\J\K\L\M\N\O\P\Q\R\S\T\U\V\W\X\Y\Z
+%% Lower-case \a\b\c\d\e\f\g\h\i\j\k\l\m\n\o\p\q\r\s\t\u\v\w\x\y\z
+%% Digits \0\1\2\3\4\5\6\7\8\9
+%% Exclamation \! Double quote \" Hash (number) \#
+%% Dollar \$ Percent \% Ampersand \&
+%% Acute accent \' Left paren \( Right paren \)
+%% Asterisk \* Plus \+ Comma \,
+%% Minus \- Point \. Solidus \/
+%% Colon \: Semicolon \; Less than \<
+%% Equals \= Greater than \> Question mark \?
+%% Commercial at \@ Left bracket \[ Backslash \\
+%% Right bracket \] Circumflex \^ Underscore \_
+%% Grave accent \` Left brace \{ Vertical bar \|
+%% Right brace \} Tilde \~}
+%</package>
+%\fi
+% \iffalse
+% Doc-Source file to use with LaTeX2e
+% Copyright (C) 2011 Nicola Talbot, all rights reserved.
+% Copyright (C) 2016… Maïeul Rouquette
+% LPPL 1.3 https://www.ctan.org/license/lppl1.3
+% \fi
+% \iffalse
+%<*driver>
+\documentclass{nlctdoc}
+
+\usepackage{bibleref}
+\usepackage[colorlinks,bookmarks,pdfauthor={Nicola L.C. Talbot and Ma\"{i}eul Rouquette},
+ hyperindex=false,
+ pdftitle={bibleref.sty: a LaTeX package for
+ typesetting bible references}]{hyperref}
+
+\CheckSum{2503}
+\OnlyDescription
+
+\begin{document}
+\DocInput{bibleref.dtx}
+\end{document}
+%</driver>
+%\fi
+% \GetFileInfo{bibleref.sty}
+%\title{bibleref.sty (\fileversion):
+%a \LaTeXe\ package for typesetting bible references}
+%\author{Nicola Talbot (inactive)\\[10pt]
+% Ma\"{i}eul Rouquette (active)}
+%\date{\filedate}
+%
+%\maketitle
+%\tableofcontents
+%
+%\section{General use}
+%\subsection{Basic}
+%The \sty{bibleref} package was designed to provide consistent formatting for referencing
+%parts of the bible.
+%
+%\begin{definition}[\DescribeMacro{\bibleverse}]
+%\cs{bibleverse}\marg{book title}\texttt(\meta{chapter}\texttt{:}\meta{verse(s)}\texttt)
+%\end{definition}
+%This command can be used to cite a bible book, chapter or verse
+%or range of chapters or verses.
+%
+%\begin{important}
+%Be careful if you use \sty{bibleref} with \sty{babel} as some of
+%\styfmt{babel}'s language options make the colon character active,
+%which will cause a problem for \cs{bibleverse} (and \ics{ibibleverse},
+%described later). Check the \styfmt{babel} documentation to find out
+%how to make the colon non-active.
+%\end{important}
+%
+% \subsection{Choosing the book}
+%The book title, \meta{book title}, may be given either as the
+%full title (e.g.\ \texttt{Matthew}) or as an abbreviation (e.g.\
+%\texttt{Mt} or \texttt{Matt}), most standard abbreviations are
+%recognised. Books with multiple parts should be preceded by the
+%book number in uppercase Roman numerals. For example, the second
+%book of Kings should be entered as \verb|\bibleverse{IIKings}|
+%
+%\subsection{Choosing the chapters and verses}
+%You may have any number, or zero, sets of parenthesis
+%\verb|(|\meta{chapter}\texttt{:}\meta{verse(s)}\verb|)|,
+%indicating the chapter and verse or verses. Verses can be
+%specified as a comma separated list of individual verses or range
+%of verses. A range of verses should be written with a single
+%hyphen, e.g.\ \verb|2-4|. In the typeset output the range of verses will
+%be separated with
+%\begin{definition}[\DescribeMacro{\BRvrsep}]
+%\cs{BRvrsep}
+%\end{definition}
+%(an en-dash by default.) A chapter may be referenced without a
+%verse, but the colon must remain, e.g.\ \verb|(12:)| simply
+%indicates chapter 12.
+%
+%A range of verses spanning more than one chapter can
+%be entered as \texttt(\meta{ch}\texttt:\meta{v}\texttt{)-(}\meta
+%{ch}\texttt:\meta{v}\texttt)
+%
+%If there is no verse, but there are multiple chapters
+%ranges, these may be specified in the \meta{chapter} part, using a
+%comma to separate individual chapters and a hyphen to separate
+%ranges. Note that you still need a colon at the end of the list.
+% \begin{important}
+% You \textbf{must not} use this syntax:\\
+% \texttt{(}\meta{ch}\texttt{:)-(}\meta{ch}\texttt{:)}
+%
+% Despite this syntax make a good typesetting, it make a problematic index: the chapter are typeset after the verses contained inside.
+% \end{important}
+%
+% For the book without chapter (\bibleverse{Ob}; \bibleverse{IJn}; \bibleverse{IIJn}; \bibleverse{Phm}; \bibleverse{Jude}), you must add an empty chapter:
+% \texttt{(:}\meta{v}\texttt{-}\meta{v}\texttt{)}
+%
+% \begin{important}
+% You \textbf{must not} use this syntax:\\
+% \texttt{(}\meta{v}\texttt{-}\meta{v}\texttt{:)}
+% With this syntax, the verses would be formatted as if they were chapters.
+% \end{important}
+%
+% For the book of Psalms, there is a double numbering: one following the Massoretic Texts, the other one following the Septuagint.
+% Depending on your field, you may use one numbering or the other one.
+% However, you can also provide both numbers.
+% In this case, use the slash (\slash) to separate the two numbers :\\
+% \verb|\bibleverse{Ps}(23/22:)|
+%
+% The alternative number will be, by default, typeset between parenthesis.
+% However, you can redefine the \cs{BRotherchapterstyle} macro to modify the way this number is inserted.
+% For example, to print it in superscript:\\
+%
+% \begin{verbatim}
+% \renewcommand{\BRotherchapterstyle}[1]{\textsuperscript{#1}}
+% \end{verbatim}
+% or to delete it:
+% \begin{verbatim}
+% \renewcommand{\BRotherchapterstyle}[1]{}
+% \end{verbatim}
+%\subsection{Examples}
+%\begin{center}
+%\begin{tabular}{ll}
+%\verb|\bibleverse{Ex}| & \bibleverse{Ex}\\
+%\verb|\bibleverse{Exodus}(20:)| & \bibleverse{Exodus}(20:)\\
+%\verb|\bibleverse{Exod}(20:17)| & \bibleverse{Exod}(20:17)\\
+%\verb|\bibleverse{Exod}(20-21:)| & \bibleverse{Exod}(20-21:)\\
+%\verb|\bibleverse{Ps}(23/22:)| & \bibleverse{Ps}(23/22:)\\
+%\verb|\bibleverse{IICo}(12:21)| & \bibleverse{IICo}(12:21)\\
+%\verb|\bibleverse{Ex}(20:17)(21:3)| & \bibleverse{Ex}(20:17)(21:3)\\
+%\verb|\bibleverse{Ex}(15:)(17:)(20:)| & \bibleverse{Ex}(15:)(17:)(20:)\\
+%\verb|\bibleverse{Rev}(1:2,5,7-9,11)| & \bibleverse{Rev}(1:2,5,7-9,11)\\
+%\verb|\bibleverse{IChronicles}(1:3)-(2:7)| &
+%\bibleverse{IChronicles}(1:3)-(2:7)\\
+%\verb|\bibleverse{Luke}(1,4-5,8:)| &\bibleverse{Luke}(1,4-5,8:)\\
+%\verb|\bibleverse{Phm}(1-3:)| &\bibleverse{Phm}(1-3:)\\
+%\end{tabular}
+%\end{center}
+% \subsection{Style}
+%The style of the reference can be specified either by
+%package option or as the argument to the command
+%\begin{definition}[\DescribeMacro{\biblerefstyle}]
+%\cs{biblerefstyle}\marg{style}
+%\end{definition}
+%Styles are listed in Table~\ref{tab:styles}.
+%
+%\begin{table}[tbh]
+%\caption{Bible Citation Styles (can be used as package option or in the argument to
+%\cs{biblerefstyle})}
+%\label{tab:styles}
+%\vspace{10pt}
+%\begin{center}
+%\begin{tabular}{lp{0.5\textwidth}}
+%\bfseries Style & \bfseries Example\\
+%default & \biblerefstyle{default}\bibleverse{IICor}(12:1-5)\\
+%jerusalem & \biblerefstyle{jerusalem}\bibleverse{IICor}(12:1-5)\\
+%anglosaxon & \biblerefstyle{anglosaxon}\bibleverse{IICor}(12:1-5)\\
+%JEH & \biblerefstyle{JEH}\bibleverse{IICor}(12:1-5)\\
+%NTG & \biblerefstyle{NTG}\bibleverse{IICor}(12:1-5)\\
+%MLA & \biblerefstyle{MLA}\bibleverse{IICor}(12:1-5)\\
+%chicago & \biblerefstyle{chicago}\bibleverse{IICor}(12:1-5)\\
+%text & \biblerefstyle{text}\bibleverse{IICor}(12:1-5)
+%\end{tabular}
+%\end{center}
+%\end{table}
+%
+%You can change the name of a book using
+%\begin{definition}[\DescribeMacro{\setbooktitle}]
+%\cs{setbooktitle}\marg{name}\marg{new title}
+%\end{definition}
+%Note that \meta{name} must be the full name, not the
+%abbreviated name of the book. For example, to change
+%Revelation to Apoc, do
+%\verb|\setbookname{Revelation}{Apoc}|
+%(\textbf{Note} that you shouldn't do
+%\verb|\setbookname{Rev}{Apoc}|)
+%
+%If you want a different title for a book depending on whether it's
+%in the main body of the document or in the index, you can set the
+%index version using:
+%\begin{definition}[\DescribeMacro{\setindexbooktitle}]
+%\cs{setindexbooktitle}\marg{name}\marg{title}
+%\end{definition}
+%In this case, \meta{name} should be the name you'll use in
+%\cs{ibibleverse}. For example, if you do:
+%\begin{verbatim}
+%\setbooktitle{Psalms}{Psalm}
+%\setindexbooktitle{Psalms}{Psalms}
+%\end{verbatim}
+%Then \verb|\ibibleverse{Psalms}(2:)| will print Psalm the
+%document and Psalms in the index, but \verb|\ibibleverse{Ps}(2:)|
+%will print Psalms in both the document and the index.
+%
+%You can add a book using
+%\begin{definition}[\DescribeMacro{\addbiblebook}]
+%\cs{addbiblebook}\marg{name}\marg{title}
+%\end{definition}
+%For example:
+%\begin{verbatim}
+%\addbiblebook{Susanna}{Story of Susanna}
+%\end{verbatim}
+%
+%\section{Defining New Styles}
+%
+%You can define a new style using the command
+%\begin{definition}[\DescribeMacro{\newbiblerefstyle}]
+%\cs{newbiblerefstyle}\marg{style-name}\marg{commands}
+%\end{definition}\noindent
+%where \meta{commands} are
+%the commands needed to modify the citation style.
+%
+%Example:
+%This new style is based on the \qt{default} style, but
+%has verses in lower case Roman numerals, and redefines
+%\qt{Revelation} as \qt{Apocalypse}.
+%\begin{verbatim}
+%\newbiblerefstyle{sample}{%
+%\biblerefstyle{default}%
+%\renewcommand{\BRversestyle}[1]{\romannumeral##1}%
+%\setbooktitle{Revelation}{Apocalypse}%
+%}
+%\end{verbatim}
+%Note the use of \verb|##1| instead of \verb|#1|.
+%
+%If you want to distribute a new style, see
+%section~\ref{sec:distnewstyles}.
+%
+%\section{Indexing Bible References}
+%
+%\begin{definition}[\DescribeMacro{\ibibleverse}]
+%\cs{ibibleverse}\oarg{format}\marg{book title}\texttt(\marg{chapter}\texttt{:}\meta{verse(s)}\texttt)
+%\end{definition}
+%This does the same as \cs{bibleverse}
+%but also adds an index entry (provided you have used
+%\cs{makeindex} in the preamble.) The default page number
+%format is given by the command
+%\begin{definition}[\DescribeMacro{\bvidxpgformat}]
+%\cs{bvidxpgformat}
+%\end{definition}
+%This is \texttt{textrm} by default, but can be redefined. To
+%override the page number format for a particular entry you can
+%use the optional argument to \cs{ibibleverse}. For example:
+%\begin{verbatim}
+%\ibibleverse[textit]{Exodus}
+%\end{verbatim}
+%(Note there is no backslash.)
+%
+%\begin{definition}[\DescribeMacro{\ibiblechvs}]
+%\cs{ibiblechvs}\oarg{format}\marg{book title}\texttt(\marg{chapter}\texttt{:}\meta{verse(s)}\texttt)
+%\end{definition}
+%This is similar to \cs{ibibleverse} except that it doesn't display
+%the book name in the text. The reference is indexed under the book
+%title in the same way as \cs{ibibleverse}.
+%
+%\begin{definition}[\DescribeMacro{\ibiblevs}]
+%\cs{ibiblevs}\oarg{format}\marg{book title}\texttt(\marg{chapter}\texttt{:}\meta{verse(s)}\texttt)
+%\end{definition}
+%This is similar to \cs{ibiblechvs} except that it only displays the
+%verse(s) in the text.
+%
+%You may need to create your own custom \app{makeindex} style file
+%as the default uses a comma and space to separate the item from
+%the page number, which may cause confusion. For example, you
+%could create a file called \texttt{sample.ist} and write in the
+%lines:
+%\begin{verbatim}
+%delim_0 "\\dotfill "
+%delim_1 "\\dotfill "
+%delim_2 "\\dotfill "
+%\end{verbatim}
+%See the \app{makeindex} documentation for further details.
+%
+%\subsection{Index Categories}
+%
+%You may prefer to index the bible reference under a category with
+%the book title as a sub item of that category. This can be achieved
+%using:
+%\begin{definition}[\DescribeMacro{\biblerefcategory}]
+%\cs{biblerefcategory}\oarg{sort key}\marg{category title}
+%\end{definition}
+%The optional argument is the sort key to be used by
+%\app{makeindex} or \app{xindy}. If omitted \meta{category title} is
+%used.
+%
+%Note that \ics{ibibleverse}, \ics{ibiblechvs} and \ics{ibiblevs}
+%use the category that is currently set. If you need to keep
+%switching categories, you may find it easier to define a shortcut
+%command. For example, suppose you're discussing the differences
+%between the King James and the New Jerusalem versions, you could
+%define the following:
+%\begin{verbatim}
+%\newcommand{\kjref}{\biblerefcategory{King James}\ibibleverse}
+%\newcommand{\njref}{\biblerefcategory{New Jerusalem}\ibibleverse}
+%\end{verbatim}
+%You can now use \cs{kjref} and \cs{njref} in the same way that you
+%would use \cs{ibibleverse}
+%
+%You can disable the category by setting it to nothing:
+%\begin{verbatim}
+%\biblerefcategory{}
+%\end{verbatim}
+%
+%\subsection{The \sty{bibleref-xidx} Package}
+%
+%The \sty{bibleref} package comes with a supplementary package
+%\sty{bibleref-xidx} that modifies the way bible references are added to
+%the index. With no package options, i.e., just
+%\begin{verbatim}
+%\usepackage{bibleref-xidx}
+%\end{verbatim}
+%the verses will appear as sub-items of the chapters. Note that a
+%verse range will be considered a single item so, for example,
+%\begin{verbatim}
+%\ibibleverse{Ex}(9:1)
+%\ibibleverse{Ex}(9:4)
+%\ibibleverse{Ex}(9:1-4)
+%\end{verbatim}
+%will occur as three separate entries under Exodus chapter~9.
+%Also note that \verb|(9-14:)| and \verb|(9:)-(14:)| will be treated
+%differently.
+%
+%The \sty{bibleref-xidx} package can be loaded with the following options:
+%\begin{description}
+%\item[\pkgopt{noverses}] Don't show the verses in the index.
+%\item[\pkgopt{verses}] Show the verses (and chapters) in the index
+%(default).
+%\item[\pkgopt{nochapters}] Don't show the chapters (and verses) in the
+%index.
+%\item[\pkgopt{chapters}] Show the chapters in the index (default).
+%\end{description}
+%All other package options will be passed to the \sty{bibleref}
+%package, which \sty{bibleref-xidx} automatically loads.
+%
+%\subsection{Separate Scripture Index}
+%
+%If you want a separate index for bible verses, in addition to
+%a general index, you can redefine
+%\begin{definition}[\DescribeMacro{\biblerefindex}]
+%\cs{biblerefindex}
+%\end{definition}
+%This command defaults to \cs{index}, but can be changed to
+%the appropriate indexing command. For example, suppose you
+%are using the \sty{indextools} package and you want a general
+%index and a scripture index, you can do something like:
+%\begin{verbatim}
+%\documentclass{article}
+%\usepackage{bibleref}
+%\usepackage{indextools}
+%
+%\makeindex[title=Scripture,name=scr]}
+%\makeindex[title=General]
+%
+%\renewcommand{\biblerefindex}{\index[scr]}
+%\end{verbatim}
+%In the document, you can use \cs{ibibleverse} as before, and
+%the scripture index is displayed using
+%\begin{verbatim}
+%\printindex[scr]
+%\end{verbatim}
+%You will find the index. See the \sty{indextools} documentation
+%for further details.
+%
+%\subsection{Changing the Sort Order}
+%
+%The bible reference entries will be sorted alphabetically by
+%\app{makeindex}. However you may prefer the entries to be sorted
+%according to their order in the bible. This can either be done
+%using \app{xindy} instead of \app{makeindex} and creating your
+%own custom alphabet (see \app{xindy} manual for details) or you
+%can use \sty{bibleref}'s mapping command.
+%
+%\begin{definition}[\DescribeMacro{\biblerefmap}]
+%\cs{biblerefmap}\marg{label}\marg{new sort key}
+%\end{definition}
+%For example, in the preamble:
+%\begin{verbatim}
+%\biblerefmap{Genesis}{01}
+%\biblerefmap{Exodus}{02}
+%\biblerefmap{Leviticus}{03}
+%\biblerefmap{Numbers}{04}
+%\biblerefmap{Deuteronomy}{05}
+%...
+%\end{verbatim}
+%When you run \app{makeindex}, the references will now be sorted
+%in numerical order.
+%
+%If you want to subdivide the index into, say, old and new
+%testament, you can add this to the mapping. For example:
+%\begin{verbatim}
+%\biblerefmap{Genesis}{1@Old Testament!01}
+%\biblerefmap{Exodus}{1@Old Testament!02}
+%\biblerefmap{Leviticus}{1@Old Testament!03}
+%\biblerefmap{Numbers}{1@Old Testament!04}
+%\biblerefmap{Deuteronomy}{1@Old Testament!05}
+%...
+%\biblerefmap{Matthew}{2@New Testament!01}
+%\biblerefmap{Mark}{2@New Testament!02}
+%...
+%\end{verbatim}
+%
+%\section{Distributing New Styles}
+%\label{sec:distnewstyles}
+%
+%If you want a new bible reference style (or translation) publicly
+%available, then it's a good idea to upload it to
+%CTAN\footnote{\url{https://ctan.org/}}. If you've never done this before, you
+%might find it a bit daunting, so here are a few pointers.
+%
+%I suggest that you give the name of your new package the prefix \texttt{bibleref-} as
+%then it will appear close to \sty{bibleref} in the alphabetical list
+%in the catalogue. Suppose your new style is called
+%``mystyle''\footnote{Choose a more descriptive name than this.},
+%then create a file called \texttt{bibleref-mystyle.sty}. At the
+%start of the file, do:
+%\begin{verbatim}
+%\NeedsTeXFormat{LaTeX2e}
+%\ProvidesPackage{bibleref-mystyle}[2011/01/19 v1.0 Bible reference
+%style conforming to something or other]
+%\end{verbatim}
+%(Change the date and the brief description in the line above to
+%something more appropriate.) Next you need to load \sty{bibleref}:
+%\begin{verbatim}
+%\RequirePackage{bibleref}
+%\end{verbatim}
+%Now do the new style stuff (or redefine styles to provide
+%translations):
+%\begin{verbatim}
+%\newbiblerefstyle{mystyle}{%
+%\biblerefstyle{default}%
+%\renewcommand{\BRversestyle}[1]{\romannumeral##1}%
+%\setbooktitle{Revelation}{Apocalypse}%
+%}
+%\end{verbatim}
+%(Again change the above to whatever is appropriate.) Put any new
+%book definitions that your style may require, for example:
+%\begin{verbatim}
+%\addbiblebook{Susanna}{Story of Susanna}
+%\end{verbatim}
+%and add any \cs{biblerefmap} commands that are required. Then set
+%your new style as the current style, if appropriate:
+%\begin{verbatim}
+%\biblerefstyle{mystyle}
+%\end{verbatim}
+%On the last line of the file add:
+%\begin{verbatim}
+%\endinput
+%\end{verbatim}
+%
+%Next you need to create a file called ``README'' that contains some
+%information about your new package, including what license you want
+%to distribute it under. (If you don't know anything about licenses,
+%I recommend you choose the \LaTeX\ Project Public License, LPPL.)
+%
+%It's worth adding a sample file or a little bit of documentation
+%that illustrates how the references appear.
+%
+%Put your .sty file, README file and samples or documentation into a
+%zip archive. You're now ready to upload it. There are several upload
+%pages. The main one is at \url{https://ctan.org/upload}.
+%The name of your contribution is the name of your package
+%(``bibleref-mystyle'' in this example). Remember to put your name
+%and email in the relevant input boxes. Sometime after you've
+%uploaded your zip file, you'll get a copy of the announcement from
+%one of the CTAN maintainers. It usually takes a day to establish
+%itself. After that people can download and use it.
+%
+%\section{Acknowledgements}
+%Many thanks to all the useful comments from comp.text.tex,
+%especially from Jesse~Billett, Brooks~Moses and Ulrich~M.~Schwarz.
+%
+% Many thanks also to Rapha\"{e}l Pinson, which have debbuged indexing for books without chapter.
+%
+%\section{Bug and feature request}
+% For all bug and feature requests, please open an ``issue'' on
+% \begin{important}
+% \url{https://git.framasoft.org/maieul/bibleref/issues}
+% \end{important}
+%
+%\StopEventually{\clearpage\phantomsection
+%\PrintIndex
+%
+%}
+%
+%\section{The Code}
+%\iffalse
+% \begin{macrocode}
+%<*bibleref-xidx.sty>
+% \end{macrocode}
+%\fi
+% Declare \sty{bibleref-xidx} package
+% \begin{macrocode}
+\NeedsTeXFormat{LaTeX2e}
+\ProvidesPackage{bibleref-xidx}[2011/01/19 v1.0 (NLCT) Extended indexing support for bibleref]
+% \end{macrocode}
+%\begin{macro}{\if@br@indexchapters}
+% Provide switch to determine whether or not to add chapters to the
+% index
+% \begin{macrocode}
+\newif\if@br@indexchapters
+\@br@indexchapterstrue
+% \end{macrocode}
+%\end{macro}
+%\begin{macro}{\if@br@indexverses}
+% Provide switch to determine whether or not to add verses to the
+% index
+% \begin{macrocode}
+\newif\if@br@indexverses
+\@br@indexversestrue
+% \end{macrocode}
+%\end{macro}
+% Declare package options:
+% \begin{macrocode}
+\DeclareOption{verses}{\@br@indexchapterstrue\@br@indexversestrue}
+\DeclareOption{noverses}{\@br@indexversesfalse}
+\DeclareOption{chapters}{\@br@indexchaptersfalse}
+\DeclareOption{nochapters}{\@br@indexchaptersfalse\@br@indexversesfalse}
+% \end{macrocode}
+% Pass remaining options to \sty{bibleref}:
+% \begin{macrocode}
+\DeclareOption*{\PassOptionsToPackage{\CurrentOption}{bibleref}}
+% \end{macrocode}
+% Process options
+% \begin{macrocode}
+\ProcessOptions
+% \end{macrocode}
+% Load \sty{bibleref} package:
+% \begin{macrocode}
+\RequirePackage{bibleref}
+% \end{macrocode}
+%
+%\begin{macro}{\@bibleverse}
+% Redefine \cs{@bibleverse} (processes chapter number).
+% \begin{macrocode}
+\def\@bibleverse(#1:{%
+ \def\@bv@chidxsort{}%
+ \def\@bv@chidxentry{}%
+ \bv@dbl@ch#1/\@nil%
+ \@br@chsty{\bv@dbl@ch@one}%
+ \ifx\bv@dbl@ch@two\@empty\else%
+ \@bv@dbl@ch@twotrue%
+ \BRotherchapterstyle{\@br@chsty{\bv@dbl@ch@two}}%
+ \@bv@dbl@ch@twofalse%
+ \fi%
+ \@@bibleverse
+}
+% \end{macrocode}
+%\end{macro}
+%\begin{macro}{\@bibleverser}
+% Redefine \cs{@bibleverser} (end of range).
+% \begin{macrocode}
+\def\@bibleverser-(#1:{%
+ \def\@bv@chidxsort{}%
+ \def\@bv@chidxentry{}%
+ \bv@dbl@ch#1/\@nil%
+ \@br@chsty{\bv@dbl@ch@one}%
+ \ifx\bv@dbl@ch@two\@empty\else%
+ \@bv@dbl@ch@twotrue%
+ \BRotherchapterstyle{\@br@chsty{\bv@dbl@ch@two}}%
+ \@bv@dbl@ch@twofalse%
+ \fi%
+ \@@bibleverse
+}
+% \end{macrocode}
+%\end{macro}
+%\begin{macro}{\@@bibleverse}
+% Redefine \cs{@@bibleverse} (processes verse list)
+% \begin{macrocode}
+\def\@@bibleverse#1){%
+ \def\@bv@tmp{#1}%
+ \ifx\@bv@tmp\@empty
+% \end{macrocode}
+% If no verses specified, do the index for the current
+% chapter.
+% \begin{macrocode}
+ \@bvx@dochindex
+ \else
+ \BRchvsep
+ \@br@vrsty{#1}%
+ \fi
+ \new@ifnextchar(%
+ {\BRchsep\@bibleverse}%
+ {\new@ifnextchar-%
+ {\protect\BRvrsep\@bibleverser}%
+ {\@end@@bibleverse}%
+ }%
+}
+% \end{macrocode}
+%\end{macro}
+%\begin{macro}{\@brx@dochsep}
+% Define what to do between chapters in a list.
+% \begin{macrocode}
+\newcommand*{\@brx@dochsep}{%
+ \@bvx@chdo{\protect\BRvsep}%
+}
+% \end{macrocode}
+%\end{macro}
+%\begin{macro}{\@br@chsty}
+% \begin{macrocode}
+\renewcommand*{\@br@chsty}[1]{%
+ \let\@brx@chsep\@empty
+ \@for\@brx@thisch:=#1\do{%
+% \end{macrocode}
+% Index previous chapter entry in current list, if it exists
+% \begin{macrocode}
+ \@bvx@dochindex
+ \@brx@chsep
+ \expandafter\@@br@chsty\@brx@thisch-\@nil\end
+ \let\@brx@chsep\@brx@dochsep
+ }%
+}
+% \end{macrocode}
+%\end{macro}
+%\begin{macro}{\@brx@dovssep}
+% Define what to do between verses in a list.
+% \begin{macrocode}
+\newcommand*{\@brx@dovssep}{%
+ \@bvx@vsdo{\protect\BRvsep}%
+}
+% \end{macrocode}
+%\end{macro}
+%\begin{macro}{\@br@vrsty}
+% Redefine \cs{@br@vrsty} (processes verses).
+% \begin{macrocode}
+\renewcommand*{\@br@vrsty}[1]{%
+ \let\@brx@vssep\@empty
+ \@for\@brx@thisvs:=#1\do{%
+ \def\@bv@vsidxentry{}%
+ \def\@bv@vsidxsort{}%
+ \@brx@vssep
+ \expandafter\@@br@vrsty\@brx@thisvs-\@nil\end
+ \let\@brx@vssep\@brx@dovssep
+ \@bvx@dovsindex
+ }%
+}
+% \end{macrocode}
+%\end{macro}
+%\begin{macro}{\@@br@vrsty}
+% Process individual verse or verse range.
+% \begin{macrocode}
+\def\@@br@vrsty#1-#2\end{%
+ \ifx\@nil#2\relax
+ \@do@verse{#1}%
+ \else
+ \@do@verserange{#1}#2%
+ \fi
+}
+% \end{macrocode}
+%\end{macro}
+%\begin{macro}{\@do@verse}
+% Process individual verse.
+% \begin{macrocode}
+\renewcommand{\@do@verse}[1]{%
+ \@nodo@verse{#1}%
+ \expandafter\@bvx@vsdo\expandafter{\@br@tmp}%
+ \@bv@addtovsidxsort{-000}%
+}
+% \end{macrocode}
+%\end{macro}
+%\begin{macro}{\@@br@chsty}
+% Process individual chapter or chapter range.
+% \begin{macrocode}
+\def\@@br@chsty#1-#2\end{%
+ \ifx\@nil#2\relax
+ \@do@chapter{#1}%
+ \else
+ \@do@chapterrange{#1}#2%
+ \fi
+}
+% \end{macrocode}
+%\end{macro}
+%\begin{macro}{\@do@chapter}
+% Process individual chapter.
+% \begin{macrocode}
+\newcommand{\@do@chapter}[1]{%
+ \@nodo@chapter{#1}%
+ \@bvx@chdo{\protect\BRchapterstyle{#1}}%
+ \@bv@addtochidxsort{-000}%
+}
+% \end{macrocode}
+%\end{macro}
+%\begin{macro}{\@do@chapter}
+% Process chapter sort info.
+% \begin{macrocode}
+\renewcommand*{\@nodo@chapter}[1]{%
+ \ifnum0#1<10\relax
+ \@bv@setchidxsort{00#1}%
+ \else
+ \ifnum0#1<100\relax
+ \@bv@setchidxsort{0#1}%
+ \else
+ \@bv@setchidxsort{#1}%
+ \fi
+ \fi
+}
+% \end{macrocode}
+%\end{macro}
+%\begin{macro}{\@do@chapterrange}
+% Process chapter range.
+% \begin{macrocode}
+\def\@do@chapterrange#1#2-\@nil{%
+ \@nodo@chapter{#1}%
+ \@bvx@chdo{\protect\BRchapterstyle{#1}}%
+ \@bv@addtochidxsort{-}%
+ \@bvx@chadddo{\protect\BRvrsep}%
+ \@nodo@chapter{#2}%
+ \@bvx@chadddo{\protect\BRchapterstyle{#2}}%
+}
+% \end{macrocode}
+%\end{macro}
+%\begin{macro}{\@nodo@verse}
+% Process verse sort info and stores style in \cs{@br@tmp}.
+% \begin{macrocode}
+\renewcommand*{\@nodo@verse}[1]{%
+ \br@stripverse{#1}%
+ \ifnum\@br@versenum<10\relax
+ \@bv@addtovsidxsort{00#1}%
+ \else
+ \ifnum\@br@versenum<100\relax
+ \@bv@addtovsidxsort{0#1}%
+ \else
+ \@bv@addtovsidxsort{#1}%
+ \fi
+ \fi
+ \ifx\@br@versesuffix\@empty
+ \protected@edef\@br@tmp{%
+ \protect\BRversestyle{\@br@versenum}%
+ }%
+ \else
+ \protected@edef\@br@tmp{%
+ \protect\BRversestyle{\@br@versenum}%
+ \protect\BRversesuffixstyle{\@br@versesuffix}%
+ }%
+ \fi
+}
+% \end{macrocode}
+%\end{macro}
+%\begin{macro}{\@do@verserange}
+% Process verse range.
+% \begin{macrocode}
+\def\@do@verserange#1#2-\@nil{%
+ \@nodo@verse{#1}%
+ \expandafter\@bvx@vsdo\expandafter{\@br@tmp}%
+ \@bv@addtovsidxsort{-}%
+ \@bvx@vsadddo{\protect\BRvrsep}%
+ \@nodo@verse{#2}%
+ \expandafter\@bvx@vsadddo\expandafter{\@br@tmp}%
+}
+% \end{macrocode}
+%\end{macro}
+%\begin{macro}{\@bv@setvsidxsort}
+% Set the verse sort information.
+% \begin{macrocode}
+\newcommand*{\@bv@setvsidxsort}[1]{%
+\if@bv@idx
+ \protected@edef\@bv@vsidxsort{#1}%
+\fi
+}
+% \end{macrocode}
+%\end{macro}
+%\begin{macro}{\@bv@addtovsidxsort}
+% Add to the verse sort information.
+% \begin{macrocode}
+\newcommand*{\@bv@addtovsidxsort}[1]{%
+\if@bv@idx
+ \@bv@tmpa={#1}%
+ \@bv@tmpb=\expandafter{\@bv@vsidxsort}%
+ \protected@edef\@bv@vsidxsort{\the\@bv@tmpb\the\@bv@tmpa}%
+\fi
+}
+% \end{macrocode}
+%\end{macro}
+%\begin{macro}{\@bv@setvsidx}
+% Set the verse entry information.
+% \begin{macrocode}
+\newcommand*{\@bv@setvsidx}[1]{%
+\if@bv@idx
+ \def\@bv@vsidxentry{#1}%
+\fi
+}
+% \end{macrocode}
+%\end{macro}
+%\begin{macro}{\@bv@addtovsidx}
+% Add to the verse entry information.
+% \begin{macrocode}
+\newcommand*{\@bv@addtovsidx}[1]{%
+\if@bv@idx
+ \@bv@tmpa={#1}%
+ \@bv@tmpb=\expandafter{\@bv@vsidxentry}%
+ \protected@edef\@bv@vsidxentry{\the\@bv@tmpb\the\@bv@tmpa}%
+\fi
+}
+% \end{macrocode}
+%\end{macro}
+%\begin{macro}{\@bv@setchidx}
+% Set the chapter entry information.
+% \begin{macrocode}
+\newcommand*{\@bv@setchidx}[1]{%
+\if@bv@idx
+ \def\@bv@chidxentry{#1}%
+\fi
+}
+% \end{macrocode}
+%\end{macro}
+%\begin{macro}{\@bv@addtochidx}
+% Add to the chapter entry information.
+% \begin{macrocode}
+\newcommand*{\@bv@addtochidx}[1]{%
+\if@bv@idx
+ \@bv@tmpa={#1}%
+ \@bv@tmpb=\expandafter{\@bv@chidxentry}%
+ \protected@edef\@bv@chidxentry{\the\@bv@tmpb\the\@bv@tmpa}%
+\fi
+}
+% \end{macrocode}
+%\end{macro}
+%\begin{macro}{\@bv@setchidxsort}
+% Set the chapter sort information.
+% \begin{macrocode}
+\newcommand*{\@bv@setchidxsort}[1]{%
+\if@bv@idx
+ \protected@edef\@bv@chidxsort{#1}%
+\fi
+}
+% \end{macrocode}
+%\end{macro}
+%\begin{macro}{\@bvx@chdo}
+% Display argument and set as chapter entry information
+% \begin{macrocode}
+\newcommand*{\@bvx@chdo}[1]{#1\@bv@setchidx{#1}}
+% \end{macrocode}
+%\end{macro}
+%\begin{macro}{\@bvx@vsdo}
+% Display argument and set as verse entry information
+% \begin{macrocode}
+\newcommand*{\@bvx@vsdo}[1]{#1\@bv@setvsidx{#1}}
+% \end{macrocode}
+%\end{macro}
+%\begin{macro}{\@bvx@chadddo}
+% Display argument and adds to chapter entry information
+% \begin{macrocode}
+\newcommand*{\@bvx@chadddo}[1]{#1\@bv@addtochidx{#1}}
+% \end{macrocode}
+%\end{macro}
+%\begin{macro}{\@bvx@vsadddo}
+% Display argument and adds to verse entry information
+% \begin{macrocode}
+\newcommand*{\@bvx@vsadddo}[1]{#1\@bv@addtovsidx{#1}}
+% \end{macrocode}
+%\end{macro}
+% Store original definition of \cs{@bible@verse}
+% \begin{macrocode}
+\let\@bv@org@bible@verse\@bible@verse
+% \end{macrocode}
+%
+%\begin{macro}{\@bible@verse}
+% Redefine \cs{@bible@verse}
+% \begin{macrocode}
+\renewcommand*{\@bible@verse}{%
+ \def\@bv@chidxentry{}%
+ \@bv@org@bible@verse
+}
+% \end{macrocode}
+%\end{macro}
+%\begin{macro}{\@end@@bibleverse}
+% Redefine \cs{@end@@bibleverse}
+% \begin{macrocode}
+\renewcommand*{\@end@@bibleverse}{%
+% \end{macrocode}
+% If no chapters specified, index just the book.
+% \begin{macrocode}
+ \ifx\@bv@chidxentry\@empty
+ \@bvx@dobkindex
+ \else
+ \if@br@indexchapters
+ \else
+% \end{macrocode}
+% Only indexing book, so index hasn't been done yet.
+% \begin{macrocode}
+ \@bvx@dobkindex
+ \fi
+ \fi
+ \@bv@idxfalse
+ \@bv@restore
+}
+% \end{macrocode}
+%\end{macro}
+%
+%\begin{macro}{\@bvx@dochindex}
+% Writes the indexing information for the current bible chapter (no
+% verse information specified).
+% \begin{macrocode}
+\newcommand*{\@bvx@dochindex}{%
+\if@br@indexchapters
+ \ifx\@bv@chidxentry\@empty
+ \else
+ \if@bv@idx
+ \expandafter\@do@bibleref@map\@@bv@idxsort\relax
+ \@do@biblerefindex
+ {\@@bv@idxsort\relax @\@bv@mainidxentry
+ !\@bv@chidxsort @\@bv@chidxentry
+ |\@bv@idxpgformat}%
+ \fi
+ \fi
+\fi
+}
+% \end{macrocode}
+%\end{macro}
+%
+%\begin{macro}{\@bvx@dovsindex}
+% Writes the indexing information for the current bible chapter and
+% verse.
+% \begin{macrocode}
+\newcommand*{\@bvx@dovsindex}{%
+\if@br@indexverses
+ \ifx\@bv@vsidxentry\@empty
+ \else
+ \if@bv@idx
+ \expandafter\@do@bibleref@map\@@bv@idxsort\relax
+ \@do@biblerefindex
+ {\@@bv@idxsort\relax @\@bv@mainidxentry
+ !\@bv@chidxsort @\@bv@chidxentry
+ !\@bv@vsidxsort @\@bv@vsidxentry
+ |\@bv@idxpgformat}%
+ \fi
+ \fi
+\else
+ \@bvx@dochindex
+\fi
+}
+% \end{macrocode}
+%\end{macro}
+%
+%\begin{macro}{\@bvx@dobkindex}
+% Writes the indexing information for the current book (no chapter
+% or verses specified).
+% \begin{macrocode}
+
+\newcommand*{\@bvx@dobkindex}{%
+ \if@bv@idx
+ \expandafter\@do@bibleref@map\@@bv@idxsort\relax
+ \@do@biblerefindex
+ {\@@bv@idxsort\relax @\@bv@mainidxentry|\@bv@idxpgformat}%
+ \fi
+}
+% \end{macrocode}
+%\end{macro}
+%\iffalse
+% \begin{macrocode}
+%</bibleref-xidx.sty>
+% \end{macrocode}
+%\fi
+%\iffalse
+% \begin{macrocode}
+%<*bibleref.sty>
+% \end{macrocode}
+%\fi
+% Declare package
+% \begin{macrocode}
+\NeedsTeXFormat{LaTeX2e}
+\ProvidesPackage{bibleref}[2019/01/13 1.23 (NLCT and MR)]
+% \end{macrocode}
+% Need to do some conditional stuff
+% \begin{macrocode}
+\RequirePackage{ifthen}
+% \end{macrocode}
+% The \sty{fmtcount} package is needed for the full text
+% citations
+% \begin{macrocode}
+\RequirePackage{fmtcount}
+% \end{macrocode}
+% The \sty{amsgen} package is needed for \cs{new@ifnextchar}
+%\changes{1.13}{2010/07/07}{Added amsgen which provides
+%\cs{new@ifnextchar}}
+% \begin{macrocode}
+\RequirePackage{amsgen}
+% \end{macrocode}
+% We need to know if we use XeTeX.
+% \begin{macrocode}
+\RequirePackage{ifxetex}
+% \end{macrocode}
+%\begin{macro}{\BRbooknumberstyle}
+% The style of the book
+% number. By default, it simply displays its argument
+%followed by a space.
+% \begin{macrocode}
+\newcommand*{\BRbooknumberstyle}[1]{#1 }
+% \end{macrocode}
+%\end{macro}
+%\begin{macro}{\BRepistlenumberstyle}
+% As above, but for epistle.
+% \begin{macrocode}
+\newcommand*{\BRepistlenumberstyle}[1]{#1 }
+% \end{macrocode}
+%\end{macro}
+%\begin{macro}{\BRbookof}
+%The text to go before the book title.
+%This by default is nothing,
+% but can be changed to, e.g., \qt{The book of }
+% \begin{macrocode}
+\newcommand*{\BRbookof}{}
+% \end{macrocode}
+%\end{macro}
+%\begin{macro}{\BRgospel}
+%As above but for gospels
+% \begin{macrocode}
+\newcommand*{\BRgospel}{}
+% \end{macrocode}
+%\end{macro}
+%\begin{macro}{\BRepistleto}
+% As above but for epistles to
+% someone.
+% \begin{macrocode}
+\newcommand*{\BRepistleto}{}
+% \end{macrocode}
+%\end{macro}
+%\begin{macro}{\BRepistletothe}
+% As above but for epistles to
+% people.
+% \begin{macrocode}
+\newcommand*{\BRepistletothe}{}
+% \end{macrocode}
+%\end{macro}
+%\begin{macro}{\BRepistleof}
+% As above but for \qt{epistles of }
+% \begin{macrocode}
+\newcommand*{\BRepistleof}{}
+% \end{macrocode}
+%\end{macro}
+%
+%\begin{macro}{\BRbooktitlestyle}
+% The style of the
+% book title. By default, it simply displays its argument.
+% \begin{macrocode}
+\newcommand*{\BRbooktitlestyle}[1]{#1}
+% \end{macrocode}
+%\end{macro}
+%\begin{macro}{\BRchapterstyle}
+%
+% The style of the chapter number.
+% By default it simply displays its argument.
+% \begin{macrocode}
+\newcommand*{\BRchapterstyle}[1]{#1}
+% \end{macrocode}
+%\end{macro}
+%\changes{1.17}{2017/06/30}{Add syntaxis to use double numbering of the Psalms}
+% \begin{macro}{\BRchapterstyle}
+% The way the alternate chapter number is shown.
+% By default, in parenthesis.
+% \begin{macrocode}
+\newcommand*{\BRotherchapterstyle}[1]{(#1)}%
+% \end{macrocode}
+% \end{macro}
+%\begin{macro}{\BRversestyle}
+%The style of the verse number.
+% By default is simply displays its argument.
+% \begin{macrocode}
+\newcommand*{\BRversestyle}[1]{#1}
+% \end{macrocode}
+%\end{macro}
+%\begin{macro}{\BRversesuffixstyle}
+%The style of the verse suffix.
+% By default is simply displays its argument.
+% \begin{macrocode}
+\newcommand*{\BRversesuffixstyle}[1]{#1}
+% \end{macrocode}
+%\end{macro}
+%
+%\begin{macro}{\BRbkchsep}
+%The separator between the book title
+% and the chapter number
+% \begin{macrocode}
+\newcommand*{\BRbkchsep}{ }
+% \end{macrocode}
+%\end{macro}
+%\begin{macro}{\BRchvsep}
+% The separator between chapter
+% and verse numbers. By default this is simply a colon.
+% \begin{macrocode}
+\newcommand*{\BRchvsep}{:}
+% \end{macrocode}
+%\end{macro}
+%\begin{macro}{\BRchsep}
+% The separator between multiple chapters.
+% By default this is simply a semi-colon.
+% \begin{macrocode}
+\newcommand*{\BRchsep}{;}
+% \end{macrocode}
+%\end{macro}
+%\begin{macro}{\BRvrsep}
+% The separator between the beginning
+% and ending of a range of verses. By default this
+% is simply an en-dash.
+% \begin{macrocode}
+\newcommand*{\BRvrsep}{--}
+% \end{macrocode}
+%\end{macro}
+%\begin{macro}{\BRvsep}
+%The separator between a list of verses.
+% \begin{macrocode}
+\newcommand*{\BRvsep}{,}
+% \end{macrocode}
+%\end{macro}
+%\begin{macro}{\BRperiod}
+% This can be redefined to put a full stop after
+% book names.
+% \begin{macrocode}
+\newcommand*{\BRperiod}{}
+% \end{macrocode}
+%\end{macro}
+%
+%\begin{macro}{\brfullname}
+% This will switch to using the full book title.
+%\changes{1.08}{2008/05/12}{fixed error in spelling of \cs{br@Jeremiah}}
+% \begin{macrocode}
+\newcommand*{\brfullname}{%
+\def\br@Genesis{\BRbookof Genesis}%
+\def\br@Exodus{\BRbookof Exodus}%
+\def\br@Leviticus{\BRbookof Leviticus}%
+\def\br@Numbers{\BRbookof Numbers}%
+\def\br@Deuteronomy{\BRbookof Deuteronomy}%
+\def\br@Joshua{\BRbookof Joshua}%
+\def\br@Judges{\BRbookof Judges}%
+\def\br@Ruth{\BRbookof Ruth}%
+\def\br@ISamuel{\BRbooknumberstyle{1}\BRbookof Samuel}%
+\def\br@IISamuel{\BRbooknumberstyle{2}\BRbookof Samuel}%
+\def\br@IKings{\BRbooknumberstyle{1}\BRbookof Kings}%
+\def\br@IIKings{\BRbooknumberstyle{2}\BRbookof Kings}%
+\def\br@IChronicles{\BRbooknumberstyle{1}\BRbookof Chronicles}%
+\def\br@IIChronicles{\BRbooknumberstyle{2}\BRbookof Chronicles}%
+\def\br@Ezra{\BRbookof Ezra}%
+\def\br@Nehemiah{\BRbookof Nehemiah}%
+\def\br@Tobit{\BRbookof Tobit}%
+\def\br@Judith{\BRbookof Judith}%
+\def\br@Esther{\BRbookof Esther}%
+\def\br@IMaccabees{\BRbooknumberstyle{1}\BRbookof Maccabees}%
+\def\br@IIMaccabees{\BRbooknumberstyle{2}\BRbookof Maccabees}%
+\def\br@Job{\BRbookof Job}%
+\def\br@Psalms{\BRbookof Psalms}%
+\def\br@Proverbs{\BRbookof Proverbs}%
+\def\br@Ecclesiastes{\BRbookof Ecclesiastes}%
+\def\br@SongofSongs{\BRbookof Song of Songs}%
+\def\br@Wisdom{\BRbookof Wisdom}%
+\def\br@Ecclesiasticus{\BRbookof Ecclesiasticus}%
+\def\br@Isaiah{\BRbookof Isaiah}%
+\def\br@Jeremiah{\BRbookof Jeremiah}%
+\def\br@Lamentations{\BRbookof Lamentations}%
+\def\br@Baruch{\BRbookof Baruch}%
+\def\br@Ezekiel{\BRbookof Ezekiel}%
+\def\br@Daniel{\BRbookof Daniel}%
+\def\br@Hosea{\BRbookof Hosea}%
+\def\br@Joel{\BRbookof Joel}%
+\def\br@Amos{\BRbookof Amos}%
+\def\br@Obadiah{\BRbookof Obadiah}%
+\def\br@Jonah{\BRbookof Jonah}%
+\def\br@Micah{\BRbookof Micah}%
+\def\br@Nahum{\BRbookof Nahum}%
+\def\br@Habakkuk{\BRbookof Habakkuk}%
+\def\br@Zephaniah{\BRbookof Zephaniah}%
+\def\br@Haggai{\BRbookof Haggai}%
+\def\br@Zechariah{\BRbookof Zechariah}%
+\def\br@Malachi{\BRbookof Malachi}%
+\def\br@Matthew{\BRgospel Matthew}%
+\def\br@Mark{\BRgospel Mark}%
+\def\br@Luke{\BRgospel Luke}%
+\def\br@John{\BRgospel John}%
+\def\br@Acts{Acts}%
+\def\br@Romans{\BRepistletothe Romans}%
+\def\br@ICorinthians{\BRepistlenumberstyle{1}\BRepistletothe Corinthians}%
+\def\br@IICorinthians{\BRepistlenumberstyle{2}\BRepistletothe Corinthians}%
+\def\br@Galatians{\BRepistletothe Galatians}%
+\def\br@Ephesians{\BRepistletothe Ephesians}%
+\def\br@Philippians{\BRepistletothe Philippians}%
+\def\br@Colossians{\BRepistletothe Colossians}%
+\def\br@IThessalonians{\BRepistlenumberstyle{1}\BRepistletothe Thessalonians}%
+\def\br@IIThessalonians{\BRepistlenumberstyle{2}\BRepistletothe Thessalonians}%
+\def\br@ITimothy{\BRepistlenumberstyle{1}\BRepistleto Timothy}%
+\def\br@IITimothy{\BRepistlenumberstyle{2}\BRepistleto Timothy}%
+\def\br@Titus{\BRepistleto Titus}%
+\def\br@Philemon{\BRepistleto Philemon}%
+\def\br@Hebrews{\BRepistletothe Hebrews}%
+\def\br@James{\BRepistleof James}%
+\def\br@IPeter{\BRepistlenumberstyle{1}\BRepistleof Peter}%
+\def\br@IIPeter{\BRepistlenumberstyle{2}\BRepistleof Peter}%
+\def\br@IJohn{\BRepistlenumberstyle{1}\BRepistleof John}%
+\def\br@IIJohn{\BRepistlenumberstyle{2}\BRepistleof John}%
+\def\br@IIIJohn{\BRepistlenumberstyle{3}\BRepistleof John}%
+\def\br@Jude{\BRepistleof Jude}%
+\def\br@Revelation{\BRbookof Revelation}}
+% \end{macrocode}
+%\end{macro}
+% Set full names as the default
+% \begin{macrocode}
+\brfullname
+% \end{macrocode}
+%
+%\begin{macro}{\brabbrvname}
+% This will switch to an abbreviated form for the book titles.
+% \begin{macrocode}
+\newcommand*{\brabbrvname}{%
+\def\br@Genesis{Gn\BRperiod}%
+\def\br@Exodus{Ex\BRperiod}%
+\def\br@Leviticus{Lv\BRperiod}%
+\def\br@Numbers{Nb\BRperiod}%
+\def\br@Deuteronomy{Dt\BRperiod}%
+\def\br@Joshua{Jos\BRperiod}%
+\def\br@Judges{Jg\BRperiod}%
+\def\br@Ruth{Rt\BRperiod}%
+\def\br@ISamuel{\BRbooknumberstyle{1}S\BRperiod}%
+\def\br@IISamuel{\BRbooknumberstyle{2}S\BRperiod}%
+\def\br@IKings{\BRbooknumberstyle{1}K\BRperiod}%
+\def\br@IIKings{\BRbooknumberstyle{2}K\BRperiod}%
+\def\br@IChronicles{\BRbooknumberstyle{1}Ch\BRperiod}%
+\def\br@IIChronicles{\BRbooknumberstyle{2}Ch\BRperiod}%
+\def\br@Ezra{Ezr\BRperiod}%
+\def\br@Nehemiah{Ne\BRperiod}%
+\def\br@Tobit{Tb\BRperiod}%
+\def\br@Judith{Jdt\BRperiod}%
+\def\br@Esther{Est\BRperiod}%
+\def\br@IMaccabees{\BRbooknumberstyle{1}M\BRperiod}%
+\def\br@IIMaccabees{\BRbooknumberstyle{2}M\BRperiod}%
+\def\br@Job{Jb\BRperiod}%
+\def\br@Psalms{Ps\BRperiod}%
+\def\br@Proverbs{Pr\BRperiod}%
+\def\br@Ecclesiastes{Qo\BRperiod}%
+\def\br@SongofSongs{Sg\BRperiod}%
+\def\br@Wisdom{Ws\BRperiod}%
+\def\br@Ecclesiasticus{Si\BRperiod}%
+\def\br@Isaiah{Is\BRperiod}%
+\def\br@Jeremiah{Jr\BRperiod}%
+\def\br@Lamentations{Lm\BRperiod}%
+\def\br@Baruch{Ba\BRperiod}%
+\def\br@Ezekiel{Ezk\BRperiod}%
+\def\br@Daniel{Dn\BRperiod}%
+\def\br@Hosea{Ho\BRperiod}%
+\def\br@Joel{Jl\BRperiod}%
+\def\br@Amos{Am\BRperiod}%
+\def\br@Obadiah{Ob\BRperiod}%
+\def\br@Jonah{Jon\BRperiod}%
+\def\br@Micah{Mi\BRperiod}%
+\def\br@Nahum{Na\BRperiod}%
+\def\br@Habakkuk{Hab\BRperiod}%
+\def\br@Zephaniah{Zp\BRperiod}%
+\def\br@Haggai{Hg\BRperiod}%
+\def\br@Zechariah{Zc\BRperiod}%
+\def\br@Malachi{Ml\BRperiod}%
+\def\br@Matthew{Mt\BRperiod}%
+\def\br@Mark{Mk\BRperiod}%
+\def\br@Luke{Lk\BRperiod}%
+\def\br@John{Jn\BRperiod}%
+\def\br@Acts{Ac\BRperiod}%
+\def\br@Romans{Rm\BRperiod}%
+\def\br@ICorinthians{\BRepistlenumberstyle{1}Co\BRperiod}%
+\def\br@IICorinthians{\BRepistlenumberstyle{2}Co\BRperiod}%
+\def\br@Galatians{Ga\BRperiod}%
+\def\br@Ephesians{Ep\BRperiod}%
+\def\br@Philippians{Ph\BRperiod}%
+\def\br@Colossians{Col\BRperiod}%
+\def\br@IThessalonians{\BRepistlenumberstyle{1}Th\BRperiod}%
+\def\br@IIThessalonians{\BRepistlenumberstyle{2}Th\BRperiod}%
+\def\br@ITimothy{\BRepistlenumberstyle{1}Tm\BRperiod}%
+\def\br@IITimothy{\BRepistlenumberstyle{2}Tm\BRperiod}%
+\def\br@Titus{Tt\BRperiod}%
+\def\br@Philemon{Phm\BRperiod}%
+\def\br@Hebrews{Heb\BRperiod}%
+\def\br@James{Jm\BRperiod}%
+\def\br@IPeter{\BRepistlenumberstyle{1}P\BRperiod}%
+\def\br@IIPeter{\BRepistlenumberstyle{2}P\BRperiod}%
+\def\br@IJohn{\BRepistlenumberstyle{1}Jn\BRperiod}%
+\def\br@IIJohn{\BRepistlenumberstyle{2}Jn\BRperiod}%
+\def\br@IIIJohn{\BRepistlenumberstyle{3}Jn\BRperiod}%
+\def\br@Jude{Jude}%
+\def\br@Revelation{Rv\BRperiod}}
+% \end{macrocode}
+%\end{macro}
+%
+%\begin{macro}{\braltabbrvname}
+% This switches to an alternative set of abbreviations.
+% \begin{macrocode}
+\newcommand*{\braltabbrvname}{%
+\def\br@Genesis{Gen\BRperiod}%
+\def\br@Exodus{Exod\BRperiod}%
+\def\br@Leviticus{Lev\BRperiod}%
+\def\br@Numbers{Num\BRperiod}%
+\def\br@Deuteronomy{Deut\BRperiod}%
+\def\br@Joshua{Josh\BRperiod}%
+\def\br@Judges{Judg\BRperiod}%
+\def\br@Ruth{Ruth}%
+\def\br@ISamuel{\BRbooknumberstyle{1}Sam\BRperiod}%
+\def\br@IISamuel{\BRbooknumberstyle{2}Sam\BRperiod}%
+\def\br@IKings{\BRbooknumberstyle{1}Kgs\BRperiod}%
+\def\br@IIKings{\BRbooknumberstyle{2}Kgs\BRperiod}%
+\def\br@IChronicles{\BRbooknumberstyle{1}Chr\BRperiod}%
+\def\br@IIChronicles{\BRbooknumberstyle{2}Chr\BRperiod}%
+\def\br@Ezra{Ezra}%
+\def\br@Nehemiah{Neh\BRperiod}%
+\def\br@Tobit{Tobit}%
+\def\br@Judith{Judith}%
+\def\br@Esther{Esther}%
+\def\br@IMaccabees{\BRbooknumberstyle{1}M\BRperiod}%
+\def\br@IIMaccabees{\BRbooknumberstyle{2}M\BRperiod}%
+\def\br@Job{Job}%
+\def\br@Psalms{Ps\BRperiod}%
+\def\br@Proverbs{Prov\BRperiod}%
+\def\br@Ecclesiastes{Eccles\BRperiod}%
+\def\br@SongofSongs{S\BRperiod\ of S\BRperiod}%
+\def\br@Wisdom{Wisd\BRperiod}%
+\def\br@Ecclesiasticus{Ecclus\BRperiod}%
+\def\br@Isaiah{Isa\BRperiod}%
+\def\br@Jeremiah{Jer\BRperiod}%
+\def\br@Lamentations{Lam\BRperiod}%
+\def\br@Baruch{Baruch}%
+\def\br@Ezekiel{Ezek\BRperiod}%
+\def\br@Daniel{Dan\BRperiod}%
+\def\br@Hosea{Hos\BRperiod}%
+\def\br@Joel{Joel}%
+\def\br@Amos{Amos}%
+\def\br@Obadiah{Obad}%
+\def\br@Jonah{Jonah}%
+\def\br@Micah{Mic\BRperiod}%
+\def\br@Nahum{Nah\BRperiod}%
+\def\br@Habakkuk{Hab\BRperiod}%
+\def\br@Zephaniah{Zeph\BRperiod}%
+\def\br@Haggai{Hag\BRperiod}%
+\def\br@Zechariah{Zech\BRperiod}%
+\def\br@Malachi{Mal\BRperiod}%
+\def\br@Matthew{Matt\BRperiod}%
+\def\br@Mark{Mark}%
+\def\br@Luke{Luke}%
+\def\br@John{John}%
+\def\br@Acts{Acts}%
+\def\br@Romans{Rom\BRperiod}%
+\def\br@ICorinthians{\BRepistlenumberstyle{1}Cor\BRperiod}%
+\def\br@IICorinthians{\BRepistlenumberstyle{2}Cor\BRperiod}%
+\def\br@Galatians{Gal\BRperiod}%
+\def\br@Ephesians{Eph\BRperiod}%
+\def\br@Philippians{Phil\BRperiod}%
+\def\br@Colossians{Col\BRperiod}%
+\def\br@IThessalonians{\BRepistlenumberstyle{1}Thess\BRperiod}%
+\def\br@IIThessalonians{\BRepistlenumberstyle{2}Thess\BRperiod}%
+\def\br@ITimothy{\BRepistlenumberstyle{1}Tim\BRperiod}%
+\def\br@IITimothy{\BRepistlenumberstyle{2}Tim\BRperiod}%
+\def\br@Titus{Tit\BRperiod}%
+\def\br@Philemon{Philem\BRperiod}%
+\def\br@Hebrews{Heb\BRperiod}%
+\def\br@James{Jas\BRperiod}%
+\def\br@IPeter{\BRepistlenumberstyle{1}Pet\BRperiod}%
+\def\br@IIPeter{\BRepistlenumberstyle{2}Pet\BRperiod}%
+\def\br@IJohn{\BRepistlenumberstyle{1}John}%
+\def\br@IIJohn{\BRepistlenumberstyle{2}John}%
+\def\br@IIIJohn{\BRepistlenumberstyle{3}John}%
+\def\br@Jude{Jude}%
+\def\br@Revelation{Rev\BRperiod}}
+% \end{macrocode}
+%\end{macro}
+% Provide synonymns.
+% \begin{macrocode}
+\newcommand*\br@Gn{\br@Genesis}%
+\newcommand*\br@Ex{\br@Exodus}%
+\newcommand*\br@Lv{\br@Leviticus}%
+\newcommand*\br@Nb{\br@Numbers}%
+\newcommand*\br@Dt{\br@Deuteronomy}%
+\newcommand*\br@Jos{\br@Joshua}%
+\newcommand*\br@Jg{\br@Judges}%
+\newcommand*\br@Rt{\br@Ruth}%
+\newcommand*\br@IS{\br@ISamuel}%
+\newcommand*\br@IIS{\br@IISamuel}%
+\newcommand*\br@IK{\br@IKings}%
+\newcommand*\br@IIK{\br@IIKings}%
+\newcommand*\br@ICh{\br@IChronicles}%
+\newcommand*\br@IICh{\br@IIChronicles}%
+\newcommand*\br@Ezr{\br@Ezra}%
+\newcommand*\br@Ne{\br@Nehemiah}%
+\newcommand*\br@Tb{\br@Tobit}%
+\newcommand*\br@Jdt{\br@Judith}%
+\newcommand*\br@Est{\br@Esther}%
+\newcommand*\br@IM{\br@IMaccabees}%
+\newcommand*\br@IIM{\br@IIMaccabees}%
+\newcommand*\br@Jb{\br@Job}%
+\newcommand*\br@Ps{\br@Psalms}%
+\newcommand*\br@Pr{\br@Proverbs}%
+\newcommand*\br@Qo{\br@Ecclesiastes}%
+\newcommand*\br@Sg{\br@SongofSongs}%
+\newcommand*\br@Ws{\br@Wisdom}%
+\newcommand*\br@Si{\br@Ecclesiasticus}%
+\newcommand*\br@Is{\br@Isaiah}%
+\newcommand*\br@Jr{\br@Jeremiah}%
+\newcommand*\br@Lm{\br@Lamentations}%
+\newcommand*\br@Ba{\br@Baruch}%
+\newcommand*\br@Bar{\br@Baruch}%
+\newcommand*\br@Ezk{\br@Ezekiel}%
+\newcommand*\br@Dn{\br@Daniel}%
+\newcommand*\br@Ho{\br@Hosea}%
+\newcommand*\br@Jl{\br@Joel}%
+\newcommand*\br@Am{\br@Amos}%
+\newcommand*\br@Ob{\br@Obadiah}%
+\newcommand*\br@Jon{\br@Jonah}%
+\newcommand*\br@Mi{\br@Micah}%
+\newcommand*\br@Na{\br@Nahum}%
+\newcommand*\br@Hab{\br@Habakkuk}%
+\newcommand*\br@Zp{\br@Zephaniah}%
+\newcommand*\br@Hg{\br@Haggai}%
+\newcommand*\br@Zc{\br@Zechariah}%
+\newcommand*\br@Ml{\br@Malachi}%
+\newcommand*\br@Mt{\br@Matthew}%
+\newcommand*\br@Mk{\br@Mark}%
+\newcommand*\br@Lk{\br@Luke}%
+\newcommand*\br@Jn{\br@John}%
+\newcommand*\br@Ac{\br@Acts}%
+\newcommand*\br@Rm{\br@Romans}%
+\newcommand*\br@ICo{\br@ICorinthians}%
+\newcommand*\br@IICo{\br@IICorinthians}%
+\newcommand*\br@Ga{\br@Galatians}%
+\newcommand*\br@Ep{\br@Ephesians}%
+\newcommand*\br@Ph{\br@Philippians}%
+\newcommand*\br@Col{\br@Colossians}%
+\newcommand*\br@ITh{\br@IThessalonians}%
+\newcommand*\br@IITh{\br@IIThessalonians}%
+\newcommand*\br@ITm{\br@ITimothy}%
+\newcommand*\br@IITm{\br@IITimothy}%
+\newcommand*\br@Tt{\br@Titus}%
+\newcommand*\br@Phm{\br@Philemon}%
+\newcommand*\br@Heb{\br@Hebrews}%
+\newcommand*\br@Jm{\br@James}%
+\newcommand*\br@IP{\br@IPeter}%
+\newcommand*\br@IIP{\br@IIPeter}%
+\newcommand*\br@IJn{\br@IJohn}%
+\newcommand*\br@IIJn{\br@IIJohn}%
+\newcommand*\br@Rv{\br@Revelation}
+% \end{macrocode}
+% More synonyms.
+%\changes{1.21}{2018/11/17}{Add Wis abbreviation}
+%\changes{1.22}{2018/12/05}{Add Bar abbreviation}
+%\changes{1.23}{2019/01/13}{Add Ti abbreviation}
+% \begin{macrocode}
+\newcommand*\br@Gen{\br@Genesis}%
+\newcommand*\br@Exod{\br@Exodus}%
+\newcommand*\br@Lev{\br@Leviticus}%
+\newcommand*\br@Num{\br@Numbers}%
+\newcommand*\br@Deut{\br@Deuteronomy}%
+\newcommand*\br@Josh{\br@Joshua}%
+\newcommand*\br@Judg{\br@Judges}%
+\newcommand*\br@ISam{\br@ISamuel}%
+\newcommand*\br@IISam{\br@IISamuel}%
+\newcommand*\br@IKgs{\br@IKings}%
+\newcommand*\br@IIKgs{\br@IIKings}%
+\newcommand*\br@IChr{\br@IChronicles}%
+\newcommand*\br@IIChr{\br@IIChronicles}%
+\newcommand*\br@Neh{\br@Nehemiah}%
+\newcommand*\br@Esth{\br@Esther}%
+\newcommand*\br@IMacc{\br@IMaccabees}%
+\newcommand*\br@IIMacc{\br@IIMaccabees}%
+\newcommand*\br@Prov{\br@Proverbs}%
+\newcommand*\br@Eccl{\br@Ecclesiastes}%
+\newcommand*\br@SofS{\br@SongofSongs}%
+\newcommand*\br@Wis{\br@Wisdom}%
+\newcommand*\br@Wisd{\br@Wisdom}%
+\newcommand*\br@Ecclus{\br@Ecclesiasticus}%
+\newcommand*\br@Isa{\br@Isaiah}%
+\newcommand*\br@Jer{\br@Jeremiah}%
+\newcommand*\br@Lam{\br@Lamentations}%
+\newcommand*\br@Ezek{\br@Ezekiel}%
+\newcommand*\br@Dan{\br@Daniel}%
+\newcommand*\br@Hos{\br@Hosea}%
+\newcommand*\br@Obad{\br@Obadiah}%
+\newcommand*\br@Mic{\br@Micah}%
+\newcommand*\br@Nah{\br@Nahum}%
+\newcommand*\br@Zeph{\br@Zephaniah}%
+\newcommand*\br@Hag{\br@Haggai}%
+\newcommand*\br@Zech{\br@Zechariah}%
+\newcommand*\br@Mal{\br@Malachi}%
+\newcommand*\br@Matt{\br@Matthew}%
+\newcommand*\br@Rom{\br@Romans}%
+\newcommand*\br@ICor{\br@ICorinthians}%
+\newcommand*\br@IICor{\br@IICorinthians}%
+\newcommand*\br@Gal{\br@Galatians}%
+\newcommand*\br@Eph{\br@Ephesians}%
+\newcommand*\br@Phil{\br@Philippians}%
+\newcommand*\br@IThess{\br@IThessalonians}%
+\newcommand*\br@IIThess{\br@IIThessalonians}%
+\newcommand*\br@ITim{\br@ITimothy}%
+\newcommand*\br@IITim{\br@IITimothy}%
+\newcommand*\br@Tit{\br@Titus}%
+\newcommand*\br@Ti{\br@Titus}%
+\newcommand*\br@Philem{\br@Philemon}%
+\newcommand*\br@Jas{\br@James}%
+\newcommand*\br@IPet{\br@IPeter}%
+\newcommand*\br@IIPet{\br@IIPeter}%
+\newcommand*\br@Rev{\br@Revelation}
+% \end{macrocode}
+%\begin{macro}{\brs@default}
+% Set up assorted styles. All bible reference styles
+% should start with \verb|brs@|. First the default
+% style.
+% \begin{macrocode}
+\newcommand*{\brs@default}{%
+\brfullname
+\renewcommand*{\BRbooknumberstyle}[1]{##1 }%
+\renewcommand*{\BRepistlenumberstyle}[1]{##1 }%
+\renewcommand*{\BRbooktitlestyle}[1]{##1}%
+\renewcommand*{\BRchapterstyle}[1]{##1}%
+\renewcommand*{\BRversestyle}[1]{##1}%
+\renewcommand*{\BRversesuffixstyle}[1]{##1}%
+\renewcommand*{\BRbookof}{}%
+\renewcommand*{\BRgospel}{}%
+\renewcommand*{\BRepistletothe}{}%
+\renewcommand*{\BRepistleto}{}%
+\renewcommand*{\BRepistleof}{}%
+\renewcommand*{\BRbkchsep}{ }%
+\renewcommand*{\BRchvsep}{:}%
+\renewcommand*{\BRchsep}{;}%
+\renewcommand*{\BRvrsep}{--}%
+\renewcommand*{\BRvsep}{,}%
+\renewcommand*{\BRperiod}{}}
+% \end{macrocode}
+%\end{macro}
+%\begin{macro}{\brs@jerusalem}
+% The style used by the Jerusalem Bible.
+% \begin{macrocode}
+\newcommand*{\brs@jerusalem}{%
+\brabbrvname
+\renewcommand*{\BRbooknumberstyle}[1]{##1 }%
+\renewcommand*{\BRepistlenumberstyle}[1]{##1 }%
+\renewcommand*{\BRbooktitlestyle}[1]{##1}%
+\renewcommand*{\BRchapterstyle}[1]{##1}%
+\renewcommand*{\BRversestyle}[1]{##1}%
+\renewcommand*{\BRversesuffixstyle}[1]{##1}%
+\renewcommand*{\BRbookof}{}%
+\renewcommand*{\BRgospel}{}%
+\renewcommand*{\BRepistletothe}{}%
+\renewcommand*{\BRepistleto}{}%
+\renewcommand*{\BRepistleof}{}%
+\renewcommand*{\BRbkchsep}{ }
+\renewcommand*{\BRchvsep}{:}%
+\renewcommand*{\BRchsep}{; }%
+\renewcommand*{\BRvrsep}{--}%
+\renewcommand*{\BRvsep}{,}%
+\renewcommand*{\BRperiod}{}%
+}
+% \end{macrocode}
+%\end{macro}
+%\begin{macro}{\brs@anglosaxon}
+% Anglo-Saxon style.
+% \begin{macrocode}
+\newcommand*{\brs@anglosaxon}{%
+\braltabbrvname
+\renewcommand*{\BRbooknumberstyle}[1]{\MakeUppercase{\romannumeral##1} }%
+\renewcommand*{\BRepistlenumberstyle}[1]{\MakeUppercase{\romannumeral##1} }%
+\renewcommand*{\BRbooktitlestyle}[1]{##1}%
+\renewcommand*{\BRchapterstyle}[1]{\MakeUppercase{\romannumeral##1}}%
+\renewcommand*{\BRversestyle}[1]{##1}%
+\renewcommand*{\BRversesuffixstyle}[1]{##1}%
+\renewcommand*{\BRbookof}{}%
+\renewcommand*{\BRgospel}{}%
+\renewcommand*{\BRepistletothe}{}%
+\renewcommand*{\BRepistleto}{}%
+\renewcommand*{\BRepistleof}{}%
+\renewcommand*{\BRbkchsep}{ }
+\renewcommand*{\BRchvsep}{.}%
+\renewcommand*{\BRchsep}{; }%
+\renewcommand*{\BRvrsep}{--}%
+\renewcommand*{\BRvsep}{,}%
+\renewcommand*{\BRperiod}{.}%
+}
+% \end{macrocode}
+%\end{macro}
+%\begin{macro}{\brs@JEH}
+%Journal of Ecclesiastical History
+% \begin{macrocode}
+\newcommand*{\brs@JEH}{%
+\braltabbrvname
+\renewcommand*{\BRbooknumberstyle}[1]{##1 }%
+\renewcommand*{\BRepistlenumberstyle}[1]{##1 }%
+\renewcommand*{\BRbooktitlestyle}[1]{##1}%
+\renewcommand*{\BRchapterstyle}[1]{\romannumeral##1}%
+\renewcommand*{\BRversestyle}[1]{##1}%
+\renewcommand*{\BRversesuffixstyle}[1]{##1}%
+\renewcommand*{\BRbookof}{}%
+\renewcommand*{\BRgospel}{}%
+\renewcommand*{\BRepistletothe}{}%
+\renewcommand*{\BRepistleto}{}%
+\renewcommand*{\BRepistleof}{}%
+\renewcommand*{\BRbkchsep}{ }
+\renewcommand*{\BRchvsep}{. }%
+\renewcommand*{\BRchsep}{; }%
+\renewcommand*{\BRvrsep}{--}%
+\renewcommand*{\BRvsep}{,}%
+\renewcommand*{\BRperiod}{.}%
+}
+% \end{macrocode}
+%\end{macro}
+%\begin{macro}{\brs@MHRA}
+%Modern Humanities Research Association (MHRA)
+% \begin{macrocode}
+\newcommand*{\brs@MHRA}{%
+\brfullname
+\renewcommand*{\BRbooknumberstyle}[1]{\textsc{\romannumeral##1} }%
+\renewcommand*{\BRepistlenumberstyle}[1]{\textsc{\romannumeral##1} }%
+\renewcommand*{\BRbooktitlestyle}[1]{##1}%
+\renewcommand*{\BRchapterstyle}[1]{\romannumeral##1}%
+\renewcommand*{\BRversestyle}[1]{##1}%
+\renewcommand*{\BRversesuffixstyle}[1]{##1}%
+\renewcommand*{\BRbookof}{}%
+\renewcommand*{\BRgospel}{}%
+\renewcommand*{\BRepistletothe}{}%
+\renewcommand*{\BRepistleto}{}%
+\renewcommand*{\BRepistleof}{}%
+\renewcommand*{\BRbkchsep}{ }
+\renewcommand*{\BRchvsep}{. }%
+\renewcommand*{\BRchsep}{; }%
+\renewcommand*{\BRvrsep}{--}%
+\renewcommand*{\BRvsep}{,}%
+\renewcommand*{\BRperiod}{}%
+}
+% \end{macrocode}
+%\end{macro}
+%\begin{macro}{\brs@NTG}
+%Novum Testamentum Graece (Nestle-Aland)
+% \begin{macrocode}
+\newcommand*{\brs@NTG}{%
+\braltabbrvname
+\renewcommand*{\BRbooknumberstyle}[1]{##1 }%
+\renewcommand*{\BRepistlenumberstyle}[1]{##1 }%
+\renewcommand*{\BRbooktitlestyle}[1]{##1}%
+\renewcommand*{\BRchapterstyle}[1]{\romannumeral##1}%
+\renewcommand*{\BRversestyle}[1]{##1}%
+\renewcommand*{\BRversesuffixstyle}[1]{##1}%
+\renewcommand*{\BRbookof}{}%
+\renewcommand*{\BRgospel}{}%
+\renewcommand*{\BRepistletothe}{}%
+\renewcommand*{\BRepistleto}{}%
+\renewcommand*{\BRepistleof}{}%
+\renewcommand*{\BRbkchsep}{ }
+\renewcommand*{\BRchvsep}{,}%
+\renewcommand*{\BRchsep}{; }%
+\renewcommand*{\BRvrsep}{--}%
+\renewcommand*{\BRvsep}{,}%
+\renewcommand*{\BRperiod}{}%
+}
+% \end{macrocode}
+%\end{macro}
+%\begin{macro}{\brs@MLA}
+%MLA Style
+% \begin{macrocode}
+\newcommand*{\brs@MLA}{%
+\braltabbrvname
+\renewcommand*{\BRbooknumberstyle}[1]{##1 }%
+\renewcommand*{\BRepistlenumberstyle}[1]{##1 }%
+\renewcommand*{\BRbooktitlestyle}[1]{##1}%
+\renewcommand*{\BRchapterstyle}[1]{\romannumeral##1}%
+\renewcommand*{\BRversestyle}[1]{##1}%
+\renewcommand*{\BRversesuffixstyle}[1]{##1}%
+\renewcommand*{\BRbookof}{}%
+\renewcommand*{\BRgospel}{}%
+\renewcommand*{\BRepistletothe}{}%
+\renewcommand*{\BRepistleto}{}%
+\renewcommand*{\BRepistleof}{}%
+\renewcommand*{\BRbkchsep}{\ }
+\renewcommand*{\BRchvsep}{.}%
+\renewcommand*{\BRchsep}{; }%
+\renewcommand*{\BRvrsep}{--}%
+\renewcommand*{\BRvsep}{,}%
+\renewcommand*{\BRperiod}{.}%
+}
+% \end{macrocode}
+%\end{macro}
+%\begin{macro}{\brs@chicago}
+%Chicago Style
+% \begin{macrocode}
+\newcommand*{\brs@chicago}{%
+\braltabbrvname
+\renewcommand*{\BRbooknumberstyle}[1]{##1 }%
+\renewcommand*{\BRepistlenumberstyle}[1]{##1 }%
+\renewcommand*{\BRbooktitlestyle}[1]{##1}%
+\renewcommand*{\BRchapterstyle}[1]{\romannumeral##1}%
+\renewcommand*{\BRversestyle}[1]{##1}%
+\renewcommand*{\BRversesuffixstyle}[1]{##1}%
+\renewcommand*{\BRbookof}{}%
+\renewcommand*{\BRgospel}{}%
+\renewcommand*{\BRepistletothe}{}%
+\renewcommand*{\BRepistleto}{}%
+\renewcommand*{\BRepistleof}{}%
+\renewcommand*{\BRbkchsep}{\ }
+\renewcommand*{\BRchvsep}{\,:\,}%
+\renewcommand*{\BRchsep}{; }%
+\renewcommand*{\BRvrsep}{--}%
+\renewcommand*{\BRvsep}{,}%
+\renewcommand*{\BRperiod}{.}%
+}
+% \end{macrocode}
+%\end{macro}
+%\begin{macro}{\brs@text}
+% Full text citation
+% \begin{macrocode}
+\newcommand*{\brs@text}{%
+\biblerefstyle{default}%
+\renewcommand{\BRbooknumberstyle}[1]{%
+\protect\Ordinalstringnum{##1}\ }%
+\renewcommand{\BRepistlenumberstyle}[1]{%
+\protect\Ordinalstringnum{##1}\ }%
+\renewcommand{\BRbookof}{Book of }%
+\renewcommand{\BRgospel}{Gospel according to St }%
+\renewcommand{\BRepistletothe}{Epistle to the }%
+\renewcommand{\BRepistleto}{Epistle to }%
+\renewcommand{\BRepistleof}{Epistle of }%
+\renewcommand{\BRchapterstyle}[1]{%
+chapter \protect\numberstringnum{##1}}%
+\renewcommand{\BRbkchsep}{, }%
+\renewcommand{\BRchvsep}{ verse }%
+\renewcommand{\BRchsep}{, }%
+\renewcommand{\BRvrsep}{ to }%
+\renewcommand{\BRvsep}{, }%
+\renewcommand{\BRversestyle}[1]{\protect\numberstringnum{##1}}%
+\renewcommand*{\BRversesuffixstyle}[1]{##1}%
+}
+% \end{macrocode}
+%\end{macro}
+% Declare package options
+% \begin{macrocode}
+\DeclareOption{default}{\brs@default}
+\DeclareOption{jerusalem}{\brs@jerusalem}
+\DeclareOption{anglosaxon}{\brs@anglosaxon}
+\DeclareOption{JEH}{\brs@JEH}
+\DeclareOption{MHRA}{\brs@MHRA}
+\DeclareOption{NTG}{\brs@NTG}
+\DeclareOption{MLA}{\brs@MLA}
+\DeclareOption{chicago}{\brs@chicago}
+\DeclareOption{text}{\brs@text}
+% \end{macrocode}
+% Process package options
+% \begin{macrocode}
+\ProcessOptions
+% \end{macrocode}
+%
+%\begin{macro}{\newbiblerefstyle}
+%\begin{definition}
+%\cs{newbiblerefstyle}\marg{style name}\marg{style cmds}
+%\end{definition}
+% Creates a new bible style called \meta{style name}, where
+% the style is given by \meta{style cmds}.
+% (It basically defines a command called
+% \cs{brs@}\meta{style name} to do \meta{style cmds})
+% \begin{macrocode}
+\newcommand{\newbiblerefstyle}[2]{%
+\@ifundefined{brs@#1}{%
+\expandafter\def\csname brs@#1\endcsname{#2}}{%
+\PackageError{bibleref}{bible ref style '#1' already
+defined}{}}}
+% \end{macrocode}
+%\end{macro}
+%
+%\begin{macro}{\setbooktitle}
+%\changes{v1.18}{2018/07/21}{Fix bug in indexing with title containing unicode character using a non-native unicode engine.}
+%\begin{definition}
+%\cs{setbooktitle}\marg{fullname}\marg{title}
+%\end{definition}
+% Redefines the title of book \meta{fullname}.
+% \begin{macrocode}
+\newcommand*{\setbooktitle}[2]{%
+ \@ifundefined{br@#1}%
+ {%
+ \PackageError{bibleref}{Unknown book `#1'}{}%
+ }%
+ {%
+ \expandafter\def\csname br@#1\endcsname{#2}%
+ }%
+}
+% \end{macrocode}
+%\end{macro}
+%
+%\begin{macro}{\setindexbooktitle}
+% Set alternative book title in the index
+%\changes{1.10}{2010/04/27}{new}
+% \begin{macrocode}
+\newcommand*{\setindexbooktitle}[2]{%
+ \@ifundefined{br@#1}%
+ {%
+ \PackageError{bibleref}{Unknown book `#1'}{}%
+ }%
+ {%
+ \expandafter\def\csname bri@#1\endcsname{#2}%
+ }%
+}
+% \end{macrocode}
+%\end{macro}
+%
+%\begin{macro}{\addbiblebook}
+%\changes{1.09}{2010/04/26}{new}
+% Add a book.
+% \begin{macrocode}
+\newcommand*{\addbiblebook}[2]{%
+ \@ifundefined{br@#1}%
+ {%
+ \expandafter\def\csname br@#1\endcsname{#2}%
+ }%
+ {%
+ \PackageError{bibleref}{Book `#1' already defined}{}%
+ }%
+}
+% \end{macrocode}
+%\end{macro}
+%
+%\begin{macro}{\biblerefstyle}
+%\begin{definition}
+%\cs{biblerefstyle}\marg{style}
+%\end{definition}
+% Sets the current style.
+% \begin{macrocode}
+\newcommand*{\biblerefstyle}[1]{%
+ \@ifundefined{brs@#1}%
+ {%
+ \PackageError{bibleref}{Unknown biblerefstyle '#1'}{}%
+ }%
+ {\csname brs@#1\endcsname}%
+}
+% \end{macrocode}
+%\end{macro}
+%
+%\begin{macro}{\@br@chsty}
+%\changes{1.14}{2011/01/19}{new}
+% Chapters may be supplied as a range. Provide a command
+% to detect whether single number or range supplied.
+% \begin{macrocode}
+\newcommand*{\@br@chsty}[1]{\@@br@chsty#1-\@nil\end}
+% \end{macrocode}
+%\end{macro}
+%\begin{macro}{\@@br@chsty}
+% Pick up a range
+% \begin{macrocode}
+\def\@@br@chsty#1-#2\end{%
+\@do@chapters#1,\relax\end
+\ifx\@nil#2\relax
+\else
+ \@bv@addtochidxsort{-}%
+ \@bv@do{\protect\BRvrsep}%
+ \@@br@chsty#2\end%
+\fi
+}
+% \end{macrocode}
+%\end{macro}
+%
+%\begin{macro}{\@dochapters}
+% Pick up a list
+% \begin{macrocode}
+\def\@do@chapters#1,#2\end{%
+\def\@br@tmp{#1}%
+\ifx\@br@tmp\@empty
+\else
+ \@biblech{#1}%
+\fi
+\ifx\relax#2\relax
+\else
+ \@bv@addtochidxsort{,}%
+ \@bv@do{\protect\BRvsep}%
+ \@do@chapters#2\end
+\fi
+}
+% \end{macrocode}
+%\end{macro}
+%
+%
+%\begin{macro}{\@biblech}
+%\changes{1.14}{2011/01/19}{new}
+% Deal with individual chapter.
+% \begin{macrocode}
+\newcommand*{\@biblech}[1]{%
+ \def\@bv@tmp{#1}%
+ \ifx\@bv@tmp\@empty
+ \else
+ \@nodo@chapter{#1}%
+ \@bv@do{\protect\BRchapterstyle{#1}}%
+ \fi
+}
+% \end{macrocode}
+%\end{macro}
+%
+%\begin{macro}{\@nodo@chapter}
+%\changes{1.14}{2011/01/19}{new}
+% \begin{macrocode}
+\newcommand*{\@nodo@chapter}[1]{%
+ \ifnum\@bv@tmp<10\relax
+ \@bv@addtochidxsort{00#1:}%
+ \else
+ \ifnum\@bv@tmp<100\relax
+ \@bv@addtochidxsort{0#1:}%
+ \else
+ \@bv@addtochidxsort{#1:}%
+ \fi
+ \fi
+}
+% \end{macrocode}
+%\end{macro}
+%
+%\begin{macro}{\@br@vrsty}
+% Verses may be supplied as a range. Provide a command
+% to detect whether single number or range supplied.
+% Verses may have a number appended (e.g.\ 15a). This needs
+% to be checked.
+%\changes{1.12}{2010/05/11}{Check for letters after verse number}
+% \begin{macrocode}
+\newcommand*{\@br@vrsty}[1]{\@@br@vrsty#1-\@nil\end}
+% \end{macrocode}
+%\end{macro}
+%\begin{macro}{\@@br@vrsty}
+% Pick up a range
+% \begin{macrocode}
+\def\@@br@vrsty#1-#2\end{%
+\@do@verses#1,\relax\end
+\ifx\@nil#2\relax
+\else
+ \@bv@addtochidxsort{-}%
+ \@bv@do{\protect\BRvrsep}%
+ \@@br@vrsty#2\end%
+\fi
+}
+% \end{macrocode}
+%\end{macro}
+%
+%\begin{macro}{\@br@stripverse}
+% Strip trailing letters from verse. Number is stored in
+% \cs{@br@versenum} and the suffix is stored in
+% \cs{@br@versesuffix}.
+% \begin{macrocode}
+\def\br@stripverse#1{%
+ \def\@br@versenum{}%
+ \def\@br@versesuffix{}%
+ \@br@stripverse#1\relax
+}
+\def\@br@stripverse#1#2{%
+ \@br@checkisdigit{#1}%
+ \if@br@isdigit
+ \expandafter\toks@\expandafter{\@br@versenum}%
+ \edef\@br@versenum{\the\toks@#1}%
+ \let\@br@next\@br@stripverse
+ \else
+ \def\@br@versesuffix{#1}%
+ \let\@br@next\@@br@stripverse
+ \fi
+ \ifx#2\relax
+ \let\@br@next\relax
+ \fi
+ \@br@next#2%
+}
+\def\@@br@stripverse#1\relax{%
+ \protected@edef\@br@versesuffix{\@br@versesuffix#1}%
+}
+% \end{macrocode}
+%\end{macro}
+%
+%\begin{macro}{\@br@checkisdigit}
+% Check if argument is a digit.
+% \begin{macrocode}
+\newif\if@br@isdigit
+\newcommand*{\@br@checkisdigit}[1]{%
+ \@br@isdigittrue
+ \if#10\relax
+ \else
+ \if#11\relax
+ \else
+ \if#12\relax
+ \else
+ \if#13\relax
+ \else
+ \if#14\relax
+ \else
+ \if#15\relax
+ \else
+ \if#16\relax
+ \else
+ \if#17\relax
+ \else
+ \if#18\relax
+ \else
+ \if#19\relax
+ \else
+ \@br@isdigitfalse
+ \fi
+ \fi
+ \fi
+ \fi
+ \fi
+ \fi
+ \fi
+ \fi
+ \fi
+ \fi
+}
+% \end{macrocode}
+%\end{macro}
+%
+%\begin{macro}{\@do@verse}
+% Process individual verse
+% \begin{macrocode}
+\newcommand*{\@do@verse}[1]{%
+ \@nodo@verse{#1}%
+ \expandafter\@bv@do\expandafter{\@br@tmp}%
+}
+% \end{macrocode}
+% \begin{macrocode}
+\newcommand*{\@nodo@verse}[1]{%
+% \end{macrocode}
+% Strip suffix, if it exists.
+% \begin{macrocode}
+ \br@stripverse{#1}%
+% \end{macrocode}
+% Prepend leading zeroes if required.
+% \begin{macrocode}
+ \ifnum\@br@versenum<10\relax
+ \@bv@addtochidxsort{00#1}%
+ \else
+ \ifnum\@br@versenum<100\relax
+ \@bv@addtochidxsort{0#1}%
+ \else
+ \@bv@addtochidxsort{#1}%
+ \fi
+ \fi
+ \ifx\@br@versesuffix\@empty
+ \protected@edef\@br@tmp{%
+ \protect\BRversestyle{\@br@versenum}%
+ }%
+ \else
+ \protected@edef\@br@tmp{%
+ \protect\BRversestyle{\@br@versenum}%
+ \protect\BRversesuffixstyle{\@br@versesuffix}%
+ }%
+ \fi
+}
+% \end{macrocode}
+%\end{macro}
+%
+%\begin{macro}{\@do@verses}
+% Pick up a list
+% \begin{macrocode}
+\def\@do@verses#1,#2\end{%
+\def\@br@tmp{#1}%
+\ifx\@br@tmp\@empty
+\else
+ \expandafter\@do@verse\expandafter{\@br@tmp}%
+\fi
+\ifx\relax#2\relax
+\else
+ \@bv@addtochidxsort{,}%
+ \@bv@do{\protect\BRvsep}%
+ \@do@verses#2\end
+\fi
+}
+% \end{macrocode}
+%\end{macro}
+%
+%\begin{macro}{\@bv@category}
+%\changes{1.14}{2011/01/19}{new}
+% Stores the current bible ref category.
+% \begin{macrocode}
+\newcommand*{\@bv@category}{}
+% \end{macrocode}
+%\end{macro}
+%\begin{macro}{\@bv@categorysort}
+%\changes{1.14}{2011/01/19}{new}
+% Stores the current bible ref category sort key.
+% \begin{macrocode}
+\newcommand*{\@bv@categorysort}{}
+% \end{macrocode}
+%\end{macro}
+%\begin{macro}{\biblerefcategory}
+% Sets the bible ref category and sort key.
+% \begin{macrocode}
+\newcommand*{\biblerefcategory}[2][\@bv@category]{%
+ \renewcommand*{\@bv@category}{#2}%
+ \renewcommand*{\@bv@categorysort}{#1}%
+}
+% \end{macrocode}
+%\end{macro}
+%
+%\begin{macro}{\bibleverse}
+%\changes{v1.19}{2018/07/29}{\cs{bibleverse} is now robust}
+%\begin{definition}
+%\cs{bibleverse}\marg{name}
+%\end{definition}
+% Displays references using current style.
+% \begin{macrocode}
+\DeclareRobustCommand*{\bibleverse}{%
+ \let\@bv@restore\relax
+ \@bible@verse
+}
+% \end{macrocode}
+%\end{macro}
+%
+%\begin{macro}{\@bible@verse}
+% \begin{macrocode}
+\newcommand*{\@bible@verse}[1]{%
+% \end{macrocode}
+% Makes \verb+:+ normal character (babel-french).
+%\changes{1.19}{2018/07/29}{Add \cs{shorthandoff}\verb+:+ (for babel)}
+%\changes{1.20}{2018/07/31}{Check before using \cs{shorthandoff}\verb+:+ (for babel)}
+% \begin{macrocode}
+ \bbl@ifunset{bbl@active@\string:}%
+ {}%
+ {\shorthandoff:}%
+% \end{macrocode}
+% This looks for a command called
+% \cs{br@}\meta{name} (defined earlier).
+% After the book title, it then checks
+% to see if there is a bracket \verb|(| immediately following it.
+% \begin{macrocode}
+ \@ifundefined{br@#1}%
+ {%
+ \PackageError{bibleref}{Unknown book '#1'}{}%
+ }%
+ {%
+ \@bv@idxsort{\csname br@#1\endcsname}%
+ \def\@bv@chidxsort{}%
+ \BRbooktitlestyle{\csname br@#1\endcsname}%
+ \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}}%
+ }%
+% \end{macrocode}
+% Restore definitions.
+% \begin{macrocode}
+ \let\BRbookof\@bv@org@bookof
+ \let\BRbooknumberstyle\@bv@org@booknumberstyle
+ \let\BRepistletothe\@bv@org@epistletothe
+ \let\BRepistlenumberstyle\@bv@org@epistlenumberstyle
+ }%
+% \end{macrocode}
+%\changes{1.13}{2010/07/07}{changed \cs{@ifnextchar} to
+%\cs{new@ifnextchar}}
+% \begin{macrocode}
+ \new@ifnextchar(%
+ {\BRbkchsep\@bibleverse}%
+ {\@end@@bibleverse}%
+}
+% \end{macrocode}
+%\end{macro}
+%
+%\begin{macro}{\@bibleverse}
+% This gets the chapter number.
+% \begin{macrocode}
+\def\@bibleverse(#1:{%
+ \def\@bv@tmp{#1}%
+ \ifx\@bv@tmp\@empty
+ \def\@bv@bvmacro{\@@bibleversenosep}%
+ \else
+ \bv@dbl@ch#1/\@nil%
+ \expandafter\@br@chsty\expandafter{\bv@dbl@ch@one}%
+ \ifx\bv@dbl@ch@two\@empty\else%
+ \@bv@dbl@ch@twotrue%
+ \BRotherchapterstyle{\@br@chsty{\bv@dbl@ch@two}}%
+ \@bv@dbl@ch@twofalse%
+ \fi%
+ \def\@bv@bvmacro{\@@bibleverse}%
+ \fi
+ \@bv@bvmacro
+}
+% \end{macrocode}
+%\end{macro}
+% \begin{macro}{\bv@dbl@ch}
+% This gets the two chapter numbers if there is alternative number (for example \verb+\bibleverse{Ps}(22/23:)+).
+% \begin{macrocode}
+\def\bv@dbl@ch#1/#2\@nil{%
+ \gdef\bv@dbl@ch@one{#1}%
+ \gdef\bv@dbl@ch@two{#2}%
+ \def\bv@dbl@ch@get@two##1/\@nil{%
+ \gdef\bv@dbl@ch@two{##1}%
+ }%
+ \ifx\bv@dbl@ch@two\@empty\else%
+ \expandafter\bv@dbl@ch@get@two\bv@dbl@ch@two\@nil%
+ \fi%
+}%
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\if@bv@dbl@ch@two}
+% This is set to TRUE before typesetting the alternative number.
+% \begin{macrocode}
+\newif\if@bv@dbl@ch@two%
+% \end{macrocode}
+% \end{macro}
+%\begin{macro}{\@bibleverser}
+% This gets the second part of a range spanning chapters.
+% \begin{macrocode}
+\def\@bibleverser-(#1:{%
+ \bv@dbl@ch#1/\@nil%
+ \ifx\bv@dbl@ch@one\@empty
+ \else
+ \ifnum\bv@dbl@ch@one<10\relax
+ \@bv@addtochidxsort{00\bv@dbl@ch@one:}%
+ \else
+ \ifnum\bv@dbl@ch@one<100\relax
+ \@bv@addtochidxsort{0\bv@dbl@ch@one:}%
+ \else
+ \@bv@addtochidxsort{\bv@dbl@ch@one:}%
+ \fi
+ \fi
+ \@bv@do{\protect\BRchapterstyle{\bv@dbl@ch@one}}%
+ \ifx\bv@dbl@ch@two\@empty\else%
+ \@bv@dbl@ch@twotrue%
+ \BRotherchapterstyle{\@br@chsty{\bv@dbl@ch@two}}%
+ \@bv@dbl@ch@twofalse%
+ \fi%
+ \fi
+ \@@bibleverse
+}
+% \end{macrocode}
+%\end{macro}
+%
+%\begin{macro}{\@@bibleverse}
+% This gets the verse number (or number range), and check to see
+% if it is followed by another bracket (indicating another
+% chapter, verse pair).
+% \begin{macrocode}
+\def\@@bibleverse#1){%
+ \def\@bv@tmp{#1}%
+ \ifx\@bv@tmp\@empty
+ \else
+ \@bv@do{\protect\BRchvsep}\@br@vrsty{#1}%
+ \fi
+% \end{macrocode}
+%\changes{1.13}{2010/07/07}{changed \cs{@ifnextchar} to
+%\cs{new@ifnextchar}}
+% \begin{macrocode}
+ \new@ifnextchar(%
+ {\@bv@do{\protect\BRchsep}\@bibleverse}%
+ {\new@ifnextchar-%
+ {\@bv@do{\protect\BRvrsep}\@bibleverser}%
+ {\@end@@bibleverse}%
+ }%
+}
+% \changes{1.15}{2016/09/10}{Fix bug with book without chapter}
+\def\@@bibleversenosep#1){%
+ \def\@bv@tmp{#1}%
+ \ifx\@bv@tmp\@empty
+ \else
+ \@br@vrsty{#1}%
+ \fi
+ \new@ifnextchar(%
+ {\@bv@do{\protect\BRchsep}\@bibleverse}%
+ {\new@ifnextchar-%
+ {\@bv@do{\protect\BRvrsep}\@bibleverser}%
+ {\@end@@bibleverse}%
+ }%
+}
+% \end{macrocode}
+%\end{macro}
+%
+%\begin{macro}{\@end@@bibleverse}
+% This controls what to do at the end of the final
+% verse.
+%\changes{1.09}{2009/04/26}{replaced \cs{index} with \cs{biblerefindex}}
+%\changes{1.10}{2010/04/27}{separated child entry from parent entry to improve sorting}
+%\changes{1.16}{2016/09/27}{Don't add the \cs{bvidxpgformat} in the .idx file if defined as empty}
+% \begin{macrocode}
+\newcommand*{\@end@@bibleverse}{%
+\if@bv@idx
+ \expandafter\@do@bibleref@map\@@bv@idxsort\relax
+ \ifx\@bv@idxentry\@empty
+ \def\@bv@tmp{\@bv@mainidxentry}%
+ \else
+ \def\@bv@tmp{\@bv@mainidxentry!\@bv@chidxsort @\@bv@idxentry}%
+ \fi
+ \edef\@bv@tmpc{\@bv@idxpgformat}%\@bv@tmpa and \@bv@tmpb are tokens
+ \ifx\@empty\@bv@tmpc%
+ \@do@biblerefindex%
+ {\@@bv@idxsort\relax @\@bv@tmp}%
+ \else%
+ \@do@biblerefindex%
+ {\@@bv@idxsort\relax @\@bv@tmp|\@bv@idxpgformat}%
+ \fi%
+ \@bv@idxfalse
+\fi
+% \end{macrocode}
+%\changes{1.14}{2011/01/19}{added \cs{@bv@restore}}
+%\changes{1.19}{2018/07/29}{Add \cs{shorthandon}\verb+:+ (for babel)}
+%\changes{1.20}{2018/07/31}{Check before using \cs{shorthandon}\verb+:+ (for babel)}
+% \begin{macrocode}
+\@bv@restore
+\bbl@ifunset{bbl@active@\string:}%
+ {}%
+ {\shorthandon:}%
+}
+% \end{macrocode}
+%\end{macro}
+%
+%\begin{macro}{\@do@biblerefindex}
+% If category has been set prepend information to
+% \cs{@bv@mainidxentry}.
+%\changes{1.14}{2011/01/19}{new}
+% \begin{macrocode}
+\newcommand*{\@do@biblerefindex}[1]{%
+ \ifx\@bv@category\@empty
+ \biblerefindex{#1}%
+ \else
+ \biblerefindex
+ {\@bv@categorysort @\@bv@category!#1}%
+ \fi
+}
+% \end{macrocode}
+%\end{macro}
+%
+%\begin{macro}{\biblerefindex}
+% Allow user to modify index command in case multiple indices
+% are required.
+%\changes{1.09}{2009/04/26}{new}
+% \begin{macrocode}
+\newcommand*{\biblerefindex}{\index}
+% \end{macrocode}
+%\end{macro}
+%
+%\begin{macro}{\biblerefmap}
+% \begin{macro}{\biblerefmap@}
+% Map the sort key to something else. Overwrites previous mapping
+% for the given key.
+% In case we use unicode character with non unicode engines (using fontspec), we need a little hack to:
+% \begin{itemize}
+% \item Transform the input 16 bits (or more) content to series of \cs{char};
+% \item Use the detokinzed version of this representation of characters to define the \cs{@bibleref@map@XXX} commands.
+% \end{itemize}
+% In this case, we do it using \cs{biblerefmap@}, passing a transformed forme of the first argument of \cs{biblerefmap}.
+%
+%\changes{1.09}{2009/04/26}{new}
+% \begin{macrocode}
+\newcommand{\biblerefmap@}[2]{%
+ \expandafter\def\csname @bibleref@map@\detokenize{#1}\endcsname{#2}%
+}%
+\newcommand*{\biblerefmap}[2]{%
+ \ifxetex%
+ \expandafter\def\csname @bibleref@map@#1\endcsname{#2}%
+ \else%
+ \edef\@tmp{#1}%
+ \expandafter\biblerefmap@\expandafter{\@tmp}{#2}%
+ \fi%
+}
+% \end{macrocode}
+% \end{macro}
+%\end{macro}
+%
+%\begin{macro}{\@do@bibleref@map}
+% \begin{macrocode}
+\def\@do@bibleref@map#1\relax{%
+ \ifxetex%
+ \@ifundefined{@bibleref@map@#1}{}{%
+ \expandafter\let\expandafter\@@bv@idxsort%
+ \csname @bibleref@map@#1\endcsname%
+ }%
+ \else%
+ \@ifundefined{@bibleref@map@\detokenize{#1}}{}{%
+ \expandafter\let\expandafter\@@bv@idxsort%
+ \csname @bibleref@map@\detokenize{#1}\endcsname%
+ }%
+ \fi%
+}
+% \end{macrocode}
+%\end{macro}
+%
+%\begin{macro}{\@bv@do}
+% Do argument and add to idx
+% \begin{macrocode}
+\newcommand{\@bv@do}[1]{#1\@bv@addtoidx{#1}}
+% \end{macrocode}
+%\end{macro}
+%
+%\begin{macro}{\@bv@addtoidx}
+% Append text to \verb|\@bv@idxentry|
+% \begin{macrocode}
+\newtoks\@bv@tmpa
+\newtoks\@bv@tmpb
+\newcommand*{\@bv@addtoidx}[1]{%
+\if@bv@idx
+ \if@bv@dbl@ch@two%
+ \@bv@tmpa={\protect\BRotherchapterstyle{#1}}%
+ \else%
+ \@bv@tmpa={#1}%
+ \fi%
+ \@bv@tmpb=\expandafter{\@bv@idxentry}%
+ \protected@edef\@bv@idxentry{\the\@bv@tmpb\the\@bv@tmpa}%
+\fi}
+% \end{macrocode}
+%\end{macro}
+%
+%\begin{macro}{\@bv@addtochidxsort}
+% Append text to \verb|\@bv@chidxsort|
+% \begin{macrocode}
+\newcommand{\@bv@addtochidxsort}[1]{%
+\if@bv@idx
+ \@bv@tmpa={#1}%
+ \@bv@tmpb=\expandafter{\@bv@chidxsort}%
+ \if@bv@dbl@ch@two%
+ \edef\@bv@chidxsort{\the\@bv@tmpb}%
+ \else%
+ \edef\@bv@chidxsort{\the\@bv@tmpb\the\@bv@tmpa}%
+ \fi%
+\fi
+}
+% \end{macrocode}
+%\end{macro}
+%\begin{macro}{\if@bv@idx}
+% Define switch to indicate whether or not to index
+% bible reference.
+% \begin{macrocode}
+\newif\if@bv@idx
+\@bv@idxfalse
+% \end{macrocode}
+%\end{macro}
+%\begin{macro}{\@bv@idxsort}
+% Sort key for bible verse index. (Strip all the formatting
+% bits.)
+% \begin{macrocode}
+\newcommand{\@bv@idxsort}[1]{%
+\if@bv@idx
+{\def\BRbooknumberstyle##1##2\relax{##2##1}%
+\def\BRepistlenumberstyle##1##2\relax{##2##1}%
+\def\BRgospel{}\def\BRbookof{}\def\BRepistleto{}%
+\def\BRepistletothe{}\def\BRepistleof{}%
+\xdef\@@bv@idxsort{#1\relax}%
+}%
+\fi}
+% \end{macrocode}
+%\end{macro}
+%
+%\begin{macro}{\ibibleverse}
+%\changes{v1.19}{2018/07/29}{\cs{ibibleverse} is now robust}
+% This is like \cs{bibleverse},
+% but also adds an index entry. The optional argument indicates
+% how to format the page number (without the preceding backslash)
+% e.g. \verb|\ibibleref[textit]{Romans}|.
+% \begin{macrocode}
+\DeclareRobustCommand*{\ibibleverse}[1][\bvidxpgformat]{%
+\def\@bv@idxpgformat{#1}%
+\@bv@idxtrue\def\@bv@idxentry{}\bibleverse}
+% \end{macrocode}
+%\end{macro}
+%
+%\begin{macro}{\ibiblechvs}
+%\changes{1.14}{2011/01/19}{new}
+% Only displays chapter and verses but indexes under the book.
+% \begin{macrocode}
+\newcommand*{\ibiblechvs}[1][\bvidxpgformat]{%
+ \let\@bv@current@bkchsep\BRbkchsep
+ \let\@bv@current@titlestyle\BRbooktitlestyle
+ \def\@bv@restore{%
+ \let\BRbkchsep\@bv@current@bkchsep
+ \let\BRbooktitlestyle\@bv@current@titlestyle
+ }%
+ \def\BRbkchsep{}%
+ \def\BRbooktitlestyle##1{}%
+ \def\@bv@idxpgformat{#1}%
+ \@bv@idxtrue\def\@bv@idxentry{}\@bible@verse
+}
+% \end{macrocode}
+%\end{macro}
+%
+%\begin{macro}{\ibiblevs}
+%\changes{1.14}{2011/01/19}{new}
+% Only displays verse(s) but indexes under the book and chapters.
+% \begin{macrocode}
+\newcommand*{\ibiblevs}[1][\bvidxpgformat]{%
+ \let\@bv@current@titlestyle\BRbooktitlestyle
+ \let\@bv@current@chapterstyle\BRchapterstyle
+ \let\@bv@current@bkchsep\BRbkchsep
+ \let\@bv@current@chvsep\BRchvsep
+ \def\@bv@restore{%
+ \let\BRbooktitlestyle\@bv@current@titlestyle
+ \let\BRchapterstyle\@bv@current@chapterstyle
+ \let\BRbkchsep\@bv@current@bkchsep
+ \let\BRchvsep\@bv@current@chvsep
+ }%
+ \def\BRbooktitlestyle##1{}%
+ \def\BRchapterstyle##1{}%
+ \def\BRbkchsep{}%
+ \def\BRchvsep{}%
+ \def\@bv@idxpgformat{#1}%
+ \@bv@idxtrue\def\@bv@idxentry{}\@bible@verse
+}
+% \end{macrocode}
+%\end{macro}
+%
+%\begin{macro}{\bvidxpgformat}
+% Default page number format for bible verse index entries
+% \begin{macrocode}
+\newcommand*{\bvidxpgformat}{textrm}
+% \end{macrocode}
+%\end{macro}
+% Define \cs{bbl@ifunset} if babel is not loaded.
+% \begin{macrocode}
+\AtBeginDocument{%
+ \ifdefined\bbl@ifunset\else%
+ \def\bbl@ifunset#1#2#3{}%
+ \fi%
+}%
+% \end{macrocode}
+%\iffalse
+% \begin{macrocode}
+%</bibleref.sty>
+% \end{macrocode}
+%\fi
+%\iffalse
+% \begin{macrocode}
+%<*sample-categories.tex>
+% \end{macrocode}
+%\fi
+%\iffalse
+% \begin{macrocode}
+\documentclass{article}
+
+\usepackage{makeidx}
+\usepackage{bibleref}
+\makeindex
+
+\begin{document}
+\biblerefcategory{NIV}
+
+\begin{tabular}{ll}
+\verb|\ibibleverse{Ex}| & \ibibleverse{Ex}\\
+\verb|\ibibleverse{Exodus}(20:)| & \ibibleverse{Exodus}(20:)\\
+\verb|\ibibleverse{Exod}(20:17)| & \ibibleverse{Exod}(20:17)\\
+\verb|\ibibleverse{IICo}(12:21)| & \ibibleverse{IICo}(12:21)\\
+\verb|\ibibleverse{IICor}(12:21-32)| & \ibibleverse{IICor}(12:21-32)\\
+\verb|\ibibleverse{Ex}(20:17)(21:3)| & \ibibleverse{Ex}(20:17)(21:3)\\
+\verb|\ibibleverse{Ex}(15:)(17:)(20:)| & \ibibleverse{Ex}(15:)(17:)(20:)\\
+\verb|\ibibleverse{Rev}(1:2,5,7-9,11)| & \ibibleverse{Rev}(1:2,5,7-9,11)\\
+\verb|\ibibleverse{IChronicles}(1:3)-(2:7)| &
+\ibibleverse{IChronicles}(1:3)-(2:7)\\
+\verb|\ibibleverse{IChronicles}(1:)-(4:)| &
+\ibibleverse{IChronicles}(1:)-(4:)\\
+\verb|\ibibleverse{IChronicles}(1-4:)| &
+\ibibleverse{IChronicles}(1-4:)
+\end{tabular}
+
+\biblerefcategory{Jerusalem}
+
+\begin{tabular}{ll}
+\verb|\ibibleverse{Ex}| & \ibibleverse{Ex}\\
+\verb|\ibibleverse{Exodus}(20:)| & \ibibleverse{Exodus}(20:)\\
+\verb|\ibibleverse{Exod}(20:17)| & \ibibleverse{Exod}(20:17)\\
+\verb|\ibibleverse{IICo}(12:21)| & \ibibleverse{IICo}(12:21)\\
+\verb|\ibibleverse{IICor}(12:21-32)| & \ibibleverse{IICor}(12:21-32)\\
+\verb|\ibibleverse{Ex}(20:17)(21:3)| & \ibibleverse{Ex}(20:17)(21:3)\\
+\verb|\ibibleverse{Ex}(15:)(17:)(20:)| & \ibibleverse{Ex}(15:)(17:)(20:)\\
+\verb|\ibibleverse{Rev}(1:2,5,7-9,11)| & \ibibleverse{Rev}(1:2,5,7-9,11)\\
+\verb|\ibibleverse{IChronicles}(1:3)-(2:7)| &
+\ibibleverse{IChronicles}(1:3)-(2:7)\\
+\verb|\ibibleverse{IChronicles}(1:)-(4:)| &
+\ibibleverse{IChronicles}(1:)-(4:)\\
+\verb|\ibibleverse{IChronicles}(1-4:)| &
+\ibibleverse{IChronicles}(1-4:)
+\end{tabular}
+
+\printindex
+\end{document}
+% \end{macrocode}
+%\fi
+%\iffalse
+% \begin{macrocode}
+%</sample-categories.tex>
+% \end{macrocode}
+%\fi
+%\iffalse
+% \begin{macrocode}
+%<*sample-indextools.tex>
+% \end{macrocode}
+%\fi
+%\iffalse
+%\subsection{Sample Document with Multiple Indices}
+% \begin{macrocode}
+\documentclass{article}
+
+\usepackage{bibleref}
+\usepackage{indextools}
+
+\makeindex[name=scr,title=Scripture]
+\makeindex[title=General]
+
+\renewcommand{\biblerefindex}{\index[scr]}
+
+\biblerefmap{Genesis}{1@Old Testament!1}
+\biblerefmap{Exodus}{1@Old Testament!2}
+\biblerefmap{Leviticus}{1@Old Testament!3}
+\biblerefmap{Numbers}{1@Old Testament!4}
+\biblerefmap{Deuteronomy}{1@Old Testament!5}
+
+\biblerefmap{Tobit}{2@Apocrypha!3}
+
+\biblerefmap{Matthew}{3@New Testament!1}
+\biblerefmap{Mark}{3@New Testament!2}
+\biblerefmap{Luke}{3@New Testament!3}
+\biblerefmap{John}{3@New Testament!4}
+\biblerefmap{Acts}{3@New Testament!5}
+\biblerefmap{Romans}{3@New Testament!6}
+\biblerefmap{Corinthians1}{3@New Testament!7}
+
+\begin{document}
+Something for the general index\index{something}.
+
+An old testament reference \ibibleverse{Genesis}(1:1-10).
+A new testament reference \ibibleverse{ICor}.
+
+Something else for the general index\index{another}.
+
+Another old testament reference \ibibleverse{Ex}.
+Another new testament reference \ibibleverse{Matt}.
+
+\ibibleverse{Tobit}
+
+\printindex[scr]
+\printindex
+\end{document}
+% \end{macrocode}
+%\fi
+%\iffalse
+% \begin{macrocode}
+%</sample-indextools.tex>
+% \end{macrocode}
+%\fi
+%\iffalse
+% \begin{macrocode}
+%<*sample-xidx.tex>
+% \end{macrocode}
+%\fi
+%\iffalse
+%\subsection{Sample document using bibleref-xidx}
+% \begin{macrocode}
+\documentclass{article}
+
+\usepackage{bibleref-xidx}
+\usepackage{makeidx}
+\makeindex
+
+\biblerefstyle{MHRA}
+
+\begin{document}
+\title{Sample Document Using bibleref-xidx}
+\author{Nicola Talbot}
+\maketitle
+
+\begin{tabular}{ll}
+\verb|\ibibleverse{Ex}| & \ibibleverse{Ex}\\
+\verb|\ibibleverse{Exodus}(20:)| & \ibibleverse{Exodus}(20:)\\
+\verb|\ibibleverse{Exod}(20:17)| & \ibibleverse{Exod}(20:17)\\
+\verb|\ibibleverse{IICo}(12:21)| & \ibibleverse{IICo}(12:21)\\
+\verb|\ibibleverse{IICor}(12:21-32)| & \ibibleverse{IICor}(12:21-32)\\
+\verb|\ibibleverse{Ex}(20:17)(21:3)| & \ibibleverse{Ex}(20:17)(21:3)\\
+\verb|\ibibleverse{Ex}(15:)(17:)(20:)| & \ibibleverse{Ex}(15:)(17:)(20:)\\
+\verb|\ibibleverse{Rev}(1:2,5,7-9,11)| & \ibibleverse{Rev}(1:2,5,7-9,11)\\
+\verb|\ibibleverse{IChronicles}(1:3)-(2:7)| &
+\ibibleverse{IChronicles}(1:3)-(2:7)\\
+\verb|\ibibleverse{IChronicles}(1:)-(4:)| &
+\ibibleverse{IChronicles}(1:)-(4:)\\
+\verb|\ibibleverse{IChronicles}(1-4:)| &
+\ibibleverse{IChronicles}(1-4:)
+\end{tabular}
+
+\printindex
+\end{document}
+% \end{macrocode}
+%\fi
+%\iffalse
+% \begin{macrocode}
+%</sample-xidx.tex>
+% \end{macrocode}
+%\fi
+%\iffalse
+% \begin{macrocode}
+%<*sample.tex>
+% \end{macrocode}
+%\fi
+%\iffalse
+%\subsection{Sample Document}
+% \begin{macrocode}
+\documentclass{article}
+
+\usepackage{bibleref}
+\usepackage{makeidx}
+\makeindex
+
+% make the page numbers in the index italic for bible
+% references
+\renewcommand{\bvidxpgformat}{textit}
+
+\begin{document}
+
+\title{Sample Document}
+\author{Nicola Talbot}
+\maketitle
+
+Long citation in text:
+\biblerefstyle{text}%
+\bibleverse{IICor}(12:15,18,21-33) and
+\bibleverse{Jeremiah}.
+Short citation in footnote\footnote{%
+\biblerefstyle{chicago}\bibleverse{IICor}(12:15,18,21-33) and
+\bibleverse{Jeremiah}}.
+
+\section{Default Style}
+
+\biblerefstyle{default}
+\noindent
+\begin{tabular}{ll}
+\verb|\bibleverse{Ex}| & \bibleverse{Ex}\\
+\verb|\bibleverse{Exodus}(20:)| & \bibleverse{Exodus}(20:)\\
+\verb|\bibleverse{Exod}(20:17)| & \bibleverse{Exod}(20:17)\\
+\verb|\bibleverse{IICo}(12:21)| & \bibleverse{IICo}(12:21)\\
+\verb|\bibleverse{IICor}(12:21-32)| & \bibleverse{IICor}(12:21-32)\\
+\verb|\bibleverse{Ex}(20:17)(21:3)| & \bibleverse{Ex}(20:17)(21:3)\\
+\verb|\bibleverse{Ex}(15:)(17:)(20:)| & \bibleverse{Ex}(15:)(17:)(20:)\\
+\verb|\bibleverse{Rev}(1:2,5,7-9,11)| & \bibleverse{Rev}(1:2,5,7-9,11)\\
+\verb|\bibleverse{IChronicles}(1:3)-(2:7)| &
+\bibleverse{IChronicles}(1:3)-(2:7)
+\end{tabular}
+
+\section{Jerusalem Style}
+This is the style used in the Jerusalem bible.
+\biblerefstyle{jerusalem}
+
+\noindent
+\begin{tabular}{ll}
+\verb|\bibleverse{Ex}| & \bibleverse{Ex}\\
+\verb|\bibleverse{Exodus}(20:)| & \bibleverse{Exodus}(20:)\\
+\verb|\bibleverse{Exod}(20:17)| & \bibleverse{Exod}(20:17)\\
+\verb|\bibleverse{IICo}(12:21)| & \bibleverse{IICo}(12:21)\\
+\verb|\bibleverse{IICor}(12:21-32)| & \bibleverse{IICor}(12:21-32)\\
+\verb|\bibleverse{Ex}(20:17)(21:3)| & \bibleverse{Ex}(20:17)(21:3)\\
+\verb|\bibleverse{Ex}(15:)(17:)(20:)| & \bibleverse{Ex}(15:)(17:)(20:)\\
+\verb|\bibleverse{Rev}(1:2,5,7-9,11)| & \bibleverse{Rev}(1:2,5,7-9,11)\\
+\verb|\bibleverse{IChronicles}(1:3)-(2:7)| &
+\bibleverse{IChronicles}(1:3)-(2:7)
+\end{tabular}
+
+\section{Anglo-Saxon Style}
+
+\biblerefstyle{anglosaxon}
+\noindent
+\begin{tabular}{ll}
+\verb|\bibleverse{Ex}| & \bibleverse{Ex}\\
+\verb|\bibleverse{Exodus}(20:)| & \bibleverse{Exodus}(20:)\\
+\verb|\bibleverse{Exod}(20:17)| & \bibleverse{Exod}(20:17)\\
+\verb|\bibleverse{IICo}(12:21)| & \bibleverse{IICo}(12:21)\\
+\verb|\bibleverse{IICor}(12:21-32)| & \bibleverse{IICor}(12:21-32)\\
+\verb|\bibleverse{Ex}(20:17)(21:3)| & \bibleverse{Ex}(20:17)(21:3)\\
+\verb|\bibleverse{Ex}(15:)(17:)(20:)| & \bibleverse{Ex}(15:)(17:)(20:)\\
+\verb|\bibleverse{Rev}(1:2,5,7-9,11)| & \bibleverse{Rev}(1:2,5,7-9,11)\\
+\verb|\bibleverse{IChronicles}(1:3)-(2:7)| &
+\bibleverse{IChronicles}(1:3)-(2:7)
+\end{tabular}
+
+\section{Journal of Ecclesiastical History}
+
+\biblerefstyle{JEH}
+\noindent
+\begin{tabular}{ll}
+\verb|\bibleverse{Ex}| & \bibleverse{Ex}\\
+\verb|\bibleverse{Exodus}(20:)| & \bibleverse{Exodus}(20:)\\
+\verb|\bibleverse{Exod}(20:17)| & \bibleverse{Exod}(20:17)\\
+\verb|\bibleverse{IICo}(12:21)| & \bibleverse{IICo}(12:21)\\
+\verb|\bibleverse{IICor}(12:21-32)| & \bibleverse{IICor}(12:21-32)\\
+\verb|\bibleverse{Ex}(20:17)(21:3)| & \bibleverse{Ex}(20:17)(21:3)\\
+\verb|\bibleverse{Ex}(15:)(17:)(20:)| & \bibleverse{Ex}(15:)(17:)(20:)\\
+\verb|\bibleverse{Rev}(1:2,5,7-9,11)| & \bibleverse{Rev}(1:2,5,7-9,11)\\
+\verb|\bibleverse{IChronicles}(1:3)-(2:7)| &
+\bibleverse{IChronicles}(1:3)-(2:7)
+\end{tabular}
+
+\section{Modern Humanities Research Association}
+
+\biblerefstyle{MHRA}
+\noindent
+\begin{tabular}{ll}
+\verb|\bibleverse{Ex}| & \bibleverse{Ex}\\
+\verb|\bibleverse{Exodus}(20:)| & \bibleverse{Exodus}(20:)\\
+\verb|\bibleverse{Exod}(20:17)| & \bibleverse{Exod}(20:17)\\
+\verb|\bibleverse{IICo}(12:21)| & \bibleverse{IICo}(12:21)\\
+\verb|\bibleverse{IICor}(12:21-32)| & \bibleverse{IICor}(12:21-32)\\
+\verb|\bibleverse{Ex}(20:17)(21:3)| & \bibleverse{Ex}(20:17)(21:3)\\
+\verb|\bibleverse{Ex}(15:)(17:)(20:)| & \bibleverse{Ex}(15:)(17:)(20:)\\
+\verb|\bibleverse{Rev}(1:2,5,7-9,11)| & \bibleverse{Rev}(1:2,5,7-9,11)\\
+\verb|\bibleverse{IChronicles}(1:3)-(2:7)| &
+\bibleverse{IChronicles}(1:3)-(2:7)
+\end{tabular}
+
+\section{Novum Testamentum Graece (Nestle-Aland)}
+
+\biblerefstyle{NTG}
+\noindent
+\begin{tabular}{ll}
+\verb|\bibleverse{Ex}| & \bibleverse{Ex}\\
+\verb|\bibleverse{Exodus}(20:)| & \bibleverse{Exodus}(20:)\\
+\verb|\bibleverse{Exod}(20:17)| & \bibleverse{Exod}(20:17)\\
+\verb|\bibleverse{IICo}(12:21)| & \bibleverse{IICo}(12:21)\\
+\verb|\bibleverse{IICor}(12:21-32)| & \bibleverse{IICor}(12:21-32)\\
+\verb|\bibleverse{Ex}(20:17)(21:3)| & \bibleverse{Ex}(20:17)(21:3)\\
+\verb|\bibleverse{Ex}(15:)(17:)(20:)| & \bibleverse{Ex}(15:)(17:)(20:)\\
+\verb|\bibleverse{Rev}(1:2,5,7-9,11)| & \bibleverse{Rev}(1:2,5,7-9,11)\\
+\verb|\bibleverse{IChronicles}(1:3)-(2:7)| &
+\bibleverse{IChronicles}(1:3)-(2:7)
+\end{tabular}
+
+\section{MLA Style}
+
+\biblerefstyle{MLA}
+\noindent
+\begin{tabular}{ll}
+\verb|\bibleverse{Ex}| & \bibleverse{Ex}\\
+\verb|\bibleverse{Exodus}(20:)| & \bibleverse{Exodus}(20:)\\
+\verb|\bibleverse{Exod}(20:17)| & \bibleverse{Exod}(20:17)\\
+\verb|\bibleverse{IICo}(12:21)| & \bibleverse{IICo}(12:21)\\
+\verb|\bibleverse{IICor}(12:21-32)| & \bibleverse{IICor}(12:21-32)\\
+\verb|\bibleverse{Ex}(20:17)(21:3)| & \bibleverse{Ex}(20:17)(21:3)\\
+\verb|\bibleverse{Ex}(15:)(17:)(20:)| & \bibleverse{Ex}(15:)(17:)(20:)\\
+\verb|\bibleverse{Rev}(1:2,5,7-9,11)| & \bibleverse{Rev}(1:2,5,7-9,11)\\
+\verb|\bibleverse{IChronicles}(1:3)-(2:7)| &
+\bibleverse{IChronicles}(1:3)-(2:7)
+\end{tabular}
+
+\section{Chicago Style}
+
+\biblerefstyle{chicago}
+\noindent
+\begin{tabular}{ll}
+\verb|\bibleverse{Ex}| & \bibleverse{Ex}\\
+\verb|\bibleverse{Exodus}(20:)| & \bibleverse{Exodus}(20:)\\
+\verb|\bibleverse{Exod}(20:17)| & \bibleverse{Exod}(20:17)\\
+\verb|\bibleverse{IICo}(12:21)| & \bibleverse{IICo}(12:21)\\
+\verb|\bibleverse{IICor}(12:21-32)| & \bibleverse{IICor}(12:21-32)\\
+\verb|\bibleverse{Ex}(20:17)(21:3)| & \bibleverse{Ex}(20:17)(21:3)\\
+\verb|\bibleverse{Ex}(15:)(17:)(20:)| & \bibleverse{Ex}(15:)(17:)(20:)\\
+\verb|\bibleverse{Rev}(1:2,5,7-9,11)| & \bibleverse{Rev}(1:2,5,7-9,11)\\
+\verb|\bibleverse{IChronicles}(1:3)-(2:7)| &
+\bibleverse{IChronicles}(1:3)-(2:7)
+\end{tabular}
+
+\section{Text Style}
+This style prints the citation out in full. It's based
+on `default', and uses the fmtcount package to convert
+the numbers into words.
+
+\biblerefstyle{text}
+\raggedright
+
+\begin{itemize}
+\item \verb|\bibleverse{Ex}| \bibleverse{Ex}
+\item \verb|\bibleverse{Exodus}(20:)| \bibleverse{Exodus}(20:)
+\item \verb|\bibleverse{Exod}(20:17)| \bibleverse{Exod}(20:17)
+\item \verb|\bibleverse{IICo}(12:21)| \bibleverse{IICo}(12:21)
+\item \verb|\bibleverse{IICor}(12:21-32)| \bibleverse{IICor}(12:21-32)
+\item \verb|\bibleverse{Ex}(20:17)(21:3)| \bibleverse{Ex}(20:17)(21:3)
+\item \verb|\bibleverse{Ex}(15:)(17:)(20:)| \bibleverse{Ex}(15:)(17:)(20:)
+\item \verb|\bibleverse{Rev}(1:2,5,7-9,11)| \bibleverse{Rev}(1:2,5,7-9,11)
+\item \verb|\bibleverse{IChronicles}(1:3)-(2:7)|
+\bibleverse{IChronicles}(1:3)-(2:7)
+\end{itemize}
+
+\section{MHRA Style---Indexed}
+
+\biblerefstyle{MHRA}
+\noindent
+\begin{tabular}{ll}
+\verb|\ibibleverse{Ex}| & \ibibleverse{Ex}\\
+\verb|\ibibleverse{Exodus}(9:)| & \ibibleverse{Exodus}(9:)\\
+\verb|\ibibleverse{Exod}(20:17)| & \ibibleverse{Exod}(20:17)\\
+\verb|\ibibleverse{Exod}(20:)| & \ibibleverse{Exod}(20:)\\
+\verb|\ibibleverse{IICo}(12:21)| & \ibibleverse{IICo}(12:21)\\
+\verb|\ibibleverse{IICor}(12:21-32)| & \ibibleverse{IICor}(12:21-32)\\
+\verb|\ibibleverse{Ex}(20:17)(21:3)| & \ibibleverse{Ex}(20:17)(21:3)\\
+\verb|\ibibleverse{Ex}(15:)(17:)(20:)| & \ibibleverse{Ex}(15:)(17:)(20:)\\
+\verb|\ibibleverse{Rev}(1:2,5,7-9,11)| & \ibibleverse{Rev}(1:2,5,7-9,11)\\
+\verb|\ibibleverse{IChronicles}(1:3)-(2:7)| &
+\ibibleverse{IChronicles}(1:3)-(2:7)\\
+\verb|\ibibleverse{IIPeter}(3:8-15a)| &
+\ibibleverse{IIPeter}(3:8-15a)
+\end{tabular}
+
+\section{New Style}
+
+This new style is based on the `default' style, but
+has verses in lower case Roman numerals, and redefines
+``Revelation'' as ``Apocalypse''.
+
+\begin{verbatim}
+\newbiblerefstyle{sample}{%
+\biblerefstyle{default}%
+\renewcommand{\BRversestyle}[1]{\romannumeral##1}%
+\setbooktitle{Revelation}{Apocalyse}%
+}
+\end{verbatim}
+\newbiblerefstyle{sample}{%
+\biblerefstyle{default}%
+\renewcommand{\BRversestyle}[1]{\romannumeral##1}%
+\setbooktitle{Revelation}{Apocalyse}%
+}
+
+\biblerefstyle{sample}
+\noindent
+\begin{tabular}{ll}
+\verb|\bibleverse{Ex}| & \bibleverse{Ex}\\
+\verb|\bibleverse{Exodus}(20:)| & \bibleverse{Exodus}(20:)\\
+\verb|\bibleverse{Exod}(20:17)| & \bibleverse{Exod}(20:17)\\
+\verb|\bibleverse{IICo}(12:21)| & \bibleverse{IICo}(12:21)\\
+\verb|\bibleverse{IICor}(12:21-32)| & \bibleverse{IICor}(12:21-32)\\
+\verb|\bibleverse{Ex}(20:17)(21:3)| & \bibleverse{Ex}(20:17)(21:3)\\
+\verb|\bibleverse{Ex}(15:)(17:)(20:)| & \bibleverse{Ex}(15:)(17:)(20:)\\
+\verb|\bibleverse{Rev}(1:2,5,7-9,11)| & \bibleverse{Rev}(1:2,5,7-9,11)\\
+\verb|\bibleverse{IChronicles}(1:3)-(2:7)| &
+\bibleverse{IChronicles}(1:3)-(2:7)
+\end{tabular}
+
+\section{Partial References}
+
+Only display verse numbers, but index under book and chapter:
+\ibiblevs{Gen}(19:3-4).
+
+Display only chapter and verses, but index under book:
+\ibiblechvs{Gen}(4:1-5).
+
+Complete indexed reference: \ibibleverse{Gen}(20:1-4).
+
+Display chapter range with no verses: \ibibleverse{Gen}(1,4-6,8-9,11:).
+
+Display chapter range with no verses (no index): \bibleverse{John}(1,3,4-6,8:).
+
+\printindex
+
+\end{document}
+% \end{macrocode}
+%\fi
+%\iffalse
+% \begin{macrocode}
+%</sample.tex>
+% \end{macrocode}
+%\fi
+%\iffalse
+% \begin{macrocode}
+%<*sample.ist>
+% \end{macrocode}
+%\fi
+%\iffalse
+% \begin{macrocode}
+delim_0 "\\dotfill "
+delim_1 "\\dotfill "
+delim_2 "\\dotfill "
+% \end{macrocode}
+%\fi
+%\iffalse
+% \begin{macrocode}
+%</sample.ist>
+% \end{macrocode}
+%\fi
+%\iffalse
+% \begin{macrocode}
+%<*bibleref.perl>
+% \end{macrocode}
+%\fi
+%\Finale
+\endinput
diff --git a/macros/latex/contrib/bibleref/bibleref.ins b/macros/latex/contrib/bibleref/bibleref.ins
new file mode 100644
index 0000000000..0208bc5708
--- /dev/null
+++ b/macros/latex/contrib/bibleref/bibleref.ins
@@ -0,0 +1,43 @@
+% bibleref.ins generated using makedtx version 0.94b 2011/1/19 22:37
+\input docstrip
+
+\preamble
+
+ bibleref.dtx
+ Copyright 2011 Nicola Talbot
+
+ This work may be distributed and/or modified under the
+ conditions of the LaTeX Project Public License, either version 1.3
+ of this license of (at your option) any later version.
+ The latest version of this license is in
+ http://www.latex-project.org/lppl.txt
+ and version 1.3 or later is part of all distributions of LaTeX
+ version 2005/12/01 or later.
+
+ This work has the LPPL maintenance status `maintained'.
+
+ The Current Maintainer of this work is Nicola Talbot.
+
+ This work consists of the files bibleref.dtx and bibleref.ins and the derived files bibleref-xidx.sty, bibleref.sty, sample-categories.tex, sample-indextools.tex, sample-xidx.tex, sample.tex, sample.ist.
+
+\endpreamble
+
+\askforoverwritefalse
+
+\generate{\file{bibleref-xidx.sty}{\usepreamble\defaultpreamble
+\usepostamble\defaultpostamble\from{bibleref.dtx}{bibleref-xidx.sty,package}}
+\file{bibleref.sty}{\usepreamble\defaultpreamble
+\usepostamble\defaultpostamble\from{bibleref.dtx}{bibleref.sty,package}}
+\file{sample-categories.tex}{\usepreamble\defaultpreamble
+\usepostamble\defaultpostamble\from{bibleref.dtx}{sample-categories.tex,package}}
+\file{sample-indextools.tex}{\usepreamble\defaultpreamble
+\usepostamble\defaultpostamble\from{bibleref.dtx}{sample-indextools.tex,package}}
+\file{sample-xidx.tex}{\usepreamble\defaultpreamble
+\usepostamble\defaultpostamble\from{bibleref.dtx}{sample-xidx.tex,package}}
+\file{sample.tex}{\usepreamble\defaultpreamble
+\usepostamble\defaultpostamble\from{bibleref.dtx}{sample.tex,package}}
+\file{sample.ist}{\usepreamble\defaultpreamble
+\usepostamble\defaultpostamble\from{bibleref.dtx}{sample.ist,package}}
+}
+
+\endbatchfile
diff --git a/macros/latex/contrib/bibleref/bibleref.pdf b/macros/latex/contrib/bibleref/bibleref.pdf
new file mode 100644
index 0000000000..d0d85d2b7e
--- /dev/null
+++ b/macros/latex/contrib/bibleref/bibleref.pdf
Binary files differ
diff --git a/macros/latex/contrib/bibleref/makefile b/macros/latex/contrib/bibleref/makefile
new file mode 100644
index 0000000000..b5dbbd7b50
--- /dev/null
+++ b/macros/latex/contrib/bibleref/makefile
@@ -0,0 +1,21 @@
+all:bibleref.pdf bibleref.sty
+ rm -rf bibleref
+ mkdir bibleref
+ mkdir bibleref/samples
+ latexmk sample*tex
+ ln sample*tex bibleref/samples
+ ln sample*pdf bibleref/samples
+ ln CHANGES *ins *dtx bibleref.pdf README makefile bibleref
+ @$(RM) ../bibleref.zip
+ zip -r ../bibleref.zip bibleref
+
+%.sty: %.ins %.dtx
+ rm -f $*.sty $*tex
+ @pdflatex $*.ins
+
+%.pdf: %.sty %.dtx
+ @pdflatex $*.dtx
+ @pdflatex $*.dtx
+ @makeindex -s gind.ist -o $*.ind $*.idx
+ @pdflatex $*.dtx
+ @pdflatex $*.dtx
diff --git a/macros/latex/contrib/bibleref/samples/sample-categories.pdf b/macros/latex/contrib/bibleref/samples/sample-categories.pdf
new file mode 100644
index 0000000000..e2822edd5b
--- /dev/null
+++ b/macros/latex/contrib/bibleref/samples/sample-categories.pdf
Binary files differ
diff --git a/macros/latex/contrib/bibleref/samples/sample-indextools.pdf b/macros/latex/contrib/bibleref/samples/sample-indextools.pdf
new file mode 100644
index 0000000000..9f34cb6d51
--- /dev/null
+++ b/macros/latex/contrib/bibleref/samples/sample-indextools.pdf
Binary files differ
diff --git a/macros/latex/contrib/bibleref/samples/sample-xidx.pdf b/macros/latex/contrib/bibleref/samples/sample-xidx.pdf
new file mode 100644
index 0000000000..b890da74db
--- /dev/null
+++ b/macros/latex/contrib/bibleref/samples/sample-xidx.pdf
Binary files differ
diff --git a/macros/latex/contrib/bibleref/samples/sample.pdf b/macros/latex/contrib/bibleref/samples/sample.pdf
new file mode 100644
index 0000000000..631b27f11b
--- /dev/null
+++ b/macros/latex/contrib/bibleref/samples/sample.pdf
Binary files differ