Re: [NTG-context] return a labeltext with color...

2022-06-24 Thread Willi Egger via ntg-context
Hans, Wolfgang,

I am so happy to receive your immediate answers. — Thanks a lot, the problem is 
solved and I get the colored labeltext!

Thank you

Willi

> On 24 Jun 2022, at 19:19, Hans Hagen via ntg-context  
> wrote:
> 
> On 6/24/2022 4:34 PM, Willi Egger via ntg-context wrote:
>> Hi all,
>> Sorry for bothering you again.
>> I would like that lua is returning a colored string, which is a label-text.
>> The following does not work, the labeltext remains black, there is no error 
>> though:
>> return context.color({"red"},context.labeltext(s))
> 
> context.color({"red"},function() context.labeltext(s) end)
> 
>> What is the correct approach?
>> Thanks for enlighten me :-)
>> Willi
>> ___
>> 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
>> ___
> 
> 
> -- 
> 
> -
> 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 / 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] Count (and limit) glyphs per line?

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

On 6/24/2022 5:15 AM, Benjamin Buchmuller via ntg-context wrote:

Dear list,

I've been confronted with the following 'intriguing' formatting requirement for 
a document:

"
• Type density:  Must be no more than 15 characters per linear inch (including 
characters and spaces).
• Line spacing: Must be no more than six lines per vertical inch.
"

While the line spacing resolves in ConTeXt to

\setupinterlinespace[line=\dimexpr(1in / 6)]

I was wondering if one can limit "type density" as the number of glyphs per 
inch in TeX too? I thought, it is more convenient to rephrase this request (for a 7 in 
textwidth) to limit the number of glyphs per line to 112. (Font must be sans or serif, of 
course ...)

I've tried

\setuplayout[width=112\averagecharwidth]

which, however, results in ~120–130 characters and spaces per line. Pragmatically, I'm 
narrowing the text width to empirically match the requirement, but I'm nevertheless 
curious if there is a Lua/TeX solution to this "problem"?

Just assume the worst case and take the narrowest character:

\showframe

\setupbodyfont[modern] % we need to set the font

