Re: [NTG-context] Exchangeing content of variables between luacode and context

2019-11-19 Thread Henning Hraban Ramm
Hi Rudolf,
storing variable states within the script sounds like AppleScript…

Why don’t you write your settings into some file (a Lua table representation 
would make sense, otherwise something like JSON or INI) and read that in in 
every run, if it exists?


Grüßlinge, Hraban
---
https://www.fiee.net
http://wiki.contextgarden.net
https://www.dreiviertelhaus.de
GPG Key ID 1C9B22FD

___
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] Widgets: Any good examples for developing JS-enabled PDFs that calculate?

2019-11-19 Thread Paul Mazaitis

On 18 Nov 2019, at 3:48, Hans Hagen wrote:


Here's something to play with ... note the Number conversion!


A ha! Many thanks (for some reason I didn't get this email until just 
now); I'll try to tackle it this way and see what I can make work.



\usemodule[fields]

\starttext

[...]

\stoptext


-Paul

___
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] layers and \llap

2019-11-19 Thread Otared Kavian
Hi Pablo,

I can reproduce the issue on MacOS on Acrobat Reader, and also on Adobe Acrobat 
Pro.
In fact turning off any last viewerlayer makes the text disappear.

Best regards: OK

> On 19 Nov 2019, at 22:10, Pablo Rodriguez  wrote:
> 
> On 11/19/19 9:48 PM, Henri Menke wrote:
>> On 11/20/19 3:16 AM, Pablo Rodriguez wrote:
>>> [...]
>>> Everything works fine if the layer with \llap is placed first.
>>> 
>>> I guess this might be a bug.
>> 
>> Works for me on both Evince and Foxit Reader.  I can't test Adobe because I'm
>> on Linux.
>> 
>> Try also \dontleavehmode\llap{\ConTeXt} because \llap by itself does not 
>> start
>> a paragraph.
> 
> Hi Henri,
> 
> many thanks for your reply.
> 
> This is really weird, since I cannot make it work, either with Acrobat
> in Windows nor in Evince or Acrobat in Linux.
> 
> I’m using latest beta from 2019.11.14 17:07 (either MkIV or MkXL). Which
> beta are you using?
> 
> Many thanks for your help,
> 
> Pablo
> --
> http://www.ousia.tk
> ___
> 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] layers and \llap

2019-11-19 Thread Pablo Rodriguez
On 11/19/19 9:48 PM, Henri Menke wrote:
> On 11/20/19 3:16 AM, Pablo Rodriguez wrote:
>> [...]
>> Everything works fine if the layer with \llap is placed first.
>>
>> I guess this might be a bug.
>
> Works for me on both Evince and Foxit Reader.  I can't test Adobe because I'm
> on Linux.
>
> Try also \dontleavehmode\llap{\ConTeXt} because \llap by itself does not start
> a paragraph.

Hi Henri,

many thanks for your reply.

This is really weird, since I cannot make it work, either with Acrobat
in Windows nor in Evince or Acrobat in Linux.

I’m using latest beta from 2019.11.14 17:07 (either MkIV or MkXL). Which
beta are you using?

Many thanks for your help,

Pablo
--
http://www.ousia.tk
___
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] layers and \llap

2019-11-19 Thread Henri Menke
On 11/20/19 3:16 AM, Pablo Rodriguez wrote:
> Hi Hans,
> 
> this comes from a previous message about an issue with \llap and layers.
> 
> Here is the sample:
> 
> \defineviewerlayer[print][state=stop,printable=yes]
> \defineviewerlayer[view][state=start,printable=no]
> 
> \starttext
> \startviewerlayer[view]\color[red]{\TeX}\stopviewerlayer%
> \startviewerlayer[print]\llap{\ConTeXt}\stopviewerlayer%
> 
> \input zapf
> \stoptext
> 
> If the layer with \llap is placed last, disabling the view layer
> disables all the text.
> 
> Everything works fine if the layer with \llap is placed first.
> 
> I guess this might be a bug.

Works for me on both Evince and Foxit Reader.  I can't test Adobe because I'm
on Linux.

Try also \dontleavehmode\llap{\ConTeXt} because \llap by itself does not start
a paragraph.

Cheers,
Henri

