This actually seems to be rooted in a more general problem with the
publications support module. Why does invoking the fastsetup for citations
work within the default footnote setup, but not within endnotes flushed via
\placenotes[footnote]? If I modify the original MWE to use ConTeXt's
default btx rendering, I get the same error:

```
\startbuffer [bib]

@Book{clark1989,
author = {Clark, William},
title = {Railroads \word{and} railroad towns \word{in} New Mexico},
publisher = {New Mexico Magazine},
year = {1989},
address = {Albuquerque, New Mexico},
isbn = {9780937206126}
}

\stopbuffer

\usebtxdataset[bib.buffer]

\setupbtx[dataset=default]

\setupnote[footnote][location=none] % commenting out this line will produce
footnotes that expand the citation correctly

\starttext

   \input knuth
    \cite[alternative=footnote][clark1989]
    \page
    \placenotes[footnote]

    \startchapter[title=Bibliography]
        \placelistofpublications
    \stopchapter

\stoptext
```

If it helps, the relevant code in publications support is the following
block in publ-imp-cite.mkvi:

```
\startsetups \s!btx:\s!cite:footnote
    \startfootnote
        \fastsetup{btx:cite:entry}
    \stopfootnote
\stopsetups
```

The \fastsetup{btx:cite:entry} doesn't expand to anything if the footnote
is flushed as an endnote via \placenotes[footnote]. Does anyone have any
idea why this happens and how to fix it?

Joey

On Sat, Dec 25, 2021 at 3:34 PM Joey McCollum <jmccollum20140...@gmail.com>
wrote:

> A reasonable solution for the time being would be to check if the
> righttext argument is empty, and add a final period in the footnote only if
> it is not (with the assumption being that the user would provide
> punctuation in any righttext for footnote/endnote citations). I've pushed
> the following change to the GitHub repo, if you'd like to pull and use it:
>
> ```
> % 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
>   \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
> ```
>
> This should allow your script to compile, but unfortunately, it doesn't
> seem to make endnotes work, at least not when I try it. For some reason,
> the macro \Word{\fastsetup{btx:sbl:cite:inline}} is expanding to nothing
> inside the \startfootnote ... \stopfootnote environment. I have no idea why
> this is happening, so any ideas are appreciated.
>
> Joey
>
> On Sat, Dec 25, 2021 at 1:11 PM Joey McCollum <jmccollum20140...@gmail.com>
> wrote:
>
>> Joel,
>>
>> You may not have done anything wrong; this may be an issue with
>> ConTeXt-SBL. In my code for the btx:sbl:cite:footnote setup in
>> publ-imp-sbl.mkvi, I added a comment to this effect:
>>
>> ```
>> \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...
>>   \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, unless the righttext ends with punctuation
>>     \doifendswithpunctelse{\btxparameter{righttext}} {
>>       \removeunwantedspaces
>>     } {
>>       \removeunwantedspaces
>>       \btxperiod
>>     }
>>   \stopfootnote
>>   \endgroup
>>
>> \doifnotinstring{\btxparameter{punct}}{\btxparameter{autopunctuation}}{\btxparameter{punct}}
>> \stopsetups
>> ```
>>
>> I define the \btx_sbl_doifendswithpunctelse macro earlier in the module.
>> Initially, when I tried to invoke this macro within the \startfootnote ...
>> \stopfootnote environment (to conditionally add a period at the end of a
>> footnote citation if it does not have a righttext ending with punctuation),
>> I got the same error you got, but for \btx_sbl_doifendswithpunctelse. I
>> wasn't sure why this was happening, so I tried defining a new
>> \doifendswithpunctelse macro. Unfortunately, based on your e-mail, it looks
>> like this doesn't actually fix the problem.
>>
>> Any help from other developers would be appreciated here! Unfortunately,
>> I don't have a MWE replicating the problem on hand at the moment.
>>
>> Joey
>>
>> On Sat, Dec 25, 2021 at 1:04 PM Joel via ntg-context <ntg-context@ntg.nl>
>> wrote:
>>
>>> I am using the ConTeXt-SBL package for citations. I need to move my
>>> footnotes to the end of each article.
>>>
>>> According to the manual, I can suppress the placement of footnotes using
>>> two lines of code. I've added these to my minimal working code, placing 
>>> \setupnote[footnote][location=none]
>>> in the header and \placenotes[footnote] where I want the endnotes to
>>> appear. It complains this error:
>>>
>>> "Undefined control sequence \doifendswithpunctelse"
>>>
>>> What did I do wrong?
>>>
>>> --Joel
>>>
>>> Code follows:
>>>
>>> \usemodule[publ-imp-sbl]
>>> \startbuffer [bib]
>>>
>>> @Article{na2006,
>>> title={Volcanoes \word{of} New Mexico},
>>> year={2006},
>>> journal={New Mexico Earth Matters},
>>> publisher={New Mexico Bureau \word{of} Geology \word{and} Mineral
>>> Resources},
>>> volume={6},
>>> number={1},
>>> location={Socorro, New Mexico}
>>> }
>>>
>>> @Book{clark1989,
>>> author = {Clark, William},
>>> title = {Railroads \word{and} railroad towns \word{in} New Mexico},
>>> publisher = {New Mexico Magazine},
>>> year = {1989},
>>> address = {Albuquerque, New Mexico},
>>> isbn = {9780937206126}
>>> }
>>>
>>> \stopbuffer
>>>
>>> \usebtxdataset[bib.buffer]
>>>
>>> \setupbtx[dataset=default]
>>> \usebtxdefinitions[sbl]
>>> \setupbtx[sbl]
>>>
>>> \setupnote[footnote][location=none]
>>>
>>> \starttext
>>>
>>>    \input knuth
>>>     \cite[clark1989]
>>>
>>>     \placenotes[footnote]
>>>
>>>
>>>     \startchapter[title=Bibliography]
>>>         \placelistofpublications
>>>     \stopchapter
>>>
>>> \stoptext
>>>
>>>
>>> ___________________________________________________________________________________
>>> If your question is of interest to others as well, please add an entry
>>> to the Wiki!
>>>
>>> maillist : ntg-context@ntg.nl /
>>> http://www.ntg.nl/mailman/listinfo/ntg-context
>>> webpage  : http://www.pragma-ade.nl / http://context.aanhet.net
>>> archive  : https://bitbucket.org/phg/context-mirror/commits/
>>> wiki     : http://contextgarden.net
>>>
>>> ___________________________________________________________________________________
>>>
>>
___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the 
Wiki!

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

Reply via email to