[NTG-context] \doifnotdocumentargument in proper Lua

2022-04-29 Thread Pablo Rodriguez via ntg-context
Dear list,

I have the following command in one of my documents:

  \doifnotdocumentargument{no-metadata}
{\ctxlua{document.transfer_metadata(document.main_file)}}

Which would be the right way to write \doifnotdocumentargument in proper
Lua?

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


[NTG-context] Fuzzy paragraph when exporting to XML

2022-04-29 Thread Aditya Mahajan via ntg-context
Hi,

I am trying to debug a bug-report for t-vim: 
https://github.com/adityam/filter/issues/64 Exporting with trackers=export* 
gives a warning: 

backend > export > fuzzy paragraph:

I have managed to narrow it down to the attached MWE (which does not depend on 
the t-vim module at all). Compiling it using 

$context --trackers=export\* lines

gives the fuzzy paragraph warning. Any hints on how to resolve this?

Thanks,
Aditya

lines.tex
Description: TeX document
___
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
___


Re: [NTG-context] Problem with a defined colour in MetaFun

2022-04-29 Thread Keith McKay via ntg-context

Hi Wolfgang,

Thank you for your reply. I did as you suggested but it still never 
worked. However it did make me delve further into the Metafun, 
LuaMetaFun and the Colouring ConTeXt manuals where I found examples of 
the *resolvedcolor* helper which I used as follows:


definecolor [name = "myColor", r = uniformdeviate(1), g = 
uniformdeviate(1), b = uniformdeviate(1)];


for loop..

fill unitsquare xscaled 5cm yscaled .5cm shifted (7cm,i*cm) 
withcolor(r[resolvedcolor("myColor"), white]);


endfor;

I also found the *namedcolor* helper and I could use it as follows:

fill unitsquare xscaled 5cm yscaled .5cm shifted (1cm,(2*i)*cm) 
withcolor namedcolor("myColor2") ;


However, for some reason it did not work in:

fill unitsquare xscaled 5cm yscaled .5cm shifted (7cm,i*cm) 
withcolor(r[namedcolor("myColor"), white]);


//

Thanks again for your suggestion//

Best Wishes

Keith//

On 28/04/2022 16:04, Wolfgang Schuster wrote:

Keith McKay via ntg-context schrieb am 28.04.2022 um 12:05:


Hi,

In the MWE below I define an rgb colour, myColor1, using random 
numbers for the r, g and b components. I then use it to fill a 
unitsquare the size of the page, which works as expected. In the loop 
that follows I then use the defined colour, myColor1, along with 
white and the variable r to create shades of myColor1 as in the MWE 
below. However, myColor1 is not recognised in the loop and seems to 
be replaced by black, although if I use a predefined colour, in this 
case BurntSienna from the crayola collection, it works as expected.  
I have tried a number of ways to get this to work as shown in the 
code but without success. I would be grateful for any suggestions.


Best Wishes

Keith McKay

MWE%

\setuppapersize[A4,portrait]

\usecolors[crayola]

\starttext

