Re: [NTG-context] context.delayed as parameter of setuphead[before=...]

2020-11-02 Thread Jairo A. del Rio
Sorry. What I meant is: when you use

context.setuphead({'chapter'}, {title="Some text"})

at the Lua end, {'chapter'} and {title="Some text"} (notice "Some text" is
a string, not a function) are Lua tables. TeX will print "Some text", but
it won't work for context.delayed as it is another table (metatable
trickery to allow nesting, I guess). Try:

\starttext

\startluacode

context(type(context.delayed))

\stopluacode

\stoptext


Long story short: context.cmda(context.delayed.cmdb(something)) will
(possibly) work; context.cmdc({key=context.delayed.cmdd(somethingelse)})
won't.

Hans and Wolfgang can elaborate in case I've missed something.


Jairo :)

El lun., 2 de nov. de 2020 a la(s) 22:06, Sylvain Hubert (
champign...@gmail.com) escribió:

> > as tables like those in setuphead({somehead}, {somesettings}) are actual
> Lua tables and follow Lua, not TeX, rules
> But there are lua apis that support delayed TeX like
> `context.chapter(context.delayed'text')`.
> Whether or not the function is stored in a table should be theoretically
> irrelevant.
> I guess there should be a switch somewhere that let the command recognized
> delayed function.
>
> On Tue, 3 Nov 2020 at 03:29, Jairo A. del Rio 
> wrote:
>
>> On the Lua side, you'll have to pass strings so your example works, as
>> tables like those in setuphead({somehead}, {somesettings}) are actual Lua
>> tables and follow Lua, not TeX, rules (see e.g. Lua reference in
>> https://www.lua.org/manual/5.4/ or, better, CLD manual in
>> http://www.pragma-ade.nl/general/manuals/cld-mkiv.pdf):
>>
>>
>> \starttext
>>
>> \startluacode
>>
>> --First example
>>
>> for m = 1, 3 do
>>
>> context.setuphead({'chapter'}, {before='hello'})
>>
>> context.startchapter({title="I'm a chapter!"})
>>
>> for i = 1, 3 do
>>
>> context.input("knuth")
>>
>> end
>>
>> context.stopchapter()
>>
>> end
>>
>>
>> --Second example
>>
>> --We'll pass some strings to TeX
>>
>> local nice = "ConTeXt is love, ConTeXt is life"
>>
>> local somehead = 'chapter'
>>
>> local sometext = 'vallejo-trilce-es'
>>
>>
>> context.setuphead({somehead}, {before=nice})
>>
>> context.startchapter({title=somehead})
>>
>> context.input(sometext)
>>
>> context.stopchapter()
>>
>> \stopluacode
>>
>> \stoptext
>>
>>
>> I hope examples help.
>>
>> Regards,
>>
>> Jairo :)
>>
>>
>>
>> El lun., 2 de nov. de 2020 a la(s) 21:09, Sylvain Hubert (
>> champign...@gmail.com) escribió:
>>
>>> Dear List,
>>>
>>> I'm trying to mirror the context command
>>>   `\setuphead[chapter][before=hello]`
>>> into lua with delayed typesetting of 'hello', but
>>>   `\ctxlua{context.setuphead({'chapter'},
>>> {before=context.delayed'hello'})}`
>>> does not have any effect. Could anyone help me on this? Thanks!
>>>
>>> Best,
>>> Sylvain
>>>
>>> ___
>>> 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
>>
>> ___
>>
>
> ___
> 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
___


[NTG-context] A syntax sugar for ConTeXt

2020-11-02 Thread Sylvain Hubert
Dear List,

I'm experimenting with a new syntax for ConTeXt and would appreciate it a
lot if you could give some opinions/advice on it.

https://github.com/champignoom/luax

Details in the README. Basically it's lua code faking tex, while remaining
a decent programming language, and saving keystrokes to the level of tex
compared to \ctxlua -only codes

A major motivating example is the table. There are multiple implementations
of table inside and outside ConTeXt, each of which uses its own ad-hoc
syntax, but at the end of the day they're just mimicking 2d arrays with
some variations. Here's an example in Context an excursion
 using xtable
sugared with the new syntax:
```
  \xtable.setup[
split='yes',
header='repeat',
offset='4pt',
  ]

  \xtable[
head={
 align='middle', foregroundstyle='bold',
 {{nx=6, "Decline of wealth in Dutch florine (Dfl)"}},
 {foregroundstyle='bold', {width='1.2cm', 'Year'}, '1.000--2.000',
'2.000--3.000', '3.000-5.000', '5.000-10.000', 'over 10.000'},
},
next={
 {{nx=6, align='middle', foregroundstyle='bold', "Decline of wealth
in Dutch florine (Dfl) / Continued"}},
 {foregroundstyle='bold', {'Year', '1.000--2.000', '2.000--3.000',
'3.000-5.000', '5.000-10.000', 'over 10.000'}},
},
body={
align='middle',
 {1675, \{\math{22}}, '~7', '~5', '~4', '~5'},
 {1724, '~4', '~4', '--', '~4', '~3'},
},
  ]
```

