Re: [NTG-context] ctxlua percentage format escape

2021-05-29 Thread Hans Hagen
On 5/29/2021 3:02 PM, Jairo A. del Rio wrote: Hi, Adam. There are some ways to do it. I'm sure there are many more, but I don't remember them right now. Hi, Hans. There's a bug (?) in syst-lua.lua related to \expression in MkIV (xmath and xcomplex aren't defined). Please fix that something

Re: [NTG-context] ctxlua percentage format escape

2021-05-29 Thread Adam Reviczky
\startmkivmode > > \startluacode > > xmath = xmath or math > > xcomplex = xcomplex or {} --maybe math too??? > > \stopluacode > > \stopmkivmode > > \starttext > > $\pi = \ctxlua{context("\letterpercent.6f", math.pi)}$ > > >

Re: [NTG-context] ctxlua percentage format escape

2021-05-29 Thread Jairo A. del Rio
... \relax doesn't work \startmkivmode \startluacode xmath = xmath or math xcomplex = xcomplex or {} --maybe math too??? \stopluacode \stopmkivmode \starttext $\pi = \ctxlua{context("\letterpercent.6f", math.pi)}$ $\pi = \expression string.format("\letterpercent.6f", pi

[NTG-context] ctxlua percentage format escape

2021-05-29 Thread Adam Reviczky
Hi, I was trying to use a quick calculation like the new mathfun in lmtx for an older mkiv document. MWE from the wiki: https://wiki.contextgarden.net/Programming_in_LuaTeX#Examples \starttext $\pi = \ctxlua{context("\%.6f", math.pi)}$ \stoptext But that gives an error (actually for

Re: [NTG-context] Trying to understand this ctxlua error