\dorecurse{10}{

\startMPpage

StartPage;

\definecolor[name="myColor1", r = uniformdeviate(1), g = 
uniformdeviate(1), b = uniformdeviate(1) ] ;




Remove the backslash in front of the definecolor command.

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


Re: [NTG-context] Problem with a defined colour in MetaFun

2022-04-29 Thread Keith McKay via ntg-context

Hi Fabrice

Thank you for your reply. It works the way I wanted. Wolfgang also 
replied and this has lead me to an alternative method. See my reply to 
him in this mailing list.


Best Wishes

Keith

On 28/04/2022 13:45, Fabrice L wrote:

Sorry, I was a little too enthusiastic, here here is the code :


Le 28 avr. 2022 à 08:41, Fabrice L  a écrit :

Hi Keith,

Le 28 avr. 2022 à 06:05, Keith McKay via ntg-context 
 a écrit :


Hi,

In the MWE below I define an rgb colour, myColor1, using random 
numbers for the r, g and b components. I then use it to fill a 
unitsquare the size of the page, which works as expected. In the 
loop that follows I then use the defined colour, myColor1, along 
with white and the variable r to create shades of myColor1 as in the 
MWE below. However, myColor1 is not recognised in the loop and seems 
to be replaced by black, although if I use a predefined colour, in 
this case BurntSienna from the crayola collection, it works as 
expected.  I have tried a number of ways to get this to work as 
shown in the code but without success. I would be grateful for any 
suggestions.


Best Wishes

Keith McKay

MWE%
\setuppapersize[A4,portrait]
\usecolors[crayola]
\starttext
\dorecurse{10}{
\startMPpage
StartPage;
\definecolor[name="myColor1", r = uniformdeviate(1), g = 
uniformdeviate(1), b = uniformdeviate(1) ] ;
fill unitsquare xscaled PaperWidth yscaled PaperHeight withcolor 
"myColor1";

for i =2 step 2 until 10:
r := i/10;
fill unitsquare xscaled 5cm yscaled .5cm shifted (1cm,i*cm) 
withcolor(r[\MPcolor{BurntSienna},white]);
fill unitsquare xscaled 5cm yscaled .5cm shifted (7cm,i*cm) 
withcolor(r[\MPcolor{myColor1}, white]);
fill unitsquare xscaled 5cm yscaled .5cm shifted (13cm,i*cm) 
withcolor(r[\MPcolor{"myColor1"}, white]);
%fill unitsquare xscaled 5cm yscaled .5cm shifted (13cm,i*cm) 
withcolor(r[myColor1 , white]); This line causes an error.

endfor;
StopPage;
\stopMPpage
}

\stoptext
%%%end MWE%%%


Here is a solution, with works here, defining in another way the 
color «  myColor »:


\setuppapersize[A4,portrait]
\usecolors[crayola]
\starttext
\dorecurse{2}{
\startMPpage
StartPage;
color myColor ;
myColor := (uniformdeviate(1),uniformdeviate(1),uniformdeviate(1));
fill unitsquare xscaled PaperWidth yscaled PaperHeight withcolor myColor;
for i =2 step 2 until 10:
r := i/10;
fill unitsquare xscaled 5cm yscaled .5cm shifted (1cm,i*cm) 
withcolor(r[\MPcolor{BurntSienna},white]);
fill unitsquare xscaled 5cm yscaled .5cm shifted (7cm,i*cm) 
withcolor(r[\MPcolor{myColor1}, white]);
fill unitsquare xscaled 5cm yscaled .5cm shifted (13cm,i*cm) 
withcolor(r[\MPcolor{"myColor1"}, white]);
%fill unitsquare xscaled 5cm yscaled .5cm shifted (13cm,i*cm) 
withcolor(r[myColor1 ,  white]); This line causes an error.

endfor;
StopPage;
\stopMPpage
}

\stoptext


I forgot to remove « myColor1 » from the others parts of the code.
\setuppapersize[A4,portrait]
\usecolors[crayola]
\starttext
\dorecurse{10}{
\startMPpage
StartPage;
color myColor ;
myColor := (uniformdeviate(1),uniformdeviate(1),uniformdeviate(1));
fill unitsquare xscaled PaperWidth yscaled PaperHeight withcolor myColor;
for i =2 step 2 until 10:
r := i/10;
fill unitsquare xscaled 5cm yscaled .5cm shifted (1cm,i*cm) 
withcolor(r[\MPcolor{BurntSienna},white]);
fill unitsquare xscaled 5cm yscaled .5cm shifted (7cm,i*cm) 
withcolor(r[myColor, white]);
fill unitsquare xscaled 5cm yscaled .5cm shifted (13cm,i*cm) 
withcolor(r[myColor, white]);
%fill unitsquare xscaled 5cm yscaled .5cm shifted (13cm,i*cm) 
withcolor(r[myColor1 ,  white]); This line causes an error.

endfor;
StopPage;
\stopMPpage
}

\stoptext




Fabrice.

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


Re: [NTG-context] lua-widow-control module error in LMTX

2022-04-29 Thread Eduardo Bohoyo via ntg-context


Now, I don't have any widows in my document, and I only count 2 broken 
hyphens.


However, I think this is at the expense of the shenanigans the module 
has "perpetrated" elsewhere, because, apart from the crazy horizontal 
spacing of some paragraph in the bibliography, the module lies to me in 
the log.


Yes, the log output fools me. There is no "Widow/Orphan NOT removed". 
But this is not true:


To the 2 broken hyphens must be added 4 orphan lines that the log claims 
to have resolved. But what worries me the most is that it counts as 
successful one occasion with an empty line, another occasion with two 
empty lines in a row, and 4 occasions with no less than 7 empty lines in 
a row at the beginning of a chapter.


I don't know if this information can provide any more clues to adjust 
the module for the grid mode, but I hope it helps.


Greetings,

Edu.

El 29/4/22 a las 2:38, Max Chernoff escribió:

On 2022-04-28 3:30 a.m., Henning Hraban Ramm wrote:
I’m afraid the above release introduced a bug; while the offical 
release ran through, I now get:


module  > lua-widow-control > Widow/orphan detected. 
Attempting to remove.

lua error   > lua error on line 112 in file de/c_intro.tex:

callback error: 
...local/tex/luatex/lua-widow-control/lua-widow-control.lua:510: 
attempt to perform arithmetic on a nil value (field 'height')

stack traceback:
 ...local/tex/luatex/lua-widow-control/lua-widow-control.lua:510: 
in function 
<...local/tex/luatex/lua-widow-control/lua-widow-control.lua:360>


On 2022-04-28 4:54 a.m., Eduardo Bohoyo wrote:

Here testing that beta version.

As you know, my book is in grid mode, but I get the same error 
message as Hraban when the compilation crashes.


However, when I comment grid again in my document, it does compile 
the pdf.


Well that's why it was a beta :) Looks like I made some questionable 
assumptions
about the order of the hlist/baselineskip nodes, so the module 
completely broke

with things as simple as section headings.

Hopefully this new beta should fix things:

https://github.com/gucci-on-fleek/lua-widow-control/releases/tag/release-5e240b2ebb76f33c32ecbc673af09a1c64773033

Grid snapping is a little peculiar, so let me know if you find any 
more bugs.


And thanks for the bug reports.
-- Max

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