Re: [NTG-context] Fwd: Fwd: IBM Wordcloud with the Filter Module

2019-03-14 Thread Aditya Mahajan

On Fri, 15 Mar 2019, Jeroen wrote:


I have installed portable java8 in /context/java, so paths will not be
needed when using absolute paths with the commands in these files. When I
execute the following batch file sample2.bat with a command on a single
line, it will create the sample2.png wordcould file as expected in the
/context/documents folder:

/context/java/bin/java -jar /context/wordcloud/ibm-word-cloud.jar -c
/context/wordcloud/examples/configuration.txt -w 800 -h 600 <
/context/wordcloud/examples/hamlet.txt > /context/documents/sample2.png

I now use this test2.tex file with filter with the defineexternalfilter
command on one line without crlf or spaces:

fonts   > 'fallback modern-designsize rm 12pt' is loaded
t-filter> current filter : wordcloud
t-filter> base file : test2-temp-wordcloud-0
t-filter> input file : test2-temp-wordcloud-0.tmp
t-filter> output file : test2-temp-wordcloud-0.png
t-filter> command : /context/java/bin/java -jar
/context/wordcloud/ibm-word-cloud.jar -c
/context/wordcloud/examples/configuration.txt -w 800 -h 600 -o
test2-temp-wordcloud-0.png -i test2-temp-wordcloud-0.tmp
t-filter> state :
t-filter> cached output file 'test2-temp-wordcloud-0.png' missing.
Rerunning filter
t-filter> file 'test2-temp-wordcloud-0.png' cannot be found
t-filter> current filter : wordcloud
t-filter> base file : test2-temp-wordcloud-0
t-filter> input file : test2-temp-wordcloud-0.tmp
t-filter> output file : test2-temp-wordcloud-0.png


Everything looks okay here, so I am not sure what is going wrong. Can you 
try if you can run other java programs, perhaps even setting


\usemodule[filter]
\traceexternalfilters
\defineexternalfilter[JAVA][filtercommand=java]

\starttext
\startJAVA
This is a test
\stopJAVA
\stoptext

and check the console output to see if you see messages that java is 
running (you should see the standard message about how to use java). If 
java is being called correctly, then the error is on the java end of 
things and I don't know how to debug that.


Aditya
___
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] Fwd: Fwd: IBM Wordcloud with the Filter Module

2019-03-14 Thread Jeroen
I have installed portable java8 in /context/java, so paths will not be
needed when using absolute paths with the commands in these files. When I
execute the following batch file sample2.bat with a command on a single
line, it will create the sample2.png wordcould file as expected in the
/context/documents folder:

/context/java/bin/java -jar /context/wordcloud/ibm-word-cloud.jar -c
/context/wordcloud/examples/configuration.txt -w 800 -h 600 <
/context/wordcloud/examples/hamlet.txt > /context/documents/sample2.png

I now use this test2.tex file with filter with the defineexternalfilter
command on one line without crlf or spaces:

\usemodule[filter]


\defineexternalfilter[wordcloud][filtercommand={/context/java/bin/java -jar
/context/wordcloud/ibm-word-cloud.jar -c
/context/wordcloud/examples/configuration.txt -w 800 -h 600 -o
\externalfilteroutputfile\space -i \externalfilterinputfile},
output=\externalfilterbasefile.png, readcommand=\ExternalFigure,
continue=yes, read=yes, cache=yes, purge=no,]


\def\ExternalFigure#1{\externalfigure[#1]}


\traceexternalfilters


\starttext

\startwordcloud

Een bak cijfers vertalen naar een visuele weergave kan ervoor zorgen dat
statistische data beter gecommuniceerd wordt. Grafieken zijn zoals Tufte
(1997), een bekende auteur op het gebied van analytisch ontwerp, zegt
instruments for reasoning. Voordat het zover is zullen echter eerst een
paar stappen genomen moeten worden. Ervan uitgaande dat de bak met data al
verzameld is moet er gekeken worden welke cijfers met elkaar in verband
kunnen worden gebracht. Is er een ontwikkeling in tijd, zijn er
verschillen, is er een stijgende of dalende lijn in te ontdekken etcetra.
Door deze data te rangschikken en te ordenen kunnen deze patronen zichtbaar
gemaakt worden. Ontwikkelingen, schommelingen hierin, de frequentie
hiervan, onderlinge relaties en een totaaloverzicht kunnen in beeld
gebracht worden.

\stopwordcloud

\stoptext


and the created pdf file states "output file missing", and the following is
the test2.log file content:

