Re: [NTG-context] Convertnumber with \ref[number] fails in MkIV, works in LMTX

2022-12-06 Thread Hans Hagen via ntg-context

On 12/6/2022 10:04 PM, Rik Kabel via ntg-context wrote:


On 2022-12-06 15:32, Hans Hagen via ntg-context wrote:

On 12/6/2022 9:06 PM, Rik Kabel via ntg-context wrote:

\definelabel[X][text=]
\startTEXpage[offset=1cm]
   \X\X[a]\X[b]\X\par
   \convertnumber{R}{\ref[number][a]}
   \convertnumber{G}{\ref[number][b]}
\stopTEXpage


maybe like this:

\definelabel[X][text=]

\startTEXpage[offset=1cm]
  (\X)
  (\X[a])
  (\X[b])
  (\X)
  \par
  \doifelsereferencefound {a}
    {\convertnumber{number}{\currentreferencenumber}}
    {}
  \par
  \doifelsereferencefound {a}
    {\convertnumber{R}{\currentreferencenumber}}
    {}
  \par
  \doifelsereferencefound {b}
    {\convertnumber{G}{\currentreferencenumber}}
    {}
\stopTEXpage

-
  Hans Hagen | PRAGMA ADE


Perfect! Thank you.

It looks like \currentreference number is initially empty, and when 
\doifelsereferencefound succeeds it is set to that value, and remains 
set to that value until another \doifelsereferencefound is encountered. 
If \doifelsereferencefound fails, \currentreference is again empty. Is 
that correct?

yes, btw, there are some more \currentreference* available

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 : 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
___


Re: [NTG-context] Convertnumber with \ref[number] fails in MkIV, works in LMTX

2022-12-06 Thread Rik Kabel via ntg-context


On 2022-12-06 15:32, Hans Hagen via ntg-context wrote:

On 12/6/2022 9:06 PM, Rik Kabel via ntg-context wrote:

\definelabel[X][text=]
\startTEXpage[offset=1cm]
   \X\X[a]\X[b]\X\par
   \convertnumber{R}{\ref[number][a]}
   \convertnumber{G}{\ref[number][b]}
\stopTEXpage


maybe like this:

\definelabel[X][text=]

\startTEXpage[offset=1cm]
  (\X)
  (\X[a])
  (\X[b])
  (\X)
  \par
  \doifelsereferencefound {a}
    {\convertnumber{number}{\currentreferencenumber}}
    {}
  \par
  \doifelsereferencefound {a}
    {\convertnumber{R}{\currentreferencenumber}}
    {}
  \par
  \doifelsereferencefound {b}
    {\convertnumber{G}{\currentreferencenumber}}
    {}
\stopTEXpage

-
  Hans Hagen | PRAGMA ADE


Perfect! Thank you.

It looks like \currentreference number is initially empty, and when 
\doifelsereferencefound succeeds it is set to that value, and remains 
set to that value until another \doifelsereferencefound is encountered. 
If \doifelsereferencefound fails, \currentreference is again empty. Is 
that correct?


--
Rik

___
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
___


Re: [NTG-context] Convertnumber with \ref[number] fails in MkIV, works in LMTX

2022-12-06 Thread Hans Hagen via ntg-context

On 12/6/2022 9:06 PM, Rik Kabel via ntg-context wrote:

\definelabel[X][text=]
\startTEXpage[offset=1cm]
   \X\X[a]\X[b]\X\par
   \convertnumber{R}{\ref[number][a]}
   \convertnumber{G}{\ref[number][b]}
\stopTEXpage


maybe like this:

\definelabel[X][text=]

\startTEXpage[offset=1cm]
  (\X)
  (\X[a])
  (\X[b])
  (\X)
  \par
  \doifelsereferencefound {a}
{\convertnumber{number}{\currentreferencenumber}}
{}
  \par
  \doifelsereferencefound {a}
{\convertnumber{R}{\currentreferencenumber}}
{}
  \par
  \doifelsereferencefound {b}
{\convertnumber{G}{\currentreferencenumber}}
{}
\stopTEXpage