> 
> Many thanks for your help,
> 
> Pablo
> --
> http://www.ousia.tk
> ___
> 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] Exchangeing content of variables between luacode and context

2019-11-19 Thread Rudolf Bahr
On Tue, Nov 19, 2019 at 04:55:15PM +0100, Wolfgang Schuster wrote:
> 
> Can you make a minimal example of your actual problem.


No, sorry, I can't.

My 'actual problem' is more or less a design problem: Should in a book project
ConTeXt be the master and Luacode the slave or vice versa? Both seems possible.

The task to solve is to set a photo album with say 300 DIN A4 landscape pages.
On every page there should be 1 to 4 columns filled with photos and texts mostly
defined in layers.

Up to now I made all in ConTeXt manually by trying, for instance::
- To estimate the width of layers, if neighboured layers should contain photos 
of
  same height with respect to center horizontally all columns at end of page.
- To complete abbreviations of long picture names; it's rather annoying doing
  this by copy and paste with hundreds of photo names; instead I'd like to type
  a short code and Luacode should complete it to the full name.
- To estimate the shift amount of all columns together in order to horizontally
  get them centered on the page.

All of these tasks can be made best by Luacode functions. And I'd like to save
their results in the ConTeXt program permanently. With 'tokens.setters.macro()'
it's possible only in the same, Luacode calling ConTeXt run. In the following
run, the macro shows its original value again and the Luacode program must be
called again to alter it.

So I've to think about making Luacode the master and ConTeXt the slave. Then 
it'd
be possible to embody Luacode's results permanently in the ConTeXt code. Vice 
versa
a solution could be to store Luacode's results in a flattened Lua table on disc.
But the perfect relating to their ConTeXt page remains difficult when inserting
or deleting of pages in an ensemble of 300 pages should become necessary. 
Another
much simpler solution would be the proposal above, namely, to copy the ConTeXt
program step by step and page by page to another file and introducing the 
Luacode
results simultaneously. 

In [1] there is a chapter with "stepper" commands, but I didn't understand that,
so I can't say, whether they are suitable for this issue.

Rudolf

[1] Hans Hagen, "ConTeXt Lua Documents", January 12, 2018, 3.4, page 30
___
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 command line interface documentation?

2019-11-19 Thread Philipp A.
That’s pretty cool, overriding that hook allows to build a ConTeXt language
server for editors like VS Code!
https://microsoft.github.io/language-server-protocol/

Sadly I’m still a bit lost: When calling `context file_with_error.tex`, I
see “This is LuaTeX, Version 1.10 … tex error on line … ?” and it waits for
input.
You said that context stops when encountering an error which isn’t the case
for me. Any ideas why?

Best, Philipp

Am Di., 19. Nov. 2019 um 10:34 Uhr schrieb Hans Hagen :

> Concerning errors, one can say
>
> context --directives="system.showerror" somefile
>
> and on an error an html file is generated (old feature) ... i still
> couldn't figure out a way to reliable launch a browser and target the
> same tab (so autolaunch is disabled for 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
> -
>
> ___
> 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] Exchangeing content of variables between luacode and context

2019-11-19 Thread Wolfgang Schuster

Rudolf Bahr schrieb am 19.11.2019 um 14:19:

Hello All!

To send variable contents from context to luacode I can put them into the
function invocation or use 'tokens.getters.macro("TestA")',
an interesting and very nice possibility to let luacode itself getting
contents of context macros. The (only?) way back, from luacode to context,
could be done by 'tokens.setters.macro("TestA","a")' [1] .

Now, to store Luacode's variable contents permanently in context programs
I could Luacode let copy my ConTeXt program to another place on disk with
a newly defined macro inside. But, does somebody know (by chance) of another,
more elegant possibility? I think giving back a value by "return" won't work.


Can you make a minimal example of your actual problem.

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] layers and \llap

2019-11-19 Thread Pablo Rodriguez
Hi Hans,

this comes from a previous message about an issue with \llap and layers.

Here is the sample:

\defineviewerlayer[print][state=stop,printable=yes]
\defineviewerlayer[view][state=start,printable=no]

\starttext
\startviewerlayer[view]\color[red]{\TeX}\stopviewerlayer%
\startviewerlayer[print]\llap{\ConTeXt}\stopviewerlayer%

\input zapf
\stoptext