open source > level 1, order 1, name
'C:/context/tex/texmf-context/tex/context/base/mkiv/cont-yes.mkiv'
system  >
system  > ConTeXt  ver: 2018.07.02 14:39 MKIV beta  fmt: 2018.9.28
int: english/english
system  >
system  > 'cont-new.mkiv' loaded
open source > level 2, order 2, name
'C:/context/tex/texmf-context/tex/context/base/mkiv/cont-new.mkiv'
system  > beware: some patches loaded from cont-new.mkiv
close source> level 2, order 2, name
'C:/context/tex/texmf-context/tex/context/base/mkiv/cont-new.mkiv'
system  > files > jobname 'test2', input './test2', result 'test2'
fonts   > latin modern fonts are not preloaded
languages   > language 'en' is active
system  > synctex functionality is enabled, expect 5-10 pct runtime
overhead!
open source > level 2, order 3, name 'C:/context/documents/test2.tex'
modules > 'filter' is loaded
open source > level 3, order 4, name
'C:/context/tex/texmf-modules/tex/context/third/filter/t-filter.mkiv'
loading > Filter (ver: 2018.08.10)
modules > 'module-catcodes' is loaded
open source > level 4, order 5, name
'C:/context/tex/texmf-modules/tex/context/third/filter/t-module-catcodes.mkiv'
loading > Module Catcodes (ver: 2018.04.16)
close source> level 4, order 5, name
'C:/context/tex/texmf-modules/tex/context/third/filter/t-module-catcodes.mkiv'
close source> level 3, order 5, name
'C:/context/tex/texmf-modules/tex/context/third/filter/t-filter.mkiv'
fonts   > preloading latin modern fonts (second stage)
fonts   > defining > source file
'D:/context/tex/texmf/fonts/opentype/public/lm/lmroman12-regular.otf' is
not found
fonts   > defining > using source file
'C:/context/tex/texmf/fonts/opentype/public/lm/lmroman12-regular.otf' due
to cache mismatch
fonts   > defining > source file
'D:/context/tex/texmf/fonts/opentype/public/lm-math/latinmodern-math.otf'
is not found
fonts   > defining > using source file
'C:/context/tex/texmf/fonts/opentype/public/lm-math/latinmodern-math.otf'
due to cache mismatch
fonts   > 'fallback modern-designsize rm 12pt' is loaded
t-filter> current filter : wordcloud
t-filter> base file : test2-temp-wordcloud-0
t-filter> input file : test2-temp-wordcloud-0.tmp
t-filter> output file : test2-temp-wordcloud-0.png
t-filter> command : /context/java/bin/java -jar
/context/wordcloud/ibm-word-cloud.jar -c
/context/wordcloud/examples/configuration.txt -w 800 -h 600 -o
test2-temp-wordcloud-0.png -i test2-temp-wordcloud-0.tmp
t-filter> state :
t-filter> cached output file 'test2-temp-wordcloud-0.png' missing.
Rerunning filter
t-filter> file 'test2-temp-wordcloud-0.png' cannot be found
t-filter> current filter : wordcloud
t-filter> base file : test2-temp-wordcloud-0
t-filter> input file : 

Re: [NTG-context] Fwd: IBM Wordcloud with the Filter Module

2019-03-14 Thread Aditya Mahajan

On Thu, 14 Mar 2019, Jeroen wrote:


I am able to run R, asymptote, graphviz, octave, openscad, python and
freecad all on the filter module without problems. The same problem as I
have with wordcloud I have with maxima and geogebra. \traceexternalfilters
isnt giving me a lot. I have tried the following sample1.bat batch file and
it seems to create the wc file from the sample text file that comes with
wordcloud

java

-jar /context/wordcloud/ibm-word-cloud.jar

-c /context/wordcloud/examples/configuration.txt

-w 800

-h 600

< /context/wordcloud/examples/hamlet.txt >

/context/documents/sample1.png


Can you attach your test file and the log file? The email program is 
creating line breaks and I am not sure whether that is there in the 
original file or not.


The only other thing that I can think of is that some executables are not 
in the path when you are running context (depends a bit on the OS and how 
context is being run)


Aditya
___
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] Fwd: IBM Wordcloud with the Filter Module

2019-03-14 Thread Jeroen
I am able to run R, asymptote, graphviz, octave, openscad, python and
freecad all on the filter module without problems. The same problem as I
have with wordcloud I have with maxima and geogebra. \traceexternalfilters
isnt giving me a lot. I have tried the following sample1.bat batch file and
it seems to create the wc file from the sample text file that comes with
wordcloud

java

-jar /context/wordcloud/ibm-word-cloud.jar

-c /context/wordcloud/examples/configuration.txt

-w 800

-h 600

< /context/wordcloud/examples/hamlet.txt >

/context/documents/sample1.png
___
___
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] Can't use MetaFun with mplib anymore