-
  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 : 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
___


Re: [NTG-context] two issues with variable fonts

2022-12-06 Thread Henning Hraban Ramm via ntg-context

Am 06.12.22 um 19:56 schrieb Pablo Rodriguez via ntg-context:

On 12/4/22 22:16, Henning Hraban Ramm via ntg-context wrote:

[...]
An increasing number of fonts in the Google repository is (becoming)
variable. So far, I only used the additionally provided fixed versions...


Hi Hraban,

I have just added a first draft about variable font usage:
https://wiki.contextgarden.net/Variable_Fonts.

Would you be so kind to improve it?


As I wrote: I never used variable fonts.
While it would be interesting to try, I’ll hardly find time until new year.

Hraban

___
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
___


Re: [NTG-context] Convertnumber with \ref[number] fails in MkIV, works in LMTX

2022-12-06 Thread Rik Kabel via ntg-context


On 2022-01-19 12:39, Rik Kabel via ntg-context wrote:


This is still a problem with the current standalone.

\definelabel[X][text=]
\startTEXpage[offset=1cm]
  \X\X[a]\X[b]\X\par
  \convertnumber{R}{\ref[number][a]}
  \convertnumber{G}{\ref[number][b]}
\stopTEXpage

%% The above example fails to compile when there is no tuc file,
%%    complaining of a missing number in line 4. When lines 4
%%    and 5 are removed and the file is compiled, producing
%%    a .tuc file, and then they are restored, the example
%%    compiles without error. The effect of having or not having
%%    an associated .tuc file does seem a bit odd.

Surely there is a way to get the number from a label reference that 
can then be converted to a numeral of choice.


--
Rik



(A year later) Is there still no way to do this without resorting to the 
.tuc-file gimmick?


The need is to take a label reference number and display it under a 
different numberconversion regime.


--
Rik
___
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
___


Re: [NTG-context] How to display the pages of a particular section in another PDF?

2022-12-06 Thread Hans Hagen via ntg-context

On 12/6/2022 6:33 PM, Pablo Rodriguez via ntg-context wrote:

On 12/6/22 09:05, Hans Hagen via ntg-context wrote:

On 12/6/2022 1:39 AM, Joel wrote:

Thanks so much! It took some work for me to figure out how to make it
work, but it now works great!

i added \firstsectionpage and \lastsectionpage that (i guess) Pablo will
document at the wiki


Many thanks for the implementation, Hans.

https://wiki.contextgarden.net/Including_pages_from_PDF_documents
contains the new information (please, Joel, could you check whether the
explanation is clear?).

But I’m afraid I’m seeing a potential problem here, if the source PDF is
doublesided, \lastsectionpage from a reference may be an empty page.

There is not much we do about that. Oen can then do

{\numexpr\lastsectionpage... -1\relax}

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 : 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
___


Re: [NTG-context] two issues with variable fonts

2022-12-06 Thread Pablo Rodriguez via ntg-context
On 12/4/22 22:16, Henning Hraban Ramm via ntg-context wrote:
> [...]
> An increasing number of fonts in the Google repository is (becoming) 
> variable. So far, I only used the additionally provided fixed versions...

Hi Hraban,

I have just added a first draft about variable font usage:
https://wiki.contextgarden.net/Variable_Fonts.

Would you be so kind to improve it?

Many thanks for your help,

Pablo
___
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
___


Re: [NTG-context] two issues with variable fonts

2022-12-06 Thread Pablo Rodriguez via ntg-context
On 12/4/22 11:53, Hans Hagen via ntg-context wrote:
> [...]
> assuming that i can motivate myself (read: the fonts look nice) i can 
> probably sort out all the side effects

