diff options
Diffstat (limited to 'Master/texmf-dist/source/latex/bibleref/bibleref.dtx')
-rw-r--r-- | Master/texmf-dist/source/latex/bibleref/bibleref.dtx | 162 |
1 files changed, 137 insertions, 25 deletions
diff --git a/Master/texmf-dist/source/latex/bibleref/bibleref.dtx b/Master/texmf-dist/source/latex/bibleref/bibleref.dtx index 35a65bc2d67..c9a38b547c7 100644 --- a/Master/texmf-dist/source/latex/bibleref/bibleref.dtx +++ b/Master/texmf-dist/source/latex/bibleref/bibleref.dtx @@ -1,5 +1,5 @@ %\iffalse -% bibleref.dtx generated using makedtx version 0.9b (c) Nicola Talbot +% bibleref.dtx generated using makedtx version 0.91b (c) Nicola Talbot % Command line args: % -src "(.+)\.(sty)=>\1.\2" % -src "(.+)\.(tex)=>\1.\2" @@ -7,7 +7,7 @@ % -author "Nicola Talbot" % -dir "source" % bibleref -% Created on 2005/9/28 15:01 +% Created on 2006/7/30 14:17 %\fi %\iffalse %<*package> @@ -30,7 +30,7 @@ %\fi % \iffalse % Doc-Source file to use with LaTeX2e -% Copyright (C) 2005 Nicola Talbot, all rights reserved. +% Copyright (C) 2006 Nicola Talbot, all rights reserved. % \fi % \iffalse %<*driver> @@ -40,16 +40,17 @@ \usepackage{bibleref}
\newcommand{\sty}[1]{\textsf{#1}}
-\CheckSum{2050}
+\CheckSum{2208}
+\OnlyDescription
-\def\docdate{28 Sep 2005}
+\def\docdate{30 July 2006}
\begin{document}
\DocInput{bibleref.dtx} \end{document} %</driver> %\fi -%\title{bibleref.sty v1.02: \LaTeXe\ Package for
+%\title{bibleref.sty v1.06: \LaTeXe\ Package for
%typesetting bible references}
%\author{Nicola Talbot}
%\date{\docdate}
@@ -160,6 +161,22 @@ %\end{verbatim}
%Note the use of \verb|##1| instead of \verb|#1|.
%
+%\section{Indexing Bible References}
+%
+%\DescribeMacro{\ibibleverse}
+%The command \verb|\ibibleverse| does the same as \verb|\bibleverse|
+%but also adds an index entry (provided you have used
+%\verb|\makeindex| in the preamble.) The default page number
+%format is given by the command
+%\DescribeMacro{\bvidxpgformat}\verb|\bvidxpgformat|. 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 \verb|\ibibleverse|. For example:
+%\begin{verbatim}
+%\ibibleverse[textit]{Exodus}
+%\end{verbatim}
+%(Note there is no backslash.)
+%
%\section{Acknowledgements}
%Many thanks to all the useful comments from comp.text.tex,
%especially from Jesse~Billett, Brooks~Moses and Ulrich~M.~Schwarz.
@@ -183,7 +200,7 @@ % Declare package
% \begin{macrocode}
\NeedsTeXFormat{LaTeX2e}
-\ProvidesPackage{bibleref}[2005/09/28 1.02 (NLCT)]
+\ProvidesPackage{bibleref}[2006/07/30 1.06 (NLCT)]
% \end{macrocode}
% Need to do some conditional stuff
% \begin{macrocode}
@@ -352,7 +369,7 @@ \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}\BRepistletoTimothy}%
+\def\br@IITimothy{\BRepistlenumberstyle{2}\BRepistleto Timothy}%
\def\br@Titus{\BRepistleto Titus}%
\def\br@Philemon{\BRepistleto Philemon}%
\def\br@Hebrews{\BRepistletothe Hebrews}%
@@ -373,7 +390,7 @@ % will switch to an abbreviated form for the book titles.
% \begin{macrocode}
\newcommand{\brabbrvname}{%
-\def\br@Gensis{Gn\BRperiod}%
+\def\br@Genesis{Gn\BRperiod}%
\def\br@Exodus{Ex\BRperiod}%
\def\br@Leviticus{Lv\BRperiod}%
\def\br@Numbers{Nb\BRperiod}%
@@ -451,7 +468,7 @@ % switches to an alternative set of abbreviations.
% \begin{macrocode}
\newcommand{\braltabbrvname}{%
-\def\br@Gensis{Gen\BRperiod}%
+\def\br@Genesis{Gen\BRperiod}%
\def\br@Exodus{Exod\BRperiod}%
\def\br@Leviticus{Lev\BRperiod}%
\def\br@Numbers{Num\BRperiod}%
@@ -902,17 +919,17 @@ Unknown biblerefstyle '#1'}{}}{\csname brs@#1\endcsname}} \def\@@br@vrsty#1-#2\end{%
\@do@verses#1,\relax\end
-\ifx#2\@nil
+\ifx\@nil#2\relax
\else
-\BRvrsep
+\@bv@do{\BRvrsep}%
\@@br@vrsty#2\end%
\fi}
\def\@do@verses#1,#2\end{%
-\ifthenelse{\equal{#1}{}}{}{\BRversestyle{#1}}%
-\ifx\relax#2%
+\ifthenelse{\equal{#1}{}}{}{\@bv@do{\BRversestyle{#1}}}%
+\ifx\relax#2\@empty
\else
-\BRvsep
+\@bv@do{\BRvsep}%
\@do@verses#2\end
\fi
}
@@ -926,22 +943,26 @@ Unknown biblerefstyle '#1'}{}}{\csname brs@#1\endcsname}} % \begin{macrocode}
\newcommand{\bibleverse}[1]{%
\@ifundefined{br@#1}{\PackageError{bibleref}{Unknown book '#1'}{%
-}}{\BRbooktitlestyle{\csname br@#1\endcsname}}%
-\@ifnextchar({\BRbkchsep \@bibleverse}\relax
+}}{\@bv@idxsort{\csname br@#1\endcsname}%
+\def\@bv@chidxsort{}%
+\@bv@do{\BRbooktitlestyle{\csname br@#1\endcsname}}}%
+\@ifnextchar({\BRbkchsep\@bv@addtoidx{!}\@bibleverse}{\@end@@bibleverse}%
}
% \end{macrocode}
% Get the chapter number.
% \begin{macrocode}
\def\@bibleverse(#1:{%
\ifthenelse{\equal{#1}{}}{}{%
-\BRchapterstyle{#1}}%
+\ifthenelse{\equal{\@bv@chidxsort}{}}{%
+\def\@bvchidxsort{#1}\@bv@addtoidx{#1@}}{}%
+\@bv@do{\BRchapterstyle{#1}}}%
\@@bibleverse}
% \end{macrocode}
% Second part of a range spanning chapters.
% \begin{macrocode}
\def\@bibleverser-(#1:{%
\ifthenelse{\equal{#1}{}}{}{%
-\BRchapterstyle{#1}}%
+\@bv@do{\BRchapterstyle{#1}}}%
\@@bibleverse}
% \end{macrocode}
% Get the verse number (or number range), and check to see
@@ -949,9 +970,75 @@ Unknown biblerefstyle '#1'}{}}{\csname brs@#1\endcsname}} % chapter, verse pair).
% \begin{macrocode}
\def\@@bibleverse#1){%
-\ifthenelse{\equal{#1}{}}{}{\BRchvsep\@br@vrsty{#1}}%
-\@ifnextchar({\BRchsep\@bibleverse}%
-{\@ifnextchar-{\BRvrsep\@bibleverser}\relax}}
+\ifthenelse{\equal{#1}{}}{}{\@bv@do{\BRchvsep}\@br@vrsty{#1}}%
+\@ifnextchar({\@bv@do{\BRchsep}\@bibleverse}%
+{\@ifnextchar-{\@bv@do{\BRvrsep}\@bibleverser}{\@end@@bibleverse}}}
+% \end{macrocode}
+% This controls what to do at the end of the final
+% verse.
+% \begin{macrocode}
+\newcommand{\@end@@bibleverse}{%
+\if@bv@idx
+\index{\@@bv@idxsort\relax @\@bv@idxentry|\@bv@idxpgformat}%
+\@bv@idxfalse
+\fi
+}
+% \end{macrocode}
+% Do argument and add to idx
+% \begin{macrocode}
+\newcommand{\@bv@do}[1]{#1\@bv@addtoidx{#1}}
+% \end{macrocode}
+% Append text to \verb|\@bv@idxentry|
+% \begin{macrocode}
+\toksdef\@bv@tmpa=0
+\toksdef\@bv@tmpb=2
+\newcommand{\@bv@addtoidx}[1]{%
+\if@bv@idx
+\@bv@tmpa={#1}%
+\@bv@tmpb=\expandafter{\@bv@idxentry}%
+\edef\@bv@idxentry{\the\@bv@tmpb\the\@bv@tmpa}%
+\fi}
+% \end{macrocode}
+% Append text to \verb|\@@bv@idxsort|
+% \begin{macrocode}
+\newcommand{\@bv@addtoidxsort}[1]{%
+\if@bv@idx
+\@bv@tmpa={#1}%
+\@bv@tmpb=\expandafter{\@@bv@idxsort}%
+\edef\@@bv@idxsort{\the\@bv@tmpb\the\@bv@tmpa}%
+\fi}
+% \end{macrocode}
+% Define switch to indicate whether or not to index
+% bible reference.
+% \begin{macrocode}
+\newif\if@bv@idx
+\@bv@idxfalse
+% \end{macrocode}
+% 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}
+% Define \verb|\ibibleverse|. This is like \verb|\bibleverse|,
+% but also adds an index entry. The optional argument indicates
+% how to format the page number (without the preceeding backslash)
+% e.g. \verb|\ibibleref[textit]{Romans}|.
+% \begin{macrocode}
+\newcommand{\ibibleverse}[1][\bvidxpgformat]{%
+\def\@bv@idxpgformat{#1}%
+\@bv@idxtrue\def\@bv@idxentry{}\bibleverse}
+% \end{macrocode}
+% Default page number format for bible verse index entries
+% \begin{macrocode}
+\newcommand{\bvidxpgformat}{textrm}
% \end{macrocode}
% \begin{macrocode} %</bibleref.sty> @@ -961,9 +1048,15 @@ Unknown biblerefstyle '#1'}{}}{\csname brs@#1\endcsname}} % \end{macrocode} %\subsection{Sample Document}
% \begin{macrocode}
-\documentclass{ltxdoc}
+\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}
@@ -972,9 +1065,9 @@ Unknown biblerefstyle '#1'}{}}{\csname brs@#1\endcsname}} Long citation in text:
\biblerefstyle{text}
-\bibleverse{IICor}(12:15,18,21-32).
+\bibleverse{IICor}(12:15,18,21-33).
Short citation in footnote\footnote{%
-\biblerefstyle{chicago}\bibleverse{IICor}(12:15,18,21-32)}.
+\biblerefstyle{chicago}\bibleverse{IICor}(12:15,18,21-33)}.
\section{Default Style}
@@ -1168,6 +1261,25 @@ has verses in lower case Roman numerals, and redefines \bibleverse{IChronicles}(1:3)-(2:7)
\end{tabular}
+\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{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)
+\end{tabular}
+
+\printindex
+
\end{document}
% \end{macrocode}
% \begin{macrocode} |