2019-03-14 Thread luigi scarso
On Thu, Mar 14, 2019 at 10:52 AM Hans Hagen  wrote:

> as currently the variable is isn't used we can also comment it
>
>
>
seems so
I have commented the line, and all formats and the plain test run.


-- 
luigi
___
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] Can't use MetaFun with mplib anymore

2019-03-14 Thread Hans Hagen

On 3/14/2019 10:00 AM, Henri Menke wrote:

On 3/14/19 8:49 PM, Hans Hagen wrote:

On 3/14/2019 5:56 AM, Henri Menke wrote:


Dear list,

Something has changed in MetaFun and it can no longer be used in plain
LuaTeX,
with neither of

  luatex test.tex
  mtxrun --script plain test.tex

This is the error:

  >> LUATEXFUNCTIONALITY
  >> "mp.print(LUATEXFUNCTIONALITY)"
  ! Equation cannot be performed (numeric=string).


hm, that can be

mp.print(LUATEXFUNCTIONALITY or 0)

but ... i'm surprised you can use metafun in plain at all ... i never
test that and to be honest am not too motivated to support mpiv code in
generic either .. better use


Until TeX Live 2018, MetaFun worked in plain (at least the subset I'm
using).  It would be a shame if the support would end.  I also think
that there are quite a number of users.  The number of posts on TeX
Stack Exchange mentioning luamplib with metafun is not negligible.
https://tex.stackexchange.com/search?q=mplibsetformat


ok, as long as no one expects me to check functionality in plain usage

things like special colors and shading and some font related options 
won't work, so in that case the stand alone graphics are better


(there are quite some metafun macros that assume the lua extensions that 
context provides and some upcoming extra modules, for sure will not work 
in plain ... no problem as long as these macros are not used ...)



I (and probably a lot of other people) would really appreciate if you
could apply Luigi's fix, so we can continue do enjoy MetaFun, even
outside ConTeXt.

i'll comment the line

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] Can't use MetaFun with mplib anymore

2019-03-14 Thread Hans Hagen

On 3/14/2019 8:51 AM, luigi scarso wrote:



On Thu, Mar 14, 2019 at 5:56 AM Henri Menke > wrote:



Dear list,

Something has changed in MetaFun and it can no longer be used in
plain LuaTeX,
with neither of

     luatex test.tex
     mtxrun --script plain test.tex

This is the error:

     >> LUATEXFUNCTIONALITY
     >> "mp.print(LUATEXFUNCTIONALITY)"
     ! Equation cannot be performed (numeric=string).

MWE is below, as always.

Cheers, Henri

---

\directlua{
local mpkpse = kpse.new(arg[0], "mpost")

local function finder(name, mode, ftype)
     if mode == "w" then
         return name
     else
         return mpkpse:find_file(name,ftype)
     end
end

local mpx = mplib.new {
     find_file = finder
}
local ret = mpx:execute[[
boolean mplib ; mplib := true ;
input metafun.mp  ;
]]

print(ret.log)
}
\bye


in mp-mlib.mpiv it seems that we should have
string  LUATEXFUNCTIONALITY ; LUATEXFUNCTIONALITY := 
runscript("mp.print(LUATEXFUNCTIONALITY)") ;

instead of
numeric LUATEXFUNCTIONALITY ; LUATEXFUNCTIONALITY := 
runscript("mp.print(LUATEXFUNCTIONALITY)") ;

Now I have
tex/texmf-context/metapost/context/base/mpiv$ grep -r LUATEXFUNCTIONALITY
mp-mlib.mpiv:%numeric LUATEXFUNCTIONALITY ; LUATEXFUNCTIONALITY := 
runscript("mp.print(LUATEXFUNCTIONALITY)") ;
mp-mlib.mpiv:string  LUATEXFUNCTIONALITY ; LUATEXFUNCTIONALITY := 
runscript("mp.print(LUATEXFUNCTIONALITY)") ;


and your example looks ok.

as currently the variable is isn't used we can also comment it

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] Can't use MetaFun with mplib anymore

2019-03-14 Thread Henri Menke
On 3/14/19 8:49 PM, Hans Hagen wrote:
> On 3/14/2019 5:56 AM, Henri Menke wrote:
>>
>> Dear list,
>>
>> Something has changed in MetaFun and it can no longer be used in plain
>> LuaTeX,
>> with neither of
>>
>>  luatex test.tex
>>  mtxrun --script plain test.tex
>>
>> This is the error:
>>
>>  >> LUATEXFUNCTIONALITY
>>  >> "mp.print(LUATEXFUNCTIONALITY)"
>>  ! Equation cannot be performed (numeric=string).
> 
> hm, that can be
> 
> mp.print(LUATEXFUNCTIONALITY or 0)
> 
> but ... i'm surprised you can use metafun in plain at all ... i never
> test that and to be honest am not too motivated to support mpiv code in
> generic either .. better use