Best,
Sylvain
___
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] context.delayed as parameter of setuphead[before=...]

2020-11-02 Thread Sylvain Hubert
> as tables like those in setuphead({somehead}, {somesettings}) are actual
Lua tables and follow Lua, not TeX, rules
But there are lua apis that support delayed TeX like
`context.chapter(context.delayed'text')`.
Whether or not the function is stored in a table should be theoretically
irrelevant.
I guess there should be a switch somewhere that let the command recognized
delayed function.

On Tue, 3 Nov 2020 at 03:29, Jairo A. del Rio 
wrote:

> On the Lua side, you'll have to pass strings so your example works, as
> tables like those in setuphead({somehead}, {somesettings}) are actual Lua
> tables and follow Lua, not TeX, rules (see e.g. Lua reference in
> https://www.lua.org/manual/5.4/ or, better, CLD manual in
> http://www.pragma-ade.nl/general/manuals/cld-mkiv.pdf):
>
>
> \starttext
>
> \startluacode
>
> --First example
>
> for m = 1, 3 do
>
> context.setuphead({'chapter'}, {before='hello'})
>
> context.startchapter({title="I'm a chapter!"})
>
> for i = 1, 3 do
>
> context.input("knuth")
>
> end
>
> context.stopchapter()
>
> end
>
>
> --Second example
>
> --We'll pass some strings to TeX
>
> local nice = "ConTeXt is love, ConTeXt is life"
>
> local somehead = 'chapter'
>
> local sometext = 'vallejo-trilce-es'
>
>
> context.setuphead({somehead}, {before=nice})
>
> context.startchapter({title=somehead})
>
> context.input(sometext)
>
> context.stopchapter()
>
> \stopluacode
>
> \stoptext
>
>
> I hope examples help.
>
> Regards,
>
> Jairo :)
>
>
>
> El lun., 2 de nov. de 2020 a la(s) 21:09, Sylvain Hubert (
> champign...@gmail.com) escribió:
>
>> Dear List,
>>
>> I'm trying to mirror the context command
>>   `\setuphead[chapter][before=hello]`
>> into lua with delayed typesetting of 'hello', but
>>   `\ctxlua{context.setuphead({'chapter'},
>> {before=context.delayed'hello'})}`
>> does not have any effect. Could anyone help me on this? Thanks!
>>
>> Best,
>> Sylvain
>>
>> ___
>> 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
>
> ___
>
___
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] context.delayed as parameter of setuphead[before=...]

2020-11-02 Thread Jairo A. del Rio
On the Lua side, you'll have to pass strings so your example works, as
tables like those in setuphead({somehead}, {somesettings}) are actual Lua
tables and follow Lua, not TeX, rules (see e.g. Lua reference in
https://www.lua.org/manual/5.4/ or, better, CLD manual in
http://www.pragma-ade.nl/general/manuals/cld-mkiv.pdf):


\starttext

\startluacode

--First example

for m = 1, 3 do

context.setuphead({'chapter'}, {before='hello'})

context.startchapter({title="I'm a chapter!"})

for i = 1, 3 do

context.input("knuth")

end

context.stopchapter()

end


--Second example

--We'll pass some strings to TeX

local nice = "ConTeXt is love, ConTeXt is life"

local somehead = 'chapter'

local sometext = 'vallejo-trilce-es'


context.setuphead({somehead}, {before=nice})

context.startchapter({title=somehead})

context.input(sometext)

context.stopchapter()

\stopluacode

\stoptext


I hope examples help.

Regards,

Jairo :)



El lun., 2 de nov. de 2020 a la(s) 21:09, Sylvain Hubert (
champign...@gmail.com) escribió:

> Dear List,
>
> I'm trying to mirror the context command
>   `\setuphead[chapter][before=hello]`
> into lua with delayed typesetting of 'hello', but
>   `\ctxlua{context.setuphead({'chapter'},
> {before=context.delayed'hello'})}`
> does not have any effect. Could anyone help me on this? Thanks!
>
> Best,
> Sylvain
>
> ___
> 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
___


[NTG-context] context.delayed as parameter of setuphead[before=...]

2020-11-02 Thread Sylvain Hubert
Dear List,

I'm trying to mirror the context command
  `\setuphead[chapter][before=hello]`
into lua with delayed typesetting of 'hello', but
  `\ctxlua{context.setuphead({'chapter'}, {before=context.delayed'hello'})}`
does not have any effect. Could anyone help me on this? Thanks!

Best,
Sylvain
___
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] Running mtxrun in a continuous batch mode