\normalexpanded {
\setuplayout
   [textwidth=\the\dimexpr112\fontcharwd\font`.\relax]
}

\starttext
\input tufte
\stoptext



-
  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 / 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] missing mails

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

On 6/24/2022 8:28 AM, Max Chernoff wrote:


2.  The LuaMetaTeX manual says that "pre_linebreak_filter" is called
     _after_ the parfillskip glue has been added, but this doesn't seem
     to be the case. With LuaLaTeX/Plain LuaTeX/MkIV, this is true, but
     the node list passed to the callback in MkXL is missing the
     parfillskip.
tex.linebreak hasn't yet been adapted to the additional glue (parfil 
left skip, and both par init skips)'; i'll do that


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 / 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] return a labeltext with color...

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

On 6/24/2022 4:34 PM, Willi Egger via ntg-context wrote:

Hi all,


Sorry for bothering you again.

I would like that lua is returning a colored string, which is a label-text.

The following does not work, the labeltext remains black, there is no error 
though:

return context.color({"red"},context.labeltext(s))


context.color({"red"},function() context.labeltext(s) end)



What is the correct approach?

Thanks for enlighten me :-)

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



--

-
  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 / 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] return a labeltext with color...

2022-06-24 Thread Wolfgang Schuster via ntg-context

Willi Egger via ntg-context schrieb am 24.06.2022 um 16:34:

Hi all,


Sorry for bothering you again.

I would like that lua is returning a colored string, which is a label-text.

The following does not work, the labeltext remains black, there is no error 
though:

return context.color({"red"},context.labeltext(s))

What is the correct approach?


\mainlanguage[fr]

\starttext

\startluacode
context.color( { "red" }, context.nested.labeltext("january") )
\stopluacode

\stoptext

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
___


[NTG-context] return a labeltext with color...

2022-06-24 Thread Willi Egger via ntg-context
Hi all,


Sorry for bothering you again.

I would like that lua is returning a colored string, which is a label-text.

The following does not work, the labeltext remains black, there is no error 
though:

return context.color({"red"},context.labeltext(s))

What is the correct approach?

Thanks for enlighten me :-)

Willi
___
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] Failing \doifemptyelse

2022-06-24 Thread Willi Egger via ntg-context
Hans, Wolfgang!

Thank you so much for your instructions! — This expansion thing is something I 
will probably never master ;-(

Thank you!
Kind regards
Willi

> On 24 Jun 2022, at 05:42, Wolfgang Schuster via ntg-context 
>  wrote:
> 
> Hans Hagen via ntg-context schrieb am 23.06.2022 um 23:00:
>> On 6/23/2022 9:16 PM, Willi Egger via ntg-context wrote:
>>> Good evening gurus!
>>> 
>>> Why is the minimal example failing? i.e. executing always the else-branch?
>>> 
>>> \setuppapersize[A6][A6]
>>> 
>>> \setvariables
>>>[Test]
>>>[Number=]
>>> 
>>> 
>>> \starttext
>>>Value of variable Number before test: \getvariable{Test}{Number} \crlf
>>> 
>>>  \doifemptyelse{\getvariable{Test}{Number}}
>>>{\dorecurse
>>> {5}
>>> {TEST}
>>>}
>>>{Nothing defined \par
>>> Contents of variable Number: \getvariable{Test}{Number}
>>>}
>>> 
>>> \stoptex
>> there's also
>> 
>> \doifelsevariable {Test} {Number}
>> 
>> that can be used
> 
> in this case
> 
> \doifelseemptyvariable{Test}{Number}{...}{...}
> 
> is the better choice
> 
> 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
> ___

___
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] Detailed citation of reference

2022-06-24 Thread Johann Birnick via ntg-context
Works, thanks!

On Fri, 2022-06-24 at 12:44 +0200, Wolfgang Schuster via ntg-context wrote:
> Johann Birnick via ntg-context schrieb am 24.06.2022 um 11:59:
> > Thanks! However, if I type \cite[righttext={, section 2.1}] is doesn't work
> > anymore. Any ideas?
> 
> What happens with
> 
>  \cite[righttext={{, section 2.1}}]
> 
> or
> 
>  \cite[righttext={\textcomma\ section 2.1}]
> 
> 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
> __
> _
___
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] Graphviz and ConTeXt

2022-06-24 Thread juh+ntg-context--- via ntg-context

Am 23.06.22 um 15:08 schrieb Taco Hoekwater:

Hi,

You could just convert these separately to pdf/svg/jpg/png and then load them 
as \externalfigure.


I thought about this solution.


You could also use the filter module to be able to take them inline into the 
ConTeXt code:



Thanks for the hint. This looks interesting. I'll try it out.

juh


___
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] Detailed citation of reference

2022-06-24 Thread Wolfgang Schuster via ntg-context

Johann Birnick via ntg-context schrieb am 24.06.2022 um 11:59:

Thanks! However, if I type \cite[righttext={, section 2.1}] is doesn't work
anymore. Any ideas?


What happens with

    \cite[righttext={{, section 2.1}}]

or

    \cite[righttext={\textcomma\ section 2.1}]

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] Detailed citation of reference

2022-06-24 Thread Johann Birnick via ntg-context
Thanks! However, if I type \cite[righttext={, section 2.1}] is doesn't work
anymore. Any ideas?

Johann

On Fri, 2022-06-24 at 09:24 +0200, Henning Hraban Ramm via ntg-context wrote:
> Am 24.06.22 um 02:09 schrieb Johann Birnick via ntg-context:
> > Hi there,
> > 
> > using \cite[myreference] I will get a result like "[1]", or I could also
> > change
> > the "1" into some more detailed information such as a tag.
> > 
> > However, I want to obtain something like "[1, section 2.1]".
> > 
> > How can I achieve this?
> 
> \cite[righttext={section 2.1}][myreference]
> 
> Hraban
> __
> _
> 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] Count (and limit) glyphs per line?

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

Am 24.06.22 um 05:15 schrieb Benjamin Buchmuller via ntg-context:

• Type density:  Must be no more than 15 characters per linear inch (including 
characters and spaces).


This talks about "type density", not characters per line. This depends 
mostly on the font (and letterspacing). I.e. you should not use a narrow 
font.


Hraban
___
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] Detailed citation of reference

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

Am 24.06.22 um 02:09 schrieb Johann Birnick via ntg-context:

Hi there,

using \cite[myreference] I will get a result like "[1]", or I could also change
the "1" into some more detailed information such as a tag.

However, I want to obtain something like "[1, section 2.1]".

How can I achieve this?


\cite[righttext={section 2.1}][myreference]

Hraban
___
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] missing mails

2022-06-24 Thread Max Chernoff via ntg-context

Hi Hans,

So, if there has been serious issues not resolved (the last year) let me 
know. 


I've been having two issues with parfillskip nodes in LMTX that I
haven't been able to figure out myself. Neither of them are particularly
serious, but the first one is quite annoying.

(The below is mostly copied from an earlier email, "Callbacks (and
nodes) in LuaMetaTeX")

1.  In LMTX, calling "tex.linebreak" produces a

luatex warning  > tex: left parfill skip is gone


warning. I don't get this warning in Plain LuaTeX, LuaLaTeX, or
MkIV, so I think that it's specific to LuaMetaTeX. The LuaMetaTeX
manual hardly mentions "left parfill skip"/"parfillleftskip", so I'm
not too sure what to do to avoid this warning.

Any call to "tex.linebreak" seems to produce this warning. Here's a
minimal example:

\startluacode
function test(head)
tex.linebreak(node.copylist(head))

return head

end

nodes.tasks.appendaction("processors", "after", "test")

\stopluacode

\starttext

Hello!
\stoptext

And a less minimal example:

% From CTAN or modules.contextgarden.net
\usemodule[lua-widow-control]

\starttext
\dorecurse{10}{\samplefile{knuth}}
\stoptext

With the lwc module, I call "tex.linebreak" twice for every
paragraph, so these warning messages get quite annoying. The log
file for compiling the lwc manual


https://github.com/gucci-on-fleek/lua-widow-control/runs/6946059955?check_suite_focus=true#check-step-9

is 22000 lines long, most of which are "left parfill skip" warnings.

2.  The LuaMetaTeX manual says that "pre_linebreak_filter" is called
_after_ the parfillskip glue has been added, but this doesn't seem
to be the case. With LuaLaTeX/Plain LuaTeX/MkIV, this is true, but
the node list passed to the callback in MkXL is missing the
parfillskip.

This code:

\startluacode
function test(head)
local last = node.slide(head)

print "START"

for i=1,3 do
print(last)
print(
node.type(last.id),
node.subtypes(last.id)[last.subtype],
last.width,
last.stretchorder,
last.stretch
)

last = last.prev

end
print "STOP"

return head

end

nodes.tasks.appendaction("processors", "after", "test")

\stopluacode

\starttext

Hello!
\stoptext

with MkXL produces:

START
nil : glue spaceskip>
gluespaceskip   341648  0   384354
   2258 : glyph unset>
glyph   nil 213792  nil nil
   2521 : glyph unset>
glyph   nil 385140  nil nil
STOP
START
nil : glue userskip>
glueuserskip0   2   65536
   2357 : glyph unset>
glyph   nil 385140  nil nil
   2611 : rule strut>
rulestrut   0   nil nil
STOP

but with MkIV produces:

START
nil : glue 15>
glueparfillskip 0   nil 65536
   1041 : penalty 2>
penalty linepenalty nil nil nil
   1239 : glyph 256>
glyph   nil 213792  nil nil
STOP
START
nil : glue 0>
glueuserskip0   nil 65536
   1479 : glyph 256>
glyph   nil 385140  nil nil
   1375 : hlist 2>
hlist   box 0   nil nil
STOP

This problem isn't very serious at all since I can work around it
fairly easily, but I'm including it since it's so closely related
to the issue above.

I _think_ that both of these are engine bugs, but I may just misreading
the docs or missing something completely. Please let me know if you have
any solutions.

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