Re: [NTG-context] error with sbl bibliography on latest LMTX

2022-07-09 Thread Joey McCollum via ntg-context
Sorry, these are definitely errors on my part. The first one ("invalid
parent sbl:list:title:unpublished for sbl:list:title:thesis,
sbl:list:title:unpublished defined too") was thankfully an easy fix; I just
had to move \definebtx[sbl:\s!list:title:unpublished] before
\definebtx[sbl:\s!list:title:thesis]. I've now pushed this change to the
repo at https://github.com/jjmccollum/context-sbl.

The second error ("Undefined control sequence \currentbtxloctext") is
unfortunately more puzzling. In an effort to preserve backward
compatibility with biblatex usage, I focused on implementing citations in
the SBL style using \autocite, \inlinecite, \parencite, and \footcite
commands, and I neglected to see if the ConTeXt \cite command would work as
expected.

The \currentbtxloctext macro is used for handling more complicated
situations regarding volume, part, page number, etc. citations; for the
purposes of your MWE (and for most citations) a righttext with the page
number citation should also work just fine, so the lack of a loctext
parameter in the \cite command shouldn't be a problem. The
\currentbtxloctext macro is defined in most of the btx:sbl:cite setups in
publ-imp-sbl.mkvi, always via the command

```
\def\currentbtxloctext{\btxparameter{loctext}}
```

The default value of this parameter and similar ones should be \empty, per
the \definebtx[sbl] command in publ-imp-sbl.mkvi:

```
\definebtx
  [sbl]
  [
  ...
  lefttext=\empty, % empty by default
  altloctext=\empty, %empty by default
  loctext=\empty, %empty by default
  righttext=\empty, % empty by default
  punct=\empty, % trailing punctuation (empty by default)
  ...
  ]
```

If I've coded this correctly, then the loctext parameter should default to
\empty when you do not specify it for your \cite command. This seems to be
the case when you first invoke the \cite command (i.e., in the
btx:sbl:cite:footnote setup).

Here is the problem: if you invoke the btx:sbl:cite:inline setup from
inside the btx:sbl:cite:footnote setup, it seems that the loctext parameter
is no longer accessible, and thus, it does not get defined. If I patch the
btx:sbl:cite:footnote setup as follows, then I no longer get the "Undefined
control sequence \currentbtxloctext" error:

```
% Inline footnote citation setup (with intelligent trailing punctuation
replacement)
\startsetups btx:sbl:cite:footnote
  \removeunwantedspaces

\doifinstring{\btxparameter{punct}}{\btxparameter{autopunctuation}}{\btxparameter{punct}}
  \begingroup
  \letbtxparameter{punct}\empty % don't pass the trailing punctuation down
to the inline setup
  \let\doifendswithpunctelse\btx_sbl_doifendswithpunctelse % why is this
necessary? For some reason, \btx_sbl_doifendswithpunctelse is not
recognized within the footnote environment...
  \def\currentbtxcitealternative{footnote}
  \def\currentbtxcategory{\btxfield{category}}
  \def\currentbtxloctext{\btxparameter{loctext}}
  \def\currentbtxaltloctext{\btxparameter{altloctext}}
  \startfootnote
\Word{\fastsetup{btx:sbl:cite:inline}}% capitalize the first word in
the footnote (needed to render "Ibid." and "Idem" correctly)
% Add a closing period if there is no righttext
\doif{\btxparameter{righttext}}{\empty} {
  \btxperiod
}
  \stopfootnote
  \endgroup

\doifnotinstring{\btxparameter{punct}}{\btxparameter{autopunctuation}}{\btxparameter{punct}}
\stopsetups
```

But I still get errors involving other macros that now appear to be
undefined—specifically, the \btxsblshorthandbeforeloctext macro (and,
likely, the \btxsblvolumebeforeloctext macro, as well). These are initially
defined as "no" in the SBL style module outside of the various citation
alternative setups, but they are conditionally redefined as "yes" in these
setups based on specific information in the bibliographic entry.

This pattern suggests a bigger problem. Do these variables and the \cite
parameters fall out of scope when we enter a footnote environment inside a
setup? In my code, I noticed that a macro defined outside of the
btx:sbl:cite:footnote setup was unrecognized within the footnote
environment unless I freshly redefined it:

```
\let\doifendswithpunctelse\btx_sbl_doifendswithpunctelse % why is this
necessary? For some reason, \btx_sbl_doifendswithpunctelse is not
recognized within the footnote environment...
```

Meanwhile, if I change the default citation alternative to "inline" or
"paren", then everything works:

```

\usebtxdataset[default][references.bib]

\setupbtx[dataset=default]

\usebtxdefinitions[sbl]

\setupbtx[sbl:cite][alternative=paren] % or alternative=inline

\setupinteraction[state=start]


\starttext


superior typographic output \cite[lefttext={e.g.}][taraborelli:beauty].


Therefore, the {\TEX}book mentions that the word

\quotation{shel\noligature{ff}ul} should indeed be rendered without the

ff-ligature \cite[righttext={p.~19}][knuth:texbook].


\placelistofpublications%[numbering=yes]


\stoptext
```

I realize that the above "fix" does not truly solve the p

[NTG-context] error with sbl bibliography on latest LMTX

2022-07-08 Thread Henning Hraban Ramm via ntg-context

Hi Joel (et al.),

I tried the SBL bibliography setup with the latest LMTX; the example and 
bib database are from Dennis’ article on ligatures in the upcoming CG 
journal:


"""
\usebtxdataset[default][references.bib]
\setupbtx[dataset=default]
\usebtxdefinitions[sbl]
\setupinteraction[state=start]

\starttext

superior typographic output \cite[lefttext={e.g.}][taraborelli:beauty].

Therefore, the {\TEX}book mentions that the word 
\quotation{shel\noligature{ff}ul} should indeed be rendered without the 
ff-ligature  \cite[righttext={p.~19}][knuth:texbook].


\placelistofpublications%[numbering=yes]

\stoptext
"""

Unfortunately, I get some errors, while it works with APS and APA:

-- invalid parent sbl:list:title:unpublished for sbl:list:title:thesis, 
sbl:list:title:unpublished defined too (best check it)

-- Undefined control sequence \currentbtxloctext

I installed your files in TEXMFHOME, and apparently, ConTeXt can find 
them. Here’s the shortened log:


system  > ConTeXt  ver: 2022.05.11 11:36 LMTX  fmt: 2022.7.4 
int: english/english

...
open source > level 1, order 2, name './bibtest.tex'
publications> adding bib data to set 'default' from source 
'references.bib'
open source > level 2, order 3, name 
'/Users/hraban/texmf/context/context-sbl/tex/publ-imp-sbl.mkvi'
system  > error: invalid parent sbl:list:title:unpublished for 
sbl:list:title:thesis, sbl:list:title:unpublished defined too (best 
check it)
close source> level 2, order 3, name 
'/Users/hraban/texmf/context/context-sbl/tex/publ-imp-sbl.mkvi'

...
publications> analyzing previous publication run for 'default'
tex error   > tex error on line 34 in file ./bibtest.tex: Undefined 
control sequence \currentbtxloctext


 \22>:btx:sbl:cite:inline
#1->\fastsetup {\s!btx :\s!cite :concat}\fastsetup 
{btx:sbl:cite:lefttext}\begingroup \letbtxparameter {punct}\empty \def 
\currentbtxcitealternative {inline}\def \currentbtxcategory {\btxfield 
{category}}\def \currentbtxloctext

{\btxparameter {loctex
 \normalexpanded
\Word {\fastsetup {btx:sbl:cite:inline}
}\doif {\btxparameter {righttext}}{\empty } {\btxperiod }
 \strc_constructions_register_yes
...constructionparameter \c!referencetext }\iflocation \ifempty 
\currentconstructionbookmark \begingroup \simplifycommands \xdef 
\currentconstructionbookmark {\detokenize \expandafter {\normalexpanded 
{\constructionparameter \c!title

}}}\endgroup  ...
 \strc_notations_start_reference_indeed
[#1]#*#2->\strc_constructions_register [][\c!label 
={\descriptionparameter \c!text },\c!reference ={#1},\c!title 
={#2},\c!bookmark =,\c!list =,\c!referencetext =]

\strc_notations_wrapup
 \22>:btx:sbl:cite:footnote
...ct}}\begingroup \letbtxparameter {punct}\empty \let 
\doifendswithpunctelse \btx_sbl_doifendswithpunctelse \startfootnote 
\Word {\fastsetup {btx:sbl:cite:inline}}\doif {\btxparameter 
{righttext}}{\empty } {\btxperiod }\stopfootnote

\endgroup \do ...

 ...


superior typographic output \cite[lefttext={e.g.}][taraborelli:beauty]
.

The control sequence at the end of the top line of your error message 
was never

\def'ed. You can just continue as I'll forget about whatever was undefined.
mtx-context | fatal error: return code: 1


Did I do something wrong, is the database not suitable for SBL, or is it 
a bug?



Hraban


references.bib
Description: application/bibtex
___
If your question is of interest to others as well, please add an entry to the 
Wiki!

maillist : ntg-context@ntg.nl / https://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : https://www.pragma-ade.nl / http://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki : https://contextgarden.net
___