diff options
author | Norbert Preining <norbert@preining.info> | 2019-09-02 13:46:59 +0900 |
---|---|---|
committer | Norbert Preining <norbert@preining.info> | 2019-09-02 13:46:59 +0900 |
commit | e0c6872cf40896c7be36b11dcc744620f10adf1d (patch) | |
tree | 60335e10d2f4354b0674ec22d7b53f0f8abee672 /macros/latex/contrib/bibletext |
Initial commit
Diffstat (limited to 'macros/latex/contrib/bibletext')
-rw-r--r-- | macros/latex/contrib/bibletext/LICENSE | 21 | ||||
-rw-r--r-- | macros/latex/contrib/bibletext/README.md | 6 | ||||
-rw-r--r-- | macros/latex/contrib/bibletext/bibletext.pdf | bin | 0 -> 139812 bytes | |||
-rw-r--r-- | macros/latex/contrib/bibletext/bibletext.sty | 61 | ||||
-rw-r--r-- | macros/latex/contrib/bibletext/bibletext.tex | 76 |
5 files changed, 164 insertions, 0 deletions
diff --git a/macros/latex/contrib/bibletext/LICENSE b/macros/latex/contrib/bibletext/LICENSE new file mode 100644 index 0000000000..38669306c2 --- /dev/null +++ b/macros/latex/contrib/bibletext/LICENSE @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) 2016-2017 Camil Staps + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/macros/latex/contrib/bibletext/README.md b/macros/latex/contrib/bibletext/README.md new file mode 100644 index 0000000000..69bc09e9b6 --- /dev/null +++ b/macros/latex/contrib/bibletext/README.md @@ -0,0 +1,6 @@ +# bible +LaTeX bibletext package + +Copyright © 2016 Camil Staps. Licensed under MIT (see the LICENSE file). + +This is a LaTex package that allows you to insert Bible texts in a document by specifying references. Compile `bibletext.tex` to get the documentation. diff --git a/macros/latex/contrib/bibletext/bibletext.pdf b/macros/latex/contrib/bibletext/bibletext.pdf Binary files differnew file mode 100644 index 0000000000..28324fe464 --- /dev/null +++ b/macros/latex/contrib/bibletext/bibletext.pdf diff --git a/macros/latex/contrib/bibletext/bibletext.sty b/macros/latex/contrib/bibletext/bibletext.sty new file mode 100644 index 0000000000..21abb5a97d --- /dev/null +++ b/macros/latex/contrib/bibletext/bibletext.sty @@ -0,0 +1,61 @@ +\NeedsTeXFormat{LaTeX2e}[1994/06/01] +\ProvidesPackage{bibletext} + [2017/09/01 v0.1.2 Insert Bible texts] + +\newif\ifbibletext@defined +\bibletext@definedfalse +\newcommand{\bibletext@checkdefined}[1]{% + \ifcsname#1\endcsname% + \bibletext@definedtrue% + \else% + \bibletext@definedfalse% + \fi% +} + +\bibletext@checkdefined{DeleteShortVerb} +\ifbibletext@defined% + \DeleteShortVerb{\|}% +\fi + +\RequirePackage{pgfkeys} +\RequirePackage{pdftexcmds} + +\newif\ifbibletext@Ref +\newif\ifbibletext@OmitChapter +\newif\ifbibletext@OmitRepeatedChapter +\pgfkeys{ + /bibletext/.is family, /bibletext, + default/.style={ + translation=kjv, + ref=false, + omitchapter=false, + }, + translation/.estore in = \bibletext@Translation, % unused for now + ref/.is if=bibletext@Ref, + omitchapter/.is if=bibletext@OmitChapter, + omitrepeatedchapter/.is if=bibletext@OmitRepeatedChapter, +} +\newcommand\bibletext[2][]{% + \pgfkeys{/bibletext, default, #1}% + \ifbibletext@Ref% + \ifbibletext@OmitRepeatedChapter% + \input{|"bible -f '#2' | grep -o '[[:digit:]].*' | head -n1"}% + \input{|"bible -f '#2' | grep -o '[[:digit:]][[:digit:]]*[[:space:]].*' | tail -n+2"}% + \else\ifbibletext@OmitChapter% + \input{|"bible -f '#2' | grep -o '[[:digit:]][[:digit:]]*[[:space:]].*'"}% + \else% + \input{|"bible -f '#2' | grep -o '[[:digit:]].*'"}% + \fi\fi% + \else% + \input{|"bible -f '#2' | cut -d' ' -f2-"}% + \fi% + \unskip% +} +\AtEndOfPackage{ + \ifnum\pdf@shellescape=1\relax\else + \PackageError{bibletext} + {You must invoke LaTeX with the -shell-escape flag} + {Pass the -shell-escape flag to LaTeX. Refer to the bibletext.sty + documentation for more information.} + \fi} +\endinput diff --git a/macros/latex/contrib/bibletext/bibletext.tex b/macros/latex/contrib/bibletext/bibletext.tex new file mode 100644 index 0000000000..d51f86acd8 --- /dev/null +++ b/macros/latex/contrib/bibletext/bibletext.tex @@ -0,0 +1,76 @@ +\documentclass[a4paper]{ltxguide} + +\usepackage[hidelinks]{hyperref} + +\title{Typesetting Bible texts with the \textsf{bible} package} +\author{Camil Staps\footnote{info@camilstaps.nl}} +\date{Version 0.1.2\\2017-09-01} + +\usepackage{bibletext} + +\usepackage{framed} +\usepackage{minted} +\newenvironment{example} + {\VerbatimOut{\jobname.tmp}} + {\endVerbatimOut% + \begin{framed} + \setlength{\parskip}{-10pt} + \inputminted[gobble=8]{latex}{\jobname.tmp} + \medskip + \input{\jobname.tmp} + \end{framed}} + +\begin{document} + +\maketitle + +\section{Introduction} +This package allows you to add Bible texts by specifying references, + rather than copying the text into the document. + +Under the hood, this uses the \texttt{bible} command, + for which you need to install \texttt{bible-kjv}. +This means that by default you will have the KJV translation. +Because of the need for this package and other implementation details, + this package won't work on Windows. + +Because this package uses a binary program under the hood + (which is a potential security vulnerability), + you need to add the \texttt{-shell-escape} option to the command line arguments of your TeX processor. + +\section{Installation and source code} +The \textsf{bible} package is available from CTAN: \url{https://ctan.org/pkg/bibletext}. +The source code is on GitHub: \url{https://github.com/camilstaps/bibletext}. + +\section{Examples} +\begin{example} + \bibletext{Jn 1:1-2} +\end{example} + +\begin{example} + \bibletext[ref=true]{Jn 1:1-2} +\end{example} + +\begin{example} + \bibletext[ref=true,omitrepeatedchapter=true]{Jn 1:1-2} +\end{example} + +\begin{example} + \bibletext[ref=true,omitchapter=true]{Jn 1:1-2} +\end{example} + +\section{Future work} +\begin{itemize} + \item When \verb$omitrepeatedchapter=true$, + the chapter should again be outputted when a new chapter has begun. + \item The verse indications should be parsed and a \verb$\versefont$ command should be defined. + \item Implement the \verb$translation$ option to allow the writer to select a specific translation. +\end{itemize} + +\section{Incompatibilities} +The \textsf{bible} package needs to pipe shell commands, + for which it needs to do \verb$\DeleteShortVerb{\|}$. +This means that you cannot use \verb$|foo|$ as shorthand for \verb$\verb|foo|$% + \footnote{Credits go to egreg on TeX.SE, \url{http://tex.stackexchange.com/q/294732/23992}.}. + +\end{document} |