2020-04-06 Thread Gerben Wierda
On 6 Apr 2020, at 02:54, Wolfgang Schuster wrote: > > Gerben Wierda schrieb am 06.04.2020 um 00:41: >> I got this error after I had changed some lua code: >> tex error > tex error on line 272 in file archimate-lua.new: ! >> Undefined control sequence >> warnIfVerbose( "Breaking

Re: [NTG-context] Trying to understand this ctxlua error

2020-04-05 Thread Wolfgang Schuster
Gerben Wierda schrieb am 06.04.2020 um 00:41: I got this error after I had changed some lua code: tex error       > tex error on line 272 in file archimate-lua.new: ! Undefined control sequence         warnIfVerbose( "Breaking off the processing of node %s\nNo       l...eak

[NTG-context] Trying to understand this ctxlua error

2020-04-05 Thread Gerben Wierda
I got this error after I had changed some lua code: tex error > tex error on line 272 in file archimate-lua.new: ! Undefined control sequence warnIfVerbose( "Breaking off the processing of node %s\nNo l...eak

Re: [NTG-context] \ctxlua and \startluacode ... \stopluacode

2019-10-16 Thread Rudolf Bahr
andalone lua typically sees only one chunk (the file you pass on the > > command > > line) but embedded lua implementation often see (sometimes many) more > > chunks. > > In luatex’s case, each \directlua is a separate chunk (in ConTeXt, that > > means every > > \s

Re: [NTG-context] \ctxlua and \startluacode ... \stopluacode

2019-10-15 Thread Hans Hagen
(sometimes many) more chunks. In luatex’s case, each \directlua is a separate chunk (in ConTeXt, that means every \startluacode block and every \ctxlua call is a separate chunk). The only unusual thing here is that standalone lua silently quits and returns a non-zero exit code to the shell, wher

Re: [NTG-context] \ctxlua and \startluacode ... \stopluacode

2019-10-15 Thread Taco Hoekwater
many) more chunks. In luatex’s case, each \directlua is a separate chunk (in ConTeXt, that means every \startluacode block and every \ctxlua call is a separate chunk). The only unusual thing here is that standalone lua silently quits and returns a non-zero exit code to the shell, whereas luatex

Re: [NTG-context] \ctxlua and \startluacode ... \stopluacode

2019-10-14 Thread Rudolf Bahr
On Mon, Oct 14, 2019 at 09:26:58PM +0200, Taco Hoekwater wrote: > Hi, > > > On 14 Oct 2019, at 21:08, Rudolf Bahr wrote: > > > > > > 2. But in the case of an not existing file (BBB.lua) the known error > > message comes up > > again: > > &qu

Re: [NTG-context] \ctxlua and \startluacode ... \stopluacode

2019-10-14 Thread Taco Hoekwater
Hi, > On 14 Oct 2019, at 21:08, Rudolf Bahr wrote: > > > 2. But in the case of an not existing file (BBB.lua) the known error message > comes up > again: > "token call, execute: [ctxlua]:8: /home/sam/context-tests/BBB.lua: No such > file or >directory

Re: [NTG-context] \ctxlua and \startluacode ... \stopluacode

2019-10-14 Thread Rudolf Bahr
>context ( " exists!" ) > > else > >context ( name ) > > context ( " doesn't exist!" ) > > end > > end > > > > \stopluacode > > > > > > \starttext > > > > \def\l

Re: [NTG-context] \ctxlua and \startluacode ... \stopluacode

2019-10-14 Thread Hans Hagen
( name, "r" )) if f then f:close () context ( name ) context ( " exists!" ) else context ( name ) context ( " doesn't exist!" ) end end \stopluacode \starttext \def\lookupfile#1% {\ctxl

Re: [NTG-context] \ctxlua and \startluacode ... \stopluacode

2019-10-14 Thread Taco Hoekwater
Hi, > On 14 Oct 2019, at 18:51, Rudolf Bahr wrote: > >  > Dear List! > > THis MWE must be faulty, but where is the error? > > === > \lookupfile{"$HOME/context-tests/AAA.lua"}% "AAA.lua" intentionally does > exist $HOME is an actual

[NTG-context] RE : \ctxlua and \startluacode ... \stopluacode

2019-10-14 Thread Joseph
I suspect the double quotes are part of file names, hence files cannot be found. Perhaps try remove them in macro argument. Hope this helps De : Rudolf Bahr Envoyé le :lundi 14 octobre 2019 18:50 À : ntg-context@ntg.nl Objet :[NTG-context] \ctxlua and \startluacode ... \stopluacode Dear List

[NTG-context] \ctxlua and \startluacode ... \stopluacode

2019-10-14 Thread Rudolf Bahr
f:close () context ( name ) context ( " exists!" ) else context ( name ) context ( " doesn't exist!" ) end end \stopluacode \starttext \def\lookupfile#1% {\ctxlua{userdata.file_exists([==[#1]==])}} \lookupfile{"$HOME/cont

Re: [NTG-context] single command for \ctxlua{context(...)}

2019-03-12 Thread Pablo Rodriguez
On 3/11/19 10:36 PM, Wolfgang Schuster wrote: > Pablo Rodriguez schrieb am 11.03.19 um 22:23: >> [...] >> Is there a single command for \ctxlua{context(...)}? > > \cldcontext{...} Many thanks for your fast reply, Wolfgang. Pablo --

Re: [NTG-context] single command for \ctxlua{context(...)}

2019-03-11 Thread Wolfgang Schuster
Pablo Rodriguez schrieb am 11.03.19 um 22:23: Dear list, I know this has been already posted to the list, but I cannot find it right now. Is there a single command for \ctxlua{context(...)}? \cldcontext{...} Wolfgang

[NTG-context] single command for \ctxlua{context(...)}

2019-03-11 Thread Pablo Rodriguez
Dear list, I know this has been already posted to the list, but I cannot find it right now. Is there a single command for \ctxlua{context(...)}? Many thanks for your help, Pablo -- http://www.ousia.tk ___ If your

Re: [NTG-context] How to use tex.print in ctxlua

2017-03-19 Thread Hans Hagen
On 3/19/2017 4:51 PM, Thomas A. Schmitz wrote: On 19.03.2017 16:30, Otared Kavian wrote: I would like to print in a text the values of a array computed in a \startluacode …. \stopluacode combination. How can I do it properly? Please have a look at the example below and its output, which is not

Re: [NTG-context] How to use tex.print in ctxlua

2017-03-19 Thread Hans Hagen
On 3/19/2017 5:56 PM, Wolfgang Schuster wrote: Otared Kavian 19. März 2017 um 17:46via Postbox Hi Aditya, Thanks, as Thomas, Pablo and you mentioned the right way is to use context()

Re: [NTG-context] How to use tex.print in ctxlua

2017-03-19 Thread Otared Kavian
Hi Wolfgang, Thanks for letting me know the command string.formatters[….]. It allows to avoid the concatenation, which is to avoid as Thomas points out. Now that I have solved the issue with the spurious space, I have one more question: how could one print the values (vecteuX[i],vecteurY[i])

Re: [NTG-context] How to use tex.print in ctxlua

2017-03-19 Thread Wolfgang Schuster
Otared Kavian 19. März 2017 um 17:46via Postbox Hi Aditya, Thanks, as Thomas, Pablo and you mentioned the right way is to use context() instead of tex.print() Actually I just saw that

Re: [NTG-context] How to use tex.print in ctxlua

2017-03-19 Thread Thomas A. Schmitz
On 19.03.2017 16:56, Pablo Rodriguez wrote: is there any reason not to use the following instead of your way below? for i = 1,n do tex.print("(" .. vecteurX[i] .. ", " .. vecteurY[i] .. ")\\par") end I don't think that this is a good approach. Refer to chapter 11.6 of "Programming in

Re: [NTG-context] How to use tex.print in ctxlua

2017-03-19 Thread Otared Kavian
Hi Aditya, Thanks, as Thomas, Pablo and you mentioned the right way is to use context() instead of tex.print() Actually I just saw that one can also concatenate with context() as in: context("(" .. vecteurX[i] .. ", " .. vecteurY[i] .. ")\\par") which is equivalent to

Re: [NTG-context] How to use tex.print in ctxlua

2017-03-19 Thread Otared Kavian
Hi Pablo, Thanks for your answer: actually I did not know that it is possible to concatenate so easily in lua… Your solution is indeed simpler than what I did and solves also the problem of the spurious space before the closing parenthesis. Best regards: OK > On 19 Mar 2017, at 16:56, Pablo

Re: [NTG-context] How to use tex.print in ctxlua

2017-03-19 Thread Otared Kavian
Hi Thomas, Thanks for your answer. Indeed I did not know that I could use directly context(vecteurY[i]) Now this solves my problem! Best regards: OK > On 19 Mar 2017, at 16:51, Thomas A. Schmitz > wrote: > > On 19.03.2017 16:30, Otared Kavian wrote: >> I

Re: [NTG-context] How to use tex.print in ctxlua

2017-03-19 Thread Aditya Mahajan
On Sun, 19 Mar 2017, Otared Kavian wrote: Hi, I would like to print in a text the values of a array computed in a \startluacode …. \stopluacode combination. How can I do it properly? Please have a look at the example below and its output, which is not satisfactory because the right

Re: [NTG-context] How to use tex.print in ctxlua

2017-03-19 Thread Pablo Rodriguez
On 03/19/2017 04:30 PM, Otared Kavian wrote: > Hi, > > I would like to print in a text the values of a array computed in a > \startluacode …. \stopluacode combination. > How can I do it properly? Please have a look at the example below > and its output, which is not satisfactory because the right

Re: [NTG-context] How to use tex.print in ctxlua

2017-03-19 Thread Thomas A. Schmitz
On 19.03.2017 16:30, Otared Kavian wrote: I would like to print in a text the values of a array computed in a \startluacode …. \stopluacode combination. How can I do it properly? Please have a look at the example below and its output, which is not satisfactory because the right parenthesis is

Re: [NTG-context] How to use tex.print in ctxlua

2017-03-19 Thread josephcanedo
Hi, I think you can use tex.write() instead of tex.print() (pretty much the same as in lua io functions). Hope this helps Joseph De : Otared Kavian Envoyé le :dimanche 19 mars 2017 16:31 À : mailing list for ConTeXt users Objet :[NTG-context] How to use tex.print in ctxlua Hi, I would like

[NTG-context] How to use tex.print in ctxlua

2017-03-19 Thread Otared Kavian
. How can I suppress this unwanted space? For instance I get (1, 103 ) instead of (1, 103). Thanks in advance for any help, Best regards: OK %%% begin ctxlua-print.tex \starttext \startluacode n = 6 ; vecteurX = {} ; for i = 1,n do vecteurX[i] = i

Re: [NTG-context] call of string.match() inside \ctxlua{}

2017-01-19 Thread Hans Hagen
On 1/19/2017 5:03 PM, DesdeChaves wrote: Dear Sirs A have a string where I need to extract one number. But every time I run this code I found this error message: [ctxlua]:1: unfinished string near \usemodule[scancsv] \def\licann#1{% #1 - lesson number with strings \ctxlua{parsedate

[NTG-context] call of string.match() inside \ctxlua{}

2017-01-19 Thread DesdeChaves
Dear Sirs A have a string where I need to extract one number. But every time I run this code I found this error message: [ctxlua]:1: unfinished string near \usemodule[scancsv] \def\licann#1{% #1 - lesson number with strings \ctxlua{parsedate=thirddata.scancsv.ParseCSVLine('#1','n.º

[NTG-context] escaping quotes in \ctxlua

2015-09-30 Thread Pablo Rodriguez
Dear list, I have the following sample: \starttext \startluacode tex.print(os.getenv("USER") \stopluacode \ctxlua{tex.print(os.getenv("USER")} \stoptext How can I escape the quotes in the \ctxlua command? Many thanks for your help, Pablo --

Re: [NTG-context] escaping quotes in \ctxlua

2015-09-30 Thread Wolfgang Schuster
Pablo Rodriguez <mailto:oi...@gmx.es> 30. September 2015 um 17:07 Dear list, I have the following sample: \starttext \startluacode tex.print(os.getenv("USER") \stopluacode \ctxlua{tex.print(os.getenv("USER")} \stoptext How can I escape the quotes in the \ctxlu

Re: [NTG-context] escaping quotes in \ctxlua

2015-09-30 Thread Tomas Hala
;USER") # \stopluacode # # \ctxlua{tex.print(os.getenv("USER")} # \stoptext # # How can I escape the quotes in the \ctxlua command? # # Many thanks for your help, # # # Pablo # -- #

Re: [NTG-context] escaping quotes in \ctxlua

2015-09-30 Thread Pablo Rodriguez
On 09/30/2015 05:20 PM, Wolfgang Schuster wrote: >> Pablo Rodriguez 30. September 2015 um 17:07 >> Dear list, >> >> I have the following sample: >> >> \starttext >> \startluacode >> tex.print(os.getenv("USER") >> \stopluacode >>

[NTG-context] arguments to ctxlua

2010-03-30 Thread Hans van der Meer
When I have a Lua function with 2 arguments: \startluacode function f(a,b) ... \stopluacode called through: \def\callf#1#2{\ctxlua{f(#1,#2)}} and do this actually with one argument: \callf{one} then I find that the absent argument b in f(a,b

Re: [NTG-context] arguments to ctxlua

2010-03-30 Thread Hans Hagen
On 30-3-2010 19:45, Hans van der Meer wrote: When I have a Lua function with 2 arguments: \startluacode function f(a,b) ... \stopluacode called through: \def\callf#1#2{\ctxlua{f(#1,#2)}} and do this actually with one argument: \callf{one} so, #1 will be one and #2 will be the next token

Re: [NTG-context] arguments to ctxlua

2010-03-30 Thread Peter Münster
On Tue, Mar 30 2010, Hans van der Meer wrote: called through: \def\callf#1#2{\ctxlua{f(#1,#2)}} and do this actually with one argument: \callf{one} then I find that the absent argument b in f(a,b) is not nil but a string of length 1. Hello Hans, You want probably something