Re: [NTG-context] \hpos in math - Half solved

2022-12-07 Thread Mikael Sundqvist via ntg-context
Hi,

On Thu, Dec 8, 2022 at 1:07 AM Gavin via ntg-context  wrote:
>
> Hi Hans and Mikael,
>
> This is amazing! Mikael's example works for me. I will start using these 
> tools in my project, and I’ll tell you how it goes.

Very good that it works and that it gets tested!

> It might be a couple weeks, because the physics is also quite challenging.

Haha, I can imagine that the spinors are even more challenging. Good luck!

/Mikael
___
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 - Half solved

2022-12-07 Thread Gavin via ntg-context
Hi Hans and Mikael,

This is amazing! Mikael's example works for me. I will start using these tools 
in my project, and I’ll tell you how it goes. It might be a couple weeks, 
because the physics is also quite challenging.

Thank you!
Gavin


> On Dec 7, 2022, at 3:25 PM, Hans Hagen via ntg-context  
> wrote:
> 
> On 12/7/2022 1:42 PM, Gavin via ntg-context wrote:
>> Hi List,
>> I solved my original problem 2, allowing me to reuse the same \hpos labels 
>> in different equations without interference. I added an equation counter and 
>> set up my custom math version of \hpos to use the count as part of the label 
>> internally. I tried to do this with a regular ConTeXt counter, but had all 
>> sorts of mysterious, wrong behavior. When I switched to using a Lua counter, 
>> everything worked immediately. So, while there is nothing brilliant about 
>> this solution, I’ll share it for anyone who might want to do something 
>> similar in the future.
> attached an example by Mikael ... it should work with tonights update
> 
> 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
> -
> <221206-3.mkxl>___
> 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
> ___

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

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

On 12/7/2022 1:42 PM, Gavin via ntg-context wrote:

Hi List,

I solved my original problem 2, allowing me to reuse the same \hpos labels in 
different equations without interference. I added an equation counter and set 
up my custom math version of \hpos to use the count as part of the label 
internally. I tried to do this with a regular ConTeXt counter, but had all 
sorts of mysterious, wrong behavior. When I switched to using a Lua counter, 
everything worked immediately. So, while there is nothing brilliant about this 
solution, I’ll share it for anyone who might want to do something similar in 
the future.

attached an example by Mikael ... it should work with tonights update

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]

\starttext

\startboxanchoring[+]
\connectboxanchors[top][top][distance=1ex] {c1}{c2}
\connectboxanchors[bottom] [bottom] [distance=1ex] {d1}{d2}
\startformula
\mathboxanchored[nucleus]{c1}{e}_{\alpha}
\mathboxanchored[nucleus]{c2}{e}^{\mu}
\mathboxanchored[nucleus]{d1}{todo}
\mathboxanchored[nucleus]{d2}{e}_{\dot{\beta}} = \frac{1}{\sqrt{2}}
\sigma_{\alpha,\dot{\beta}}^{\mu}
\stopformula
\stopboxanchoring

\startboxanchoring[+]
\connectboxanchors[top][top][distance=0.5ex,arrow=no] {c1}{c2}
\connectboxanchors[bottom] [bottom] [distance=0.5ex,arrow=no] {c2}{c3}
\startformula
\mathboxanchored[nucleus]{c1}{e}_{\alpha}
\mathboxanchored[nucleus]{c2}{e}^{\mu}
\mathboxanchored[nucleus]{c3}{e}_{\dot{\beta}} = \frac{1}{\sqrt{2}}
\sigma_{\alpha,\dot{\beta}}^{\mu}
\stopformula
\stopboxanchoring

\startboxanchoring[+]
\connectboxanchors[top][top][text={\smallinfofont upper limits}]{b1}{b2}
\connectboxanchors[bottom] [bottom] [text={\smallinfofont lower limits}]{a1}{a2}
\startformula
\int_{\mathboxanchored{a1}{0}}^{\mathboxanchored{b1}{1}} \frac{1}{1+x^2} \dd x
=
\int_{\mathboxanchored{a2}{0}}^{\pi\mathboxanchored{b2}{/}4} \frac{1}{1+\tan^2 
t}(1+\tan^2 t)\dd t
\stopformula
\stopboxanchoring

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


[NTG-context] Cron /var/www/aanhet.net/context/bin/cron/context-mirror

2022-12-07 Thread Cron Daemon via ntg-context
receiving incremental file list
 ./
 ctan.lsr
 document-2.htm
 download-1.htm
 download-2.htm
 logo-ade.png
 logo-cts.png
 logo-pod.png
 rss.xml
 show-fil.pdf
 context/latest/
 context/latest/cont-mpd.zip
 context/latest/cont-ppc.zip
 context/latest/cont-sci.zip
 context/latest/cont-tmf.zip
 context/latest/cont-tst.7z
 context/latest/cont-tst.tar.xz
 context/latest/cont-tst.zip
 
 sent 101,573 bytes  received 21,058,111 bytes  3,847,215.27 bytes/sec
 total size is 449,071,944  speedup is 21.22


