On 9/20/2025 9:10 AM, Max Chernoff via ntg-context wrote:
Hi Hans,

I found a rather perplexing bug. Sample document:

Come on, if i observe right, you're not perplexed that fast ...

Search for \protected\def\publ_cite_set_meaning#1% and comment these lines and do some tests.

   % \setupbtx
   %   [\c!specification=\v!default]%

you can also say:

% \disableexperiments[structure.tags.blobs.cite]

it's a side effect of "playing tagged pdf" where we add bibtex entries and an alt text because the citation stuff in pdf is as crappy as much else in there
     \setuptagging[state=start] %% Works with this line commented out

     \usebtxdefinitions[aps]

     \startluacode
         local fields = { "mycustomfield" }
         for _, category in pairs(publications.specifications.aps.categories) do
             for _, field in ipairs(fields) do
                 category.fields[field] = "optional"
             end
         end
     \stopluacode

     \starttexdefinition mutable protected btx:aps:note
         <\btxflush{mycustomfield}>
     \stoptexdefinition

     \startbuffer[bibliography]
         @article{example,
             author = {The Author},
             title = {A short title},
             journal = {Some journal},
             year = {2025},
             volume = {9},
             number = {99},
             mycustomfield = {This is my new field!},
         }
     \stopbuffer

     \usebtxdataset[bibliography.buffer]

     \starttext
         \cite[example] %% Works with this line commented out
         \nocitation[example]

         \page %% Works with this line commented out

         \placelistofpublications
     \stoptext

If you compile it with "--once", on the first run the bibliography is
empty (as expected), and then on the second run, "<This is my new
field!>" shows up (also as expected), but on the third and subsequent
runs, I just get "<>" (which is surprising). This problem goes away with
tagging disabled, with the bibliography on the same page as the
citation, or if "\nocitation" is used instead of "\cite".

This works correctly with versions "2024.02.27 09:18" and "2023.05.05
18:36", and is broken with versions "2025.08.20 10:30" and "2025.09.19
18:32". On the older versions, MkIV also works correctly, but on the
newer/broken versions, MkIV gives an undefined cs error on
"\btxstarttaggedcite".
ok, i'll fix that, lucky us that most users are on lmtx

ps. Mikael pointed me to a question on SE about numbers and I looked into that. Then when we discussed it we noticed that you posted a solution which uses the 'used' which indeed is what is needed. But it's a bit nasty to overload numbercommand which is why i made a hack a bit deeper down.

I added an extra checker so that one can do things like

\doifelsesomething
  {\expand\getreference[used][\currentplaceformulareference]}

and \doifelsereferenced as checker. We're still pondering if it should be a feature (trivial patch) as it's kind of weird to have numbered formulas this way.

A possible key/value could be numberstate=auto unless Wolfgang objects.

But for the SE user your solution is ok and will keep working because that low level structure stuff is stable and proper context (of course the meaning of 'used' is kind of useles here and i had better not default it).

Hans


-----------------------------------------------------------------
                                          Hans Hagen | PRAGMA ADE
              Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
       tel: 038 477 53 69 | www.pragma-ade.nl | www.pragma-pod.nl
-----------------------------------------------------------------
___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the 
Wiki!

maillist : [email protected] / 
https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl
webpage  : https://www.pragma-ade.nl / https://context.aanhet.net (mirror)
archive  : https://github.com/contextgarden/context
wiki     : https://wiki.contextgarden.net
___________________________________________________________________________________

Reply via email to