2020-11-02 Thread Ramkumar KB
Hello,

I am trying to run mtxrun in a batch process and read the available
documentation here -
https://wiki.contextgarden.net/Running_ConTeXt_without_a_shell

My usecase is being able to create PDF docs based on the input data that
comes in a JSON format (in a continuous batch process). In ConTeXt, thanks
to the Lua engine, I am able to inject a JSON read from a file - and use
the JSON in the tex file (here variable `tab` holds the JSON).

How do I make this as a continuous webservice - in comes JSON and out comes
the PDF ?

\startluacode
require("test-json")
\stopluacode

The name of the document is \ctxlua{tex.print(tab['documentName'])}

Any tips or pointers would be much appreciated.

Thank you,
Ramkumar
___
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] lmtx

2020-11-02 Thread Hans Hagen

On 10/31/2020 3:50 AM, Jairo A. del Rio wrote:
Hi, Hans. The last release is considerably faster for smaller documents 
(for larger documents differences seem to be neglectable). Thank you for 
such an improvement. However, something is wrong with one manual: 
luametatex manual won't compile:
Compiles ok here so i'm puzzled. I'll update a new version in a few 
days anyway.


About performance. As you mention small document, it's probably the 
startup time but I'm not sure if i did things that should have a large 
impact (apart from again a smaller format file) but maybe it's a 
accumulation of small improvements. About large files .. do you have any 
idea where tex spends the time on your documents? Of course there is 
much lua involved and performance of lua oscillates a bit with versions. 
The tex code is already quite optimal (and variants i played with hardly 
put a dent in performance). But anyway, it would be nice if users could 
indicate where they think bottlenecks are.


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] multiparagraph quotation

2020-11-02 Thread type
Thank you, Wolfgang, for your prompt and helpful solution!

Although I didn't make it clear in the minimal working example, I am using this 
for ordinary dialog.  For the record (and for anyone searching the mailing list 
in the future), to get that to work right, I had to put in one more thing into 
the first line of the example to get it to work:

\setupdelimitedtext[quotation][repeat=yes, middle=“, leftmargin=0pt]
\starttext
\startquotation
\input knuth
\stopquotation
\stoptext

It seems like a little bit of overkill to set up a \startquotation 
\stopquotation  for each piece of dialog, but it certainly solves the problem 
to do so.

Again, many thanks! I'll post your solution to a suitable place in the Wiki 
when I get a chance.


Sciurus


-Original Message-
From: Wolfgang Schuster  
Sent: Monday, November 2, 2020 10:56 AM
To: mailing list for ConTeXt users 
Cc: t...@projectivespace.com
Subject: Re: [NTG-context] multiparagraph quotation

t...@projectivespace.com schrieb am 02.11.2020 um 18:26:
> I'm trying to get quotation marks at the beginning of each new paragraph in
> quotations (in ConTeXt Mk IV), as is the convention in English. Here's a
> minimal working example of what I have tried:
> 
> \setupdelimitedtext[quotation][repeat=yes, middle="]
> \starttext
> \quotation{\input knuth
> }

\startquotation
\input knuth
\stopquotation

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] multiparagraph quotation

2020-11-02 Thread Wolfgang Schuster

t...@projectivespace.com schrieb am 02.11.2020 um 18:26:

I'm trying to get quotation marks at the beginning of each new paragraph in
quotations (in ConTeXt Mk IV), as is the convention in English. Here's a
minimal working example of what I have tried:

\setupdelimitedtext[quotation][repeat=yes, middle="]
\starttext
\quotation{\input knuth
}


\startquotation
\input knuth
\stopquotation

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] multiparagraph quotation

2020-11-02 Thread type
I'm trying to get quotation marks at the beginning of each new paragraph in
quotations (in ConTeXt Mk IV), as is the convention in English. Here's a
minimal working example of what I have tried:

\setupdelimitedtext[quotation][repeat=yes, middle="]
\starttext
\quotation{\input knuth
}
\stoptext

However, it doesn't put left quotes at the start of each paragraph the way
I'd like it to.

I got this approach from the wiki page
https://wiki.contextgarden.net/Command/setupdelimitedtext . However, I'm
guessing this may have been only for Mk II since the \setupdelimitedtext
doesn't seem to do anything here. (From what is said above on the wiki page,
it looks like this might be only for Mk II, but I can't t tell.)

I have searched the mailing list and stackexchange but haven't found a
solution. I'm guessing that there's a simple way to do this that I am just
not aware of. I'd appreciate any help anyone can offer me (and I'd be glad
to put the solution into the wiki if that's appropriate, too).

Thanks,


Sciurus




___
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] index entries postponed if sections are empty

2020-11-02 Thread Henning Hraban Ramm
Otared, Jano, thank you for your answers – what finally helped was putting the 
image and the index entries in a vbox together.

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
___