[NTG-context] Re: Why aren't cross-references working in tabulate?

2024-03-15 Thread Joel via ntg-context
 Thank you! The solution worked!

On Friday, March 15, 2024 at 02:30:40 PM MDT, Wolfgang Schuster 
 wrote:  
 
 Joel via ntg-context schrieb am 15.03.2024 um 20:50:
> When I run this code, \at{page}[xyz] is unable to find the cross reference:
> 
> \starttext
> %\reference[xyz]{}
> \starttabulate[|lp(.3\textwidth)|lp(.\textwidth)|]
> \NC    \reference[xyz]{} \NC \NC\NR

\NC \doifnotmode{*trialtypesetting}{\pagereference[xyz]} \NC \NC\NR

> \stoptabulate
> 
> 
> \pagebreak
> 
> \at{page}[xyz]
> 
> \stoptext
> 
> The code does work when I uncomment line #2, revealing the 
> cross-references work find when outside of a table.
> 
> I also tried using a TABLE environment instead and the result was 
> similar, it wouldn't show the page number.
> 
> What am I doing wrong?

Tabulate and natural tables process the table content multiple times and 
therefore you're setting the reference multiple times, to avoid this 
check for trialtypesetting mode and set the reference only when you're 
out of the mode.

@Hans: Can we add the check trialtypesetting check to \reference etc.?

\protected\def\strc_references_set_named_reference
- {\ifreferencing
+ {\iftrialtypesetting
+    \expandafter\gobblefourarguments
+  \orelse\ifreferencing
      \expandafter\strc_references_set_named_reference_indeed
    \else
      \expandafter\gobblefourarguments
    \fi}

Wolfgang
___
If your question is of interest to others as well, please add an entry to the 
Wiki!

maillist : ntg-context@ntg.nl / 
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
___
  ___
If your question is of interest to others as well, please add an entry to the 
Wiki!

maillist : ntg-context@ntg.nl / 
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
___


[NTG-context] Re: Why aren't cross-references working in tabulate?

2024-03-15 Thread Wolfgang Schuster

Joel via ntg-context schrieb am 15.03.2024 um 20:50:

When I run this code, \at{page}[xyz] is unable to find the cross reference:

\starttext
%\reference[xyz]{}
\starttabulate[|lp(.3\textwidth)|lp(.\textwidth)|]
\NC    \reference[xyz]{} \NC \NC\NR


\NC \doifnotmode{*trialtypesetting}{\pagereference[xyz]} \NC \NC\NR


\stoptabulate


\pagebreak

\at{page}[xyz]

\stoptext

The code does work when I uncomment line #2, revealing the 
cross-references work find when outside of a table.


I also tried using a TABLE environment instead and the result was 
similar, it wouldn't show the page number.


What am I doing wrong?


Tabulate and natural tables process the table content multiple times and 
therefore you're setting the reference multiple times, to avoid this 
check for trialtypesetting mode and set the reference only when you're 
out of the mode.


@Hans: Can we add the check trialtypesetting check to \reference etc.?

\protected\def\strc_references_set_named_reference
- {\ifreferencing
+ {\iftrialtypesetting
+\expandafter\gobblefourarguments
+  \orelse\ifreferencing
 \expandafter\strc_references_set_named_reference_indeed
   \else
 \expandafter\gobblefourarguments
   \fi}

Wolfgang
___
If your question is of interest to others as well, please add an entry to the 
Wiki!

maillist : ntg-context@ntg.nl / 
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
___