From a343e3a55036d618f1ebcc52b94838a6d9ba352f Mon Sep 17 00:00:00 2001
From: Norbert Preining <norbert@preining.info>
Date: Sat, 16 Jun 2018 14:43:57 +0900
Subject: add fetchbibpes

---
 .../latex/fetchbibpes/examples/bibpes_replace.tex  | 125 +++++++++++++++++++++
 1 file changed, 125 insertions(+)
 create mode 100644 texmf-dist/doc/latex/fetchbibpes/examples/bibpes_replace.tex

(limited to 'texmf-dist/doc/latex/fetchbibpes/examples/bibpes_replace.tex')

diff --git a/texmf-dist/doc/latex/fetchbibpes/examples/bibpes_replace.tex b/texmf-dist/doc/latex/fetchbibpes/examples/bibpes_replace.tex
new file mode 100644
index 00000000..7fd9f1d4
--- /dev/null
+++ b/texmf-dist/doc/latex/fetchbibpes/examples/bibpes_replace.tex
@@ -0,0 +1,125 @@
+\documentclass{article}
+%\usepackage{array,calc}
+\usepackage{xcolor}
+% useverses=none avoids a warning in the log when there is not value for
+% userverses. In this document we define our verses 'by hand' using the
+% declareBVs environment.
+\usepackage[ignorecfg,useverses=none]{fetchbibpes}[2016/09/19]
+
+\providecommand\cs[1]{\texttt{\char`\\#1}}
+\let\pkg\texttt
+
+\addtoBibles{NKJV}
+
+\begin{document}
+
+\section{Highlighting the replace key.}
+
+As described in the \texttt{fetchbibpes\_man.pdf}, we can search and replace
+text for a single passage created by \cs{fetchverse}. In this document, we
+demonstrate the basic features of the \texttt{replace} key and demonstrate
+some `radical' applications as well.
+
+We begin with an environment not documented in \texttt{fetchbibpes\_man.pdf},
+the \texttt{declareBVs} environment.
+\begin{verbatim}
+\begin{declareBVs}
+\BV(Mat 2:1 KJV) Now when Jesus was born in Bethlehem of Judaea
+in the days of Herod the king, behold, there came wise men from
+the east to Jerusalem,\null
+\end{declareBVs}
+\end{verbatim}
+Its used to define a Bible passage as seen in the DEF file. It is useful
+declaring a passage or two under discussion. The syntax for the argument of
+\cs{BV} is explained in the reference manual of \pkg{fetchbibpes}. Once
+declared, we can use it.
+\begin{declareBVs}
+\BV(Mat 2:1 KJV) Now when Jesus was born in Bethlehem of Judaea in the days
+of Herod the king, behold, there came wise men from the east to Jerusalem,\null
+\end{declareBVs}
+
+This verse is fetched as follows.
+\begin{quote}
+\fetchverse{Mat 2:1}
+\end{quote}
+The verse continues to the next passage (Mat 2:2) and ends with a comma. As
+this is a stand alone quotation, we want to end the passage with a period
+instead. There are two commas in the verse, we replace the comma that follows
+`Jerusalem'.
+\begin{quote}
+\verb|\fetchverse[replace={Jerusalem,}{Jerusalem.}]{Mat 2:1}|\\[3pt]
+\fetchverse[replace={Jerusalem,}{Jerusalem.}]{Mat 2:1}
+\end{quote}
+For the second example, we do two replacements: (1) replace the comma
+following `\texttt{Jerusalem}' with a period; and (2) change every instance
+of `\texttt{Jesus}' to `\verb|\textbf{\textcolor{red}{Jesus}}|', just because
+we can.
+\begin{quote}
+\verb|\fetchverse[replace={Jerusalem,}{Jerusalem.}|\\
+\null\hskip20pt\verb|{Jesus}{\textbf{\textcolor{red}{Jesus}}}]{Mat 2:1}|\\[3pt]
+\fetchverse[replace={Jerusalem,}{Jerusalem.}
+{Jesus}{\textbf{\textcolor{red}{Jesus}}}]{Mat 2:1}
+\end{quote}
+\let\bMrk\relax\let\eMrk\relax
+\begin{declareBVs}
+\BV(Gen 1:1 KJV Mrk)  In the \bMrk beginning God \eMrk %
+created the heaven and the earth.\null
+\end{declareBVs}
+Generally, commands in the first argument are discouraged, but they can be
+used very carefully. In the example below, we test a couple of things. We
+defined a new passage
+\begin{verbatim}
+\letEach\bit\eit\bCol\eCol\to\relax
+\BV(Gen 1:1 KJV Mrk) In the \bMrk beginning God \eMrk created %
+    the heaven and the earth.\null
+\end{verbatim}
+We've marked off arbitrary text for manipulation. In the example below, we
+(1)~change all text between the markers to bold and red; (2) change the bold
+(\cs{bfseries}) to san-serif (\cs{sffamily}); (3)~convert \cs{sffamily} to
+\cs{ttfamily}. The code is,
+\begin{verbatim}
+\fetchverse[%
+    replace={\bMrk}{\bgroup\protect\bfseries\protect\color{red}}
+    {\eMrk}{\egroup}{\bfseries}{\sffamily}{\sffamily}{\ttfamily},
+alt=Mrk]{Gen 1:1}
+\end{verbatim}
+Note the use of \cs{protect} in the first replacement text, this prevents \cs{bfseries}
+and \cs{color} from being expanded into their primitive definitions; consequently, the
+tokens \cs{bfseries} and \cs{color} are still present by the time of the second search.
+
+Will it work? I wouldn't have wasted my time typing this out
+if it didn't! Here goes!
+\begin{fpquote}[rightmargin=0pt]
+\fetchverse[replace={\bMrk}{\bgroup\protect\bfseries\protect\color{red}}{\eMrk}{\egroup}
+{\bfseries}{\sffamily}{\sffamily}{\ttfamily},alt=Mrk]{Gen 1:1}
+\end{fpquote}
+Ho, ho, it worked!
+
+\letEach\bit\eit\bCol\eCol\to\relax
+\begin{declareBVs}
+\BV(Mat 8:10 NKJV Mrk) When Jesus heard \bit it\eit, %
+He marveled, and said to those who followed, \bCol"Assuredly, %
+I say to you, I have not found such great faith, not even in %
+Israel!\eCol\null
+\end{declareBVs}
+
+\medskip\noindent
+Here's another crazy idea. Consider the following passage:
+\begin{verbatim}
+\letEach\bit\eit\bCol\eCol\to\relax
+\begin{declareBVs}
+\BV(Mat 8:10 NKJV Mrk) When Jesus heard \bit it\eit, He marveled,
+and said to those who followed, \bCol"Assuredly, I say to you,
+I have not found such great faith, not even in Israel!\eCol\null
+\end{declareBVs}
+\end{verbatim}
+The passage is marked up several commands \cs{let} to \cs{relax}. If no replacement occurs, the passage should
+appear normally, without any special formatting. However, if we do a nice replacement, we get formatting.
+\begin{quote}
+\fetchverse[replace={\bit}{\textit\bgroup}{\eit}{\egroup}
+{\bCol}{\bgroup\color{red}}{\eCol}{\egroup}{!}{!''},from*=NKJV,alt=Mrk]{Mat 8:10}\bDQ
+\end{quote}
+The Words of Jesus continue on to the next verse, not displayed, so we'll replace the final exclamation
+point (\texttt{!}) with `\verb|!''|'.
+
+\end{document}
-- 
cgit v1.2.3