If the layer with \llap is placed last, disabling the view layer
disables all the text.

Everything works fine if the layer with \llap is placed first.

I guess this might be a bug.

Many thanks for your help,

Pablo
--
http://www.ousia.tk
___
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] Widgets: Any good examples for developing JS-enabled PDFs that calculate?

2019-11-19 Thread Paul Mazaitis


Some further progress!

On 18 Nov 2019, at 13:56, Hans Hagen wrote:
the problem with calculate is that there are also settings related to 
it (plus some built-in addition stuff, at least that's what i see in 
the viewer preferences and such, which is likely to interfere)


From what I've been able to gather, there are three ways to get 
JavaScript into a PDF using Acrobat (or other software that uses the 
Acrobat way of doing things):


 - Predefined Calculations (use a UI to build a simple recipe)

 - Calculations built with Simplified Field Notation (operators and 
field names - I don't understand this one too well)


 - Custom Calculation Script (Acrobat JavaScript)

I _think_ these are relatively exclusive: I don't believe there's 
anything about the first two systems that interferes with the third (and 
I'm not sure how the UI would work for the first two in an LMTX context, 
anyway?).



(and calculate doens't seem to be called at all)


After digging around in the spec and comparing output, it looks like 
adding the CO (Calculation Order, PDF Spec 12.7.2) key and an array:


  /CO [15 0 R]

...to the AcroForm object is enough for the indicated field(s) to react 
to the internal calculation event.


The way I tested this is I inserted the above stanza (with the 
appropriate object ID) into the uncompressed LMTX PDF, and that was all 
it took for the calculate JS to start working for the total field.


(I likely wrecked the xref table in the process, but the PDF was still 
functional...)


I then built a form with a chained calculation (a second field that 
doubled the total field) and ended up with a CO entry like this:


/CO [13 0 R 19 0 R]

...and I believe that the order of the objects in this array is how the 
calculation precedence is determined.


So! This is bigger than just adding the CO array to enable calculations; 
there needs to be enough of an interface to also indicate calculation 
order somehow in the .tex file.


I'd love to have this as a feature, but I will cheerfully defer if this 
has become ridiculous...


-Paul





___
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] Exchangeing content of variables between luacode and context

2019-11-19 Thread Rudolf Bahr
Hello All!

To send variable contents from context to luacode I can put them into the
function invocation or use 'tokens.getters.macro("TestA")',
an interesting and very nice possibility to let luacode itself getting
contents of context macros. The (only?) way back, from luacode to context,
could be done by 'tokens.setters.macro("TestA","a")' [1] .

Now, to store Luacode's variable contents permanently in context programs
I could Luacode let copy my ConTeXt program to another place on disk with
a newly defined macro inside. But, does somebody know (by chance) of another,
more elegant possibility? I think giving back a value by "return" won't work.

Best wishes,
Rudolf


[1] Hans Hagen, "ConTeXt Lua Documents", January 12, 2018, 7.4, page 63
___
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] developer not verified error

2019-11-19 Thread Hans Hagen

On 11/19/2019 10:06 AM, Taco Hoekwater wrote:




On 18 Nov 2019, at 22:25, Alan Bowen  wrote:

This seems to be a problem peculiar to Catalina (macOS 10.15.1). There is a 
fix, as Otared and Glen have indicated.

go to Apple menu -> Preferences -> Security & Privacy
on the Security & Privacy, login, choose the tab General
there choose, towards the bottom of that pane, under « Allow apps 
downloaded from: »
choose the radio button App Store and identified developers
click the button «allow anyway»


There is a easier / safer way: open de folder with ‘mtxrun’ in it using Finder. 
Then select
‘Open’ from the popup menu on the mtxrun executable. That will give you dialog 
with that
’This app was downloaded …’ error, but now with an extra ‘Open’ button on it. 
Click that,
and it will start mtxrun once. Running mtxrun itself this ways is pointless, 
but it makes
Apple start to remember that *you* trust this mtxrun binary, and from now on it 
can be
used normally.

On packaged distributed Apps you download from the web, you can also hold down 
CTRL while
opening the App so you don’t have to do the Finder step, but I am not certain 
that works with
command-line binaries (and cannot test any more since I already did the ‘fix’ 
above).