Until TeX Live 2018, MetaFun worked in plain (at least the subset I'm
using).  It would be a shame if the support would end.  I also think
that there are quite a number of users.  The number of posts on TeX
Stack Exchange mentioning luamplib with metafun is not negligible.
https://tex.stackexchange.com/search?q=mplibsetformat

I (and probably a lot of other people) would really appreciate if you
could apply Luigi's fix, so we can continue do enjoy MetaFun, even
outside ConTeXt.

Cheers, Henri

> 
> \startMPpage
> \stopMPpage
> 
> with context and then include the pdf
> 
> Hans
> 
>> MWE is below, as always.
>>
>> Cheers, Henri
>>
>> ---
>>
>> \directlua{
>> local mpkpse = kpse.new(arg[0], "mpost")
>>
>> local function finder(name, mode, ftype)
>>  if mode == "w" then
>>  return name
>>  else
>>  return mpkpse:find_file(name,ftype)
>>  end
>> end
>>
>> local mpx = mplib.new {
>>  find_file = finder
>> }
>> local ret = mpx:execute[[
>> boolean mplib ; mplib := true ;
>> input metafun.mp ;
>> ]]
>>
>> print(ret.log)
>> }
>> \bye
>>
>> ___
>>
>> 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] Can't use MetaFun with mplib anymore

2019-03-14 Thread luigi scarso
On Thu, Mar 14, 2019 at 5:56 AM Henri Menke  wrote:

>
> Dear list,
>
> Something has changed in MetaFun and it can no longer be used in plain
> LuaTeX,
> with neither of
>
> luatex test.tex
> mtxrun --script plain test.tex
>
> This is the error:
>
> >> LUATEXFUNCTIONALITY
> >> "mp.print(LUATEXFUNCTIONALITY)"
> ! Equation cannot be performed (numeric=string).
>
> MWE is below, as always.
>
> Cheers, Henri
>
> ---
>
> \directlua{
> local mpkpse = kpse.new(arg[0], "mpost")
>
> local function finder(name, mode, ftype)
> if mode == "w" then
> return name
> else
> return mpkpse:find_file(name,ftype)
> end
> end
>
> local mpx = mplib.new {
> find_file = finder
> }
> local ret = mpx:execute[[
> boolean mplib ; mplib := true ;
> input metafun.mp ;
> ]]
>
> print(ret.log)
> }
> \bye
>
>
in mp-mlib.mpiv it seems that we should have
string  LUATEXFUNCTIONALITY ; LUATEXFUNCTIONALITY :=
runscript("mp.print(LUATEXFUNCTIONALITY)") ;
instead of
numeric LUATEXFUNCTIONALITY ; LUATEXFUNCTIONALITY :=
runscript("mp.print(LUATEXFUNCTIONALITY)") ;

Now I have
tex/texmf-context/metapost/context/base/mpiv$ grep -r LUATEXFUNCTIONALITY
mp-mlib.mpiv:%numeric LUATEXFUNCTIONALITY ; LUATEXFUNCTIONALITY :=
runscript("mp.print(LUATEXFUNCTIONALITY)") ;
mp-mlib.mpiv:string  LUATEXFUNCTIONALITY ; LUATEXFUNCTIONALITY :=
runscript("mp.print(LUATEXFUNCTIONALITY)") ;

and your example looks ok.

-- 
luigi
___
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] Can't use MetaFun with mplib anymore

2019-03-14 Thread Hans Hagen

On 3/14/2019 5:56 AM, Henri Menke wrote:


Dear list,

Something has changed in MetaFun and it can no longer be used in plain LuaTeX,
with neither of

 luatex test.tex
 mtxrun --script plain test.tex

This is the error:

 >> LUATEXFUNCTIONALITY
 >> "mp.print(LUATEXFUNCTIONALITY)"
 ! Equation cannot be performed (numeric=string).


hm, that can be

mp.print(LUATEXFUNCTIONALITY or 0)

but ... i'm surprised you can use metafun in plain at all ... i never 
test that and to be honest am not too motivated to support mpiv code in 
generic either .. better use


\startMPpage
\stopMPpage

with context and then include the pdf

Hans


MWE is below, as always.

Cheers, Henri

---

\directlua{
local mpkpse = kpse.new(arg[0], "mpost")

local function finder(name, mode, ftype)
 if mode == "w" then
 return name
 else
 return mpkpse:find_file(name,ftype)
 end
end

local mpx = mplib.new {
 find_file = finder
}
local ret = mpx:execute[[
boolean mplib ; mplib := true ;
input metafun.mp ;
]]

print(ret.log)
}
\bye

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