Closed hanetzer closed 10 months ago
Another note, could we perhaps put \name{}
command into the global namespace (whatever the right term for that is in latex), so one can make use of it within 'normal' text and maintain consistency?
I'll have a think, but my initial thought is that this is probably more specific than I'd want to include in the package. After all, there are a variety of ways that יהוה is pointed in the Masoretic text.
It's not difficult to implement with existing hooks and putting \name
in the global name space is straight forward for an end user:
% TeX Program = lualatex
\documentclass{article}
\pagestyle{empty}
\usepackage[australian, provide=*, bidi=basic]{babel}
\babelprovide[import]{hebrew}
\babelfont{rm}{Noto Serif}
\babelfont{sf}{Noto Sans}
\babelfont{tt}{Noto Sans Mono}
\babelfont[hebrew]{rm}[Renderer=Harfbuzz, Contextuals=Alternate]{SBL BibLit}
\usepackage{scripture}
\ExplSyntaxOn
\cs_new_protected_nopar:Nn \__hanetzer_name_format:n
{
\str_case:nnF {#1}
{
{ yhwh }
{
\normalfont
\foreignlanguage { hebrew } { יהוה }
}
{ YHWH }
{
\normalfont
\foreignlanguage { hebrew } { יְהֹוָה }
}
}
{#1}
}
\NewDocumentCommand { \name } { m }
{
\group_begin:
\l__scripture_name_font_tl
\__hanetzer_name_format:n {#1}
\group_end:
}
\scripturesetup
{
name / format = \__hanetzer_name_format:n {#1}
}
\ExplSyntaxOff
\begin{document}
\begin{scripture}
\name{Lord} \name{yhwh} \name{YHWH}
\end{scripture}
\name{Lord} \name{yhwh} \name{YHWH}
\end{document}
Ok, so I'm a relative novice with regards to the deeper intricacies of latex, aside from 'using' things that already exist. With regards to the above, could you break down which section is making yhwh/YHWH/etc, and which is moving \name to the global namespace?
Ok, so I'm a relative novice with regards to the deeper intricacies of latex, aside from 'using' things that already exist. With regards to the above, could you break down which section is making yhwh/YHWH/etc, and which is moving \name to the global namespace?
Sure!
The name/format
option to \scripturesetup
allows you to customise the format of the divine name. It's default is #1
(i.e., nothing special). But you can chance it to a custom function: name/format=\__hanetzer_name_format:n{#1}
.
The naming conventions of \__hanetzer_name_format:n
are documented in expl3.pdf
. (Run texdoc expl3
to see it on your local system.)
The \__hantzer_name_format:n
contains an expl3
case statement (\str_case:nn
) that checks the argument and does different things depending on whether it matches yhwh
or YHWH
. If the argument doesn't matter either of these then it's output unchanged. \str_case:nn
is documented in interface3.pdf
. Run texdoc interface3
to see this file. (This file documents all the expl3
API and is super useful.)
To put \name
in the global namespace, I just copied its definition out of scripture.sty
:
\NewDocumentCommand { \name } { m }
{
\group_begin:
\l__scripture_name_font_tl
\__scripture_name_format:n {#1}
\group_end:
}
The \group…
macros ensure any font changes (either set by the name/font
option or in the name/format
option) don't leak.
I've use \NewDocumentCommand
which is the new way of defining user level macros. It's documented in xparse.pdf
(texdoc xparse
).
Note that any expl3
functions need to be between \ExplSyntaxOn
and \ExplSyntaxOff
. Among other things, all white space is ignored between these macros.
Hope that helps.
Ah excellent, so the yhwh/YHWH case statement's 'default' clause just falls back to the original behavior with \name{Lord} and so forth then? That's simple enough (I do grok a few programming languages but aside from some very minor latex stuff I'm fairly ignorant of the syntax and keywords and whatnot). Very good.
Just an idea, but something like
\name{yhwh}
would produce yod heh waw heh without the vowel points,\name{YHWH}
would produce the same but with them,\name{yeshua}
etc.All this would be dependent on the end user having set up babel or the like to properly handle the non-roman script, but I figure anyone who'd use the above would have already set that up.