Running archiver:

New dir: /var/www/aanhet.net/context//htdocs/archives/context-2022-12-07.22
172152867   
/var/www/aanhet.net/context//htdocs/archives/context-2022-12-07.22/latest
126745317   
/var/www/aanhet.net/context//htdocs/archives/context-2022-12-07.22/current
18956262
/var/www/aanhet.net/context//htdocs/archives/context-2022-12-07.22/alpha
126707516   
/var/www/aanhet.net/context//htdocs/archives/context-2022-12-07.22/beta
444566058   
/var/www/aanhet.net/context//htdocs/archives/context-2022-12-07.22
444566058   total
___
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 - Half solved

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

On 12/7/2022 1:42 PM, Gavin via ntg-context wrote:

Hi List,

I solved my original problem 2, allowing me to reuse the same \hpos labels in 
different equations without interference. I added an equation counter and set 
up my custom math version of \hpos to use the count as part of the label 
internally. I tried to do this with a regular ConTeXt counter, but had all 
sorts of mysterious, wrong behavior. When I switched to using a Lua counter, 
everything worked immediately. So, while there is nothing brilliant about this 
solution, I’ll share it for anyone who might want to do something similar in 
the future.


Using this could work

\newcount\SFNum

\global\advance\SFNum\plusone

\the\SFNum

(you now use a (global) lua counter


The code I added is below, with some comments. The complete example file is 
attached. The result is two equations.



Each equation was written using the same labels (X,Y,Z), but internally they 
have separate sets, (1:X and 2:X, etc.).

The moral of the story for me: Use more Lua.


but ... work local ... so

   document.sfnum

etc in order to avoid clashes

Gavin


% Lua counts the spin formulas
\ctxlua{sfnum = 0} % Count starts at zero
\def\sfID{\ctxlua{context(sfnum)}} % ConTeXt can call the count from Lua to use 
as an ID for each equation.

% Spin formulas increase the spin formula count and typeset the formula as 
usual.
\define\startspinformula{
   \ctxlua{sfnum = sfnum + 1}
   \startformula
}
\define\stopspinformula{\stopformula}

% My own \mpos uses the spin formula ID as part of the box label, then sets the 
contents as math.
\define[2]\mpos{\hpos{\sfID:#1}{$#2$}}

% Two commands for requesting contractions (the connections between spinors), 
using the spin formula ID.
\define[2]\contract{%
   \startpositionoverlay{graphics}%
 \setMPpositiongraphic{\sfID:#1}{mypos:contract}{to=\sfID:#2}%
   \stoppositionoverlay%
}
\define[2]\contractbelow{%
   \startpositionoverlay{graphics}%
 \setMPpositiongraphic{\sfID:#1}{mypos:contractbelow}{to=\sfID:#2}%
   \stoppositionoverlay%
}
Attached what you can do in a next upload (on the million math test 
files MS and I have by now)


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
-


221206-1.pdf
Description: Adobe PDF document
___
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 - Half solved

2022-12-07 Thread Gavin via ntg-context
Hi List,

I solved my original problem 2, allowing me to reuse the same \hpos labels in 
different equations without interference. I added an equation counter and set 
up my custom math version of \hpos to use the count as part of the label 
internally. I tried to do this with a regular ConTeXt counter, but had all 
sorts of mysterious, wrong behavior. When I switched to using a Lua counter, 
everything worked immediately. So, while there is nothing brilliant about this 
solution, I’ll share it for anyone who might want to do something similar in 
the future.

The code I added is below, with some comments. The complete example file is 
attached. The result is two equations.


hposQuestionEquations.pdf
Description: Adobe PDF document

Each equation was written using the same labels (X,Y,Z), but internally they 
have separate sets, (1:X and 2:X, etc.).

The moral of the story for me: Use more Lua.

Gavin


% Lua counts the spin formulas 
\ctxlua{sfnum = 0} % Count starts at zero
\def\sfID{\ctxlua{context(sfnum)}} % ConTeXt can call the count from Lua to use 
as an ID for each equation.

% Spin formulas increase the spin formula count and typeset the formula as 
usual.
\define\startspinformula{
  \ctxlua{sfnum = sfnum + 1}
  \startformula
}
\define\stopspinformula{\stopformula}

% My own \mpos uses the spin formula ID as part of the box label, then sets the 
contents as math.
\define[2]\mpos{\hpos{\sfID:#1}{$#2$}}

% Two commands for requesting contractions (the connections between spinors), 
using the spin formula ID.
\define[2]\contract{%
  \startpositionoverlay{graphics}%
\setMPpositiongraphic{\sfID:#1}{mypos:contract}{to=\sfID:#2}%
  \stoppositionoverlay%
}
\define[2]\contractbelow{%
  \startpositionoverlay{graphics}%
\setMPpositiongraphic{\sfID:#1}{mypos:contractbelow}{to=\sfID:#2}%
  \stoppositionoverlay%
}




hposQuestion.tex
Description: Binary data
___
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
___