Many thanks for the fixes in the new beta, Hans.

> i'll check if we can deal with tags instead of names as not all fonts 
> have nice names for the axis defined (which might be why one ends up 
> with all these predefined instances)

Many thanks to for allowing tag values for using axes.

Pablo

___
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
___


Re: [NTG-context] How to display the pages of a particular section in another PDF?

2022-12-06 Thread Pablo Rodriguez via ntg-context
On 12/6/22 09:05, Hans Hagen via ntg-context wrote:
> On 12/6/2022 1:39 AM, Joel wrote:
>> Thanks so much! It took some work for me to figure out how to make it 
>> work, but it now works great!
> i added \firstsectionpage and \lastsectionpage that (i guess) Pablo will 
> document at the wiki

Many thanks for the implementation, Hans.

https://wiki.contextgarden.net/Including_pages_from_PDF_documents
contains the new information (please, Joel, could you check whether the
explanation is clear?).

But I’m afraid I’m seeing a potential problem here, if the source PDF is
doublesided, \lastsectionpage from a reference may be an empty page.

Many thanks for your help,

Pablo

___
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
___


Re: [NTG-context] \hpos in math

2022-12-06 Thread Gavin via ntg-context
Hi Hans,

> On Dec 6, 2022, at 2:15 AM, Hans Hagen via ntg-context  
> wrote:
> On 12/6/2022 12:39 AM, Gavin via ntg-context wrote:
>> 1) Is there a mathematics version of \hpos? The contents of \hpos are set as 
>> text, even when \hpos is in mathematics, so I wrote an \mpos macro that uses 
>> \hpos but sets the contents as display-style math. This isn’t great for 
>> spacing, and it does't adapt to different math styles. \framed has a math 
>> version, \mframed, that sets the contents in the appropriate math style. If 
>> anyone know a way to accomplish that with \hpos, I’d love to know.
> 
> there actually is a subsystem that keeps math as-is-it (styles and spacing 
> and such), see attached

I tried using \mathboxanchored, and was able to get the bottom two equations 
shown here. (The top equation uses \hpos, for comparison.)



mathboxanchored.pdf
Description: Adobe PDF document

There are two problems that I didn’t know how to fix.

1) The line connects to the box including the subscript or superscript, not 
just to the e.
2) I cannot make multiple connections to a single object, like the e^\mu in the 
center. If I try to connect top and bottom, I get no connections anywhere in 
the entire document.

The code for the formulas is:

\startformula
  % Each \connectboxanchors works alone, but both together make trouble:
\connectboxanchors[top][top]{X}{Y}
%\connectboxanchors[bottom][bottom]{Y}{Z}
  \mathboxanchored{X}{e}_\alpha \mathboxanchored{Y}{e}^\mu 
\mathboxanchored{Z}{e}_{\dot\beta}
= \textfrac{1}{\sqrt{2}}\sigma_{\alpha\dot\beta}^\mu
\stopformula

I added code to turn the arrow produced by \connectboxanchors into my 
contraction overlay, but that doesn’t affect these issues.

> in your example we need a way to anchor on just the 'e' right? or do you want 
> it on the e + super/subscript?

Yes, we only need to anchor to e. 

Thanks!
Gavin___
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
___


Re: [NTG-context] \hpos in math

2022-12-06 Thread Hans Hagen via ntg-context

On 12/6/2022 12:39 AM, Gavin via ntg-context wrote:

Hello List,

I am working on a project which combines graphics with formulas, like this:

My code for creating this formula is attached. It works well, but I have a 
couple of questions that could make it work better.

1) Is there a mathematics version of \hpos? The contents of \hpos are set as 
text, even when \hpos is in mathematics, so I wrote an \mpos macro that uses 
\hpos but sets the contents as display-style math. This isn’t great for 
spacing, and it does't adapt to different math styles. \framed has a math 
version, \mframed, that sets the contents in the appropriate math style. If 
anyone know a way to accomplish that with \hpos, I’d love to know.