It is a bit tedious, but sort of I see Apple’s point. Making it harder to run 
downloaded
unsigned executables is probably a good thing.
Kind of what windows does -) Remembering your choice (but I think also 
doing some virus scan on the first run and/or download).


Do we need to wikify these things? A page with "if this happens, do 
that" items? Or maybe some readme in the installer zips? I think one 
problem is that users have no clue (ok, tex will not be the only such 
app so in the end they will know and tex users are normally more in 
figuring-out-mode anyway).


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] context command line interface documentation?

2019-11-19 Thread Hans Hagen

Concerning errors, one can say

context --directives="system.showerror" somefile

and on an error an html file is generated (old feature) ... i still 
couldn't figure out a way to reliable launch a browser and target the 
same tab (so autolaunch is disabled for 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
-
___
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 command line interface documentation?

2019-11-19 Thread Hans Hagen

Hi,

What you’re describing is the behavior I’m trying to achieve. The error 
location reporting works for me, but context will still continue after 
an error for me:
If I don’t specify --nonstopmode or so it’ll try to recover, and even 
when I specify it, there will be other output after the error.


What version are you running? The latest lmtx should quite after an 
error. When no proper document can be created it will provide an error 
document.



Not that the script actually expects quotes in argv?


The command line parsing is kind of special

- lua(metatex) itself has to intercept some flags and act on it
- the context (and mtxrun) script also need them (as script)
- some passed arguments are used to drive the process
- and potentially common flags should not interfere

--foo
--foo=bar
--foo="bar bar"

filename
"file name"

should all work (also with special characters but of course there can be 
issues i don't know about); so intrepretation happens in the engine, in 
mtxrun (script0, context (script), context (macro package)


when you run context you can see the exact call to luatex and how 
arguments get passed (some get prefixed with "c:")


concerning the wiki, best discuss that with Pavneet (in cc) as he's in 
charge of (re)organizing the wiki; if you have suggestions for any of 
the manuals in the distribution that deal with this, you can just sedn 
them to me


thanks,

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] developer not verified error

2019-11-19 Thread Taco Hoekwater


> On 18 Nov 2019, at 22:25, Alan Bowen  wrote:
> 
> This seems to be a problem peculiar to Catalina (macOS 10.15.1). There is a 
> fix, as Otared and Glen have indicated.
> 
> go to Apple menu -> Preferences -> Security & Privacy
>   on the Security & Privacy, login, choose the tab General
>   there choose, towards the bottom of that pane, under « Allow apps 
> downloaded from: » 
>choose the radio button App Store and identified developers
>click the button «allow anyway»

There is a easier / safer way: open de folder with ‘mtxrun’ in it using Finder. 
Then select 
‘Open’ from the popup menu on the mtxrun executable. That will give you dialog 
with that 
’This app was downloaded …’ error, but now with an extra ‘Open’ button on it. 
Click that,
and it will start mtxrun once. Running mtxrun itself this ways is pointless, 
but it makes
Apple start to remember that *you* trust this mtxrun binary, and from now on it 
can be
used normally.

On packaged distributed Apps you download from the web, you can also hold down 
CTRL while 
opening the App so you don’t have to do the Finder step, but I am not certain 
that works with
command-line binaries (and cannot test any more since I already did the ‘fix’ 
above).

It is a bit tedious, but sort of I see Apple’s point. Making it harder to run 
downloaded
unsigned executables is probably a good thing.


Best wishes,
Taco
___
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] developer not verified error

2019-11-19 Thread Hans Hagen

On 11/18/2019 10:32 PM, Henri Menke wrote:


In macOS Catalina Apple introduced “notarization”, i.e. anything you
install has to have Apple's blessing, otherwise it will refuse to
install and show you a message that it is malware.  Dick Koch,
maintainer of MacTeX ran into the same problems, as he presented at
TUG2019 and described in the corresponding TUGboat article:

 http://tug.org/TUGboat/tb40-2/tb125koch-harden.pdf


sounds like a lot of work ... now, with these nicely signed binaries, 
what about tex (or even lua code) ... in principle each of the 
additional files (with macros) should be tested too because they're 
basically programs themselves


(my ancient macbook os not updatable so i can't test it anyway, can't 
even run tex on it any more i think, so i'm forever protected against tex)


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
___