there actually is a subsystem that keeps math as-is-it (styles and 
spacing and such), see attached



2) Is there a way to limit the scope of the \hpos labels to a single formula. 
This could turn into a book length project, with several formulas per page and 
several connections per formula. If every \hpos in the entire book needs a 
unique identifier, I could go mad. Under no circumstances will I connect one 
formula to another, so I’d like to be able to use something like 
\hpos{A}{…}…\hpos{B}{…} in each formula. Any suggestions?


one problem is (and i'm working on that) that one could want multiple 
anchors on a math atom as well as pu tit on the nuclues only



I’ve got to say, LMTX is an absolutely amazing tool for this project, which 
includes complicated networks of connections above and below many formulas. The 
integration of TeX, MetaPost, and Lua makes this project tremendous fun.


that's the idea


P.S. For the curious, I’m using a method for doing General Relativity based on 
spinors rather than tensors, following the methods of Penrose and Rindler in 
their 1985 books “Spinors and Space-time.” In the typesetting example above, 
the e_\alpha and e_{\dot\beta} are basis spinors (one left-handed, one 
right-handed). The e^\mu is the Infeld-van der Waerden symbol relating the spin 
basis to the coordinate basis. The connections are spinor index contractions. 
The formula above relates the components of the Infeld-van der Waerden symbol 
to the Pauli sigma matrices. This relationship only works in flat space, so 
this is an easy example! [Penrose and Rindler, vol 1 p. 125]


in your example we need a way to anchor on just the 'e' right? or do you 
want it on the e + super/subscript?


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
-
\usemodule[article-basic]

\setupbodyfont[dejavu]

\starttext

\setupboxanchorcontent
  [top,left]
  [rulecolor=darkyellow]

\setupboxanchorcontent
  [bottom,right]
  [rulecolor=darkblue]

\input tufte

$
\connectboxanchors[top][top]{one}{two}
x + \frac[source=\namedboxanchor{one}]{1+x}{2-x} =
z + \frac[source=\namedboxanchor{two}]{1+x^2}{2-x^3}
$

\input ward


\connectboxanchors[top][top]{one}{two}

So how about
$
x + \frac[source=\namedboxanchor{one}]{1+x}{2-x}
$
and
$
z + \frac[source=\namedboxanchor{two}]{1+x^2}{2-x^3}
$
then. Of course we need to handle page crossing then.

\connectboxanchors[top][top]{one}{two}
\connectboxanchors[top][top][dash=1]{three}{four}

And can we do
$
% \showboxes
x + \frac{1 \mathboxanchored{one}{+} x \mathboxanchored{three}{-} z}{2-x}
$
and
$
% \showboxes
z + \frac{1 \mathboxanchored{two}{+} x^2 \mathboxanchored{four}{-} z}{2-x^3}
$
to be more granular?

\blank[2*big]

\connectboxanchors[top]   [top]   [text={\small\small\strut\bf watch}]{one}  
{two}
\connectboxanchors[bottom][bottom][text={\small\small\strut\bf out}]  
{three}{four}

And can we do
$
% \showboxes
x + \frac{1 \mathboxanchored{one}{+} x - z}{2 \mathboxanchored{three}{-} x}
$
and
$
% \showboxes
z + \frac{1 \mathboxanchored{two}{+} x^2 - z}{2 \mathboxanchored{four}{-} 
x^3}
$
to be more granular?

\stoptext

___
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
___


Re: [NTG-context] How to display the pages of a particular section in another PDF?

2022-12-06 Thread Hans Hagen via ntg-context

On 12/6/2022 1:39 AM, Joel wrote:
Thanks so much! It took some work for me to figure out how to make it 
work, but it now works great!
i added \firstsectionpage and \lastsectionpage that (i guess) Pablo will 
document at the wiki


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 : 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
___