Re: [NTG-context] Including command output

2012-03-05 Thread Kip Warner
On Sun, 2012-03-04 at 23:20 -0500, Aditya Mahajan wrote: > If you want to use the automagic way, you can define \BazaarRevision to > redefined \BazaarRevision, for example: > > \def\BazaarRevision > {\ctxlua{context.setevalue( >

Re: [NTG-context] Including command output

2012-03-04 Thread Aditya Mahajan
d use. For example: \def\initilizebazaar {\ctxlua{context.setevalue( "usebazaarrevision", os.resultof"bzr revno | tr -d '\\n'")}} \appendtoks \initilizebazaar \to \everystarttext and then use can use \usebazaarrevision in the main text

Re: [NTG-context] Getting changing/random graphics?

2012-02-16 Thread Hans Hagen
s: %s",table.concat(files," "))) end function document.choosegraphic() if #files > 0 then context(table.remove(files, math.random(1,#files)) or "dummy") else context("dummy") end end \stopluacode \def\Co

Re: [NTG-context] Getting changing/random graphics?

2012-02-16 Thread Hans Hagen
cs: %s",table.concat(files," "))) end function document.choosegraphics() if #files > 0 then context(table.remove(files, math.random(1,#files)) or "dummy") else context("dummy") end end \stopluacode \def\

Re: [NTG-context] Problem with Lua processing UTF8 substrings

2012-02-01 Thread Philipp Gesang
= unicode.utf8” at the top of the file.) Regards Philipp > > Thanks > Jaroslav Hajtmar > > Here is my minimal example: > > \def\mymacro#1{\ctxlua{for i=1, string.len('#1') do > context(string.sub('#1',i,i)..", ") end}} > > \starttex

[NTG-context] Problem with Lua processing UTF8 substrings

2012-02-01 Thread Jaroslav Hajtmar
(orig_pos) string.lenutf8(string), but without success. Can you please someone help? Thanks Jaroslav Hajtmar Here is my minimal example: \def\mymacro#1{\ctxlua{for i=1, string.len('#1') do context(string.sub('#1',i,i)..", ") end}} \starttext %\mymacro{šěřěžř

Re: [NTG-context] What’s your favorite command?

2012-01-30 Thread Aditya Mahajan
rnalfigure [\ctxlua{context("http://placekitten.com/g/\%0.0f/\%0.0f";, \withoutpt{\the\dimexpr\kittenwidth}, \withoutpt{\the\dimexpr\kittenheight})}] [#1, method=jpg]} \starttext \placefigure[left,none]{} {\externalkitten[width=0.5\textwidth, h

Re: [NTG-context] How to define a command...

2012-01-05 Thread Otared Kavian
Sorry for the noise… I found the answer to my last question in module-01.pdf, pages 92 and 93: the right definition is \define[3]\RandomCoeff{% \setevalue{Coeff#1}{\ctxlua{tex.print(math.random(#2,#3))}} } that is one has to use \setevalue instead of \setvalue (that is

Re: [NTG-context] How to define a command...

2012-01-05 Thread Otared Kavian
Hi again Wolfgang and Peter, The solution you provided to my problem is great but has a small issue… Considering the definition \define[3]\RandomCoeff{% \setvalue{Coeff#1}{\ctxlua{tex.print(math.random(#2,#3))}} } after saying \RandomCoeff{Alpha}{1}{10} one gets

Re: [NTG-context] How to define a command...

2012-01-05 Thread Otared Kavian
Thanks for Wolfgang: your solution, that is \setuprandomize[2012] \define[3]\RandomCoeff{% \setvalue{Coeff#1}{\ctxlua{tex.print(math.random(#2,#3))}}} works indeed and it is somehow simpler than using \expandafter\csname, and as a matter of fact, after reading your message I searched in

Re: [NTG-context] How to define a command...

2012-01-05 Thread Otared Kavian
ne[3]\RandomCoeff{% >> \ctxlua{a = math.random(#2,#3)} >> % \csname{Coeff#1}\endcsname{\ctxlua{tex.print(a)}} %% this line does not >> work as expected... > > \setuprandomize[2012] > \define[3]\RandomCoeff{% > \expandafter\def\csname > Coeff#1\endcsname{\ct

Re: [NTG-context] How to define a command...

2012-01-05 Thread Otared Kavian
wrote: > Reccently I did something random in ctxlua. I post it in the hope it will be > useful. > > Hans van der Meer > > \startluacode > -- Define our namespace as hvdm > hvdm = hvdm or {} > > -- Return random series of numbers 1..n depe

Re: [NTG-context] How to define a command...

2012-01-05 Thread Wolfgang Schuster
Am 05.01.2012 um 21:11 schrieb Meer, H. van der: > Reccently I did something random in ctxlua. I post it in the hope it will be > useful. > > Hans van der Meer > > \startluacode > -- Define our namespace as hvdm > hvdm = hvdm or {} Don’t use a globa

Re: [NTG-context] How to define a command...

2012-01-05 Thread Wolfgang Schuster
Am 05.01.2012 um 21:17 schrieb Peter Münster: > On Thu, Jan 05 2012, Otared Kavian wrote: > >> \define[3]\RandomCoeff{% >> \ctxlua{a = math.random(#2,#3)} >> %\csname{Coeff#1}\endcsname{\ctxlua{tex.print(a)}} %% this line does not >> work as expecte

Re: [NTG-context] How to define a command...

2012-01-05 Thread Peter Münster
On Thu, Jan 05 2012, Otared Kavian wrote: > \define[3]\RandomCoeff{% > \ctxlua{a = math.random(#2,#3)} > % \csname{Coeff#1}\endcsname{\ctxlua{tex.print(a)}} %% this line does not > work as expected... \setuprandomize[2012] \define[3]\RandomCoeff{% \expandafter\def\csn

Re: [NTG-context] How to define a command...

2012-01-05 Thread Meer, H. van der
Reccently I did something random in ctxlua. I post it in the hope it will be useful. Hans van der Meer \startluacode -- Define our namespace as hvdm hvdm = hvdm or {} -- Return random series of numbers 1..n depending on the number of arguments function

[NTG-context] How to define a command...

2012-01-05 Thread Otared Kavian
number chosen between 1 and 10? I tried to use the following approach, but could not make it work: %%% begin random-coeff.tex \setuprandomize[2012] % set a seed \ctxlua{CoeffAlpha = math.random(1,10) ;} \def\CoeffAlpha{\ctxlua{tex.print(CoeffAlpha)}} % \define[3]\RandomCoeff

Re: [NTG-context] CLD: context.getvariable as Lua variable

2012-01-05 Thread Wagner Macedo
es what I wanted to do. > > \starttext > \setvariable{namespace}{var}{Some context} > \ctxlua{ > local s = context.getvariable("namespace", "var") > > if s == "" then > ... > else > ... > end > } > \stoptext > >

Re: [NTG-context] CLD: context.getvariable as Lua variable

2012-01-05 Thread Wolfgang Schuster
ed some > combinations, based on manual but I couldn't succeed. The code below > exemplifies what I wanted to do. > > \starttext > \setvariable{namespace}{var}{Some context} > \ctxlua{ > local s = context.getvariable("namespace", "var") > &g

[NTG-context] CLD: context.getvariable as Lua variable

2012-01-05 Thread Wagner Macedo
low exemplifies what I wanted to do. \starttext \setvariable{namespace}{var}{Some context} \ctxlua{ local s = context.getvariable("namespace", "var") if s == "" then ... else ... end } \stoptext I know that I can use some of \if* TeX commands, bu

Re: [NTG-context] redefining paragraph breaks

2012-01-03 Thread Wolfgang Schuster
function userdata.specialparagraph() local text = buffers.getcontent("specialparagraph") text = string.gsub(text,"\n\n"," ¶ ") context(text) end \stopluacode \def\startspecialparagraph {\dostartbuffer[specialparagraph][startspecialparag

[NTG-context] Broken Nightly Still

2011-12-28 Thread Kip Warner
nd > references > invalid page reference: 0 structure > sectioning > section @ level 3 : 0.3.4 -> Cornucopianism references > unknown reference [Terms & Concepts][Malthusianism] structure > sectioning > section @ level 3 : 0.3.5 -> Corporate Personhood pages > flushing realpage 13,

Re: [NTG-context] CLD: setupheadertexts

2011-12-26 Thread Willi Egger
context(rightpage) > else > context(leftpage) > end > return true > end > } > end > > \stopluacode > > \starttext > > \ctxlua{userdata.myheadertext(&qu

Re: [NTG-context] CLD: setupheadertexts

2011-12-25 Thread Wolfgang Schuster
) if math.odd(tex.count["realpageno"]) then context(rightpage) else context(leftpage) end return true end

Re: [NTG-context] CLD: setupheadertexts

2011-12-24 Thread Willi Egger
context(": ") > return true > end > } > end > > \stopluacode > > \starttext > \ctxlua{userdata.myheadertext("A")} > \input knuth > \page > \input ward > \stoptext > > Wolfgang > __

Re: [NTG-context] CLD: setupheadertexts

2011-12-24 Thread Wolfgang Schuster
context(": ") return true end } end \stopluacode \starttext \ctxlua{userdata.myheadertext("A")} \input knuth \page \input ward \stoptext Wolfgang ___ If your questi

[NTG-context] CLD: setupheadertexts

2011-12-24 Thread Willi Egger
) context.setupheadertexts{ function() context.labeltext(s) context(": ") end} end \stopluacode \starttext \ctxlua{myheadertext("A")} \input knuth \page \input ward \stoptext Thanks for

Re: [NTG-context] Struggling with cld document...

2011-12-23 Thread Willi Egger
context.setupheadertexts{ function() >context.labeltext("willi") > -- context.space() >context(": ") >context(s) >end } > end > \stopluacode > > \ctxlua{documentdata.myheadertext("Headertext")} > > \st

Re: [NTG-context] Struggling with cld document...

2011-12-22 Thread Wolfgang Schuster
.setupheadertexts{ function() context.labeltext("willi") -- context.space() context(": ") context(s) end } end \stopluacode \ctxlua{documentdata.myheadertext("Headertext")} \starttext \input knuth \stoptext Wolfgang __

Re: [NTG-context] Struggling with cld document...

2011-12-22 Thread Willi Egger
>>context.setupheadertexts{context(s)} --context.labeltext(s) >> end >> \stopluacode > > \startluacode > function documentdata.myheadertext(s) >context.setupheadertexts{s} > end > \stopluacode > >&

Re: [NTG-context] Struggling with cld document...

2011-12-22 Thread Wolfgang Schuster
pluacode \startluacode function documentdata.myheadertext(s) context.setupheadertexts{s} end \stopluacode > \starttext > \ctxluamyheadertext{"Headertext"}} String are passed with braces. \ctxlua{documentdata.myheadertext("Headertext")} Wolfgang

Re: [NTG-context] xml attribute conditional

2011-12-14 Thread Hans Hagen
t;] if target then local id = string.gsub(target,"^#","") local n = notes[id] if n then n = n + 1 e.at.footnote = n notes[id] = n e.at["x

[NTG-context] gnuplot module: `option=monochrome` does not work.

2011-12-13 Thread Paul Menzel
Dear ConTeXt folks, I want to create monochrome plots, but `option=monochrome` is ignored. \usemodule[gnuplot] \setupGNUPLOT[terminal=context,option=monochrome] \startGNUPLOTscript[pi] plot pi t '$π = \ctxlua{context(ma

Re: [NTG-context] Lua and module gnuplot: Manipulate Gnuplot script with Lua

2011-12-12 Thread Paul Menzel
Am Montag, den 12.12.2011, 23:13 +0100 schrieb Mojca Miklavec: […] > One more example. One thing that would most probably work (I didn't > try it) would be the following: > > \startGNUPLOTscript[name] > plot sin(x) t '$\pi = \ctxlua{math.pi()}$' > \stopGNUPLOT

Re: [NTG-context] Lua and module gnuplot: Manipulate Gnuplot script with Lua

2011-12-12 Thread Paul Menzel
t command. > > > > I tried the following. > > > >\usemodule[gnuplot] > > > >\startGNUPLOTscript[lua] > > plot \ctxlua{context(1.2 * x + 3)} > >\stopGNUPLOTscript > > This won't work. The reason is that contents

Re: [NTG-context] Lua and module gnuplot: Manipulate Gnuplot script with Lua

2011-12-12 Thread Hans Hagen
line for me. I have not yet figured out how to read values from a file in Lua and just tried to print a constant to the gnuplot command. I tried the following. \usemodule[gnuplot] \startGNUPLOTscript[lua] plot \ctxlua{context(1.2 * x + 3

Re: [NTG-context] Lua and module gnuplot: Manipulate Gnuplot script with Lua

2011-12-12 Thread Mojca Miklavec
rk (I didn't try it) would be the following: \startGNUPLOTscript[name] plot sin(x) t '$\pi = \ctxlua{math.pi()}$' \stopGNUPLOTscript How can you explain to ConTeXt whether lua command has to be executed before or after gnuplot does its job? (label width will be wrong in either case

Re: [NTG-context] Lua and module gnuplot: Manipulate Gnuplot script with Lua

2011-12-12 Thread Mojca Miklavec
files I want to use Lua to create the formula > for the line for me. > > I have not yet figured out how to read values from a file in Lua and > just tried to print a constant to the gnuplot command. > > I tried the following. > >        \usemodule[gnuplot] > >        \s

[NTG-context] Lua and module gnuplot: Manipulate Gnuplot script with Lua

2011-12-12 Thread Paul Menzel
to read values from a file in Lua and just tried to print a constant to the gnuplot command. I tried the following. \usemodule[gnuplot] \startGNUPLOTscript[lua] plot \ctxlua{context(1.2 * x + 3)} \stopGNUPLOTscript \startGNUPLOTscript

Re: [NTG-context] Passing TeX parameters to the lua functions

2011-12-05 Thread Jaroslav Hajtmar
;w+") function testfun(param) Use the thirddata or userdata namespace for for functions. debug:write(param) -- tex.print(param) end \stopluacode \def\testmac#1{\directlua{testfun('#1')}} \unprotect \def\testmac#1{\ctxlua{testfun(\!!bs\detokenize{

Re: [NTG-context] Passing TeX parameters to the lua functions

2011-12-05 Thread Wolfgang Schuster
> Thanx Jaroslav > > \startluacode > debug=io.open("debug.txt","w+") > > function testfun(param) Use the thirddata or userdata namespace for for functions. >debug:write(param) >-- tex.print(param) > end > > \stopluacode > > &

Re: [NTG-context] Saving module data in tuc file

2011-12-04 Thread Aditya Mahajan
On Sun, 4 Dec 2011, Aditya Mahajan wrote: \def\executeCommand {\doifmode{*first} {\ctxlua{job.files.run(\!!bs\externalfiter::input_file\!!es, \!!bs\externalfiltercommand\!!es)}}} The solution is to remove the test for the first mode. Needs a bit of

Re: [NTG-context] Saving module data in tuc file

2011-12-04 Thread Aditya Mahajan
and {\doifmode{*first} {\ctxlua{job.files.run(\!!bs\externalfiter::input_file\!!es, \!!bs\externalfiltercommand\!!es)}}} The solution is to remove the test for the first mode. Needs a bit of refactoring to ensure that the solution still works for MkII. (Do

Re: [NTG-context] Saving module data in tuc file

2011-12-04 Thread Wolfgang Schuster
attached file). Any hints > are welcome. \definetwopasslist{test} \newcount\testcount \starttext \immediatesavetwopassdata{test}{}{First Entry} One: \gettwopassdata{test}\twopassdata \startluacode commands.savetwopassdata("test","Second Entry") \stopluacode Two: \ctxl

Re: [NTG-context] feature request

2011-11-14 Thread Aditya Mahajan
ableaction(textlineactions,format("thirddata.comments.filters.%s",name)) end \stopluacode \unprotect \unexpanded\def\installcomments{\dodoubleargument\doinstallcomments} \def\doinstallcomments[#1][#2]% {\ctxlua{thirddata.comments.install(\!!bs#1\!!es,\!!bs\detokenize{#2}\!!es)}}

Re: [NTG-context] feature request

2011-11-14 Thread Hans Hagen
.sequencers.enableaction(textlineactions,"thirddata.comments.translate") end function comments.disable() utilities.sequencers.disableaction(textlineactions,"thirddata.comments.translate") end comments.disable() \stopluacode \def\enablecomments {\ctxlua{thirddata.comments.enable()}} \def\disable

Re: [NTG-context] feature request

2011-11-14 Thread Aditya Mahajan
ns,"thirddata.comments.translate") end function comments.disable() utilities.sequencers.disableaction(textlineactions,"thirddata.comments.translate") end comments.disable() \stopluacode \def\enablecomments {\ctxlua{thirddata.comments.enable()}} \def\disable

[NTG-context] mp-chem.mpiv bug

2011-11-07 Thread Alan Braslau
;endgroup <*> chem_z_zero("\dochemicaltext{O}") ; ... 1 \starttext 2 \startchemical 3 \chemical [ONE,Z0] [O] 4 >> \stopchemical 5 \stoptext 6 \stopchemical ...erence \ctxlua {chemicals.stop()}

Re: [NTG-context] lua and brackets

2011-11-03 Thread Martin Fechner
eif r_one == r_two then context("[same pagenumbers]") else context("[different pagenumbers]") end end \stopluacode \ctxlua{document.pagesetup("one","two")} \ctxlua{document.pagesetup("one","two-a")} \ctxlua{document.pagesetup("two-a&quo

Re: [NTG-context] lua and brackets

2011-11-03 Thread Hans Hagen
rackets. Here is a short example: >> >> \starttext >> sometext >> \reference[myref]{} >> is >> \ctxlua{tex.print(\atpage[myref])} >> \stoptext >> >> Is there a way to mask the brackets? > > "\atpage[myref]" > My lua functi

Re: [NTG-context] lua and brackets

2011-11-03 Thread Martin Fechner
ext >> sometext >> \reference[myref]{} >> is >> \ctxlua{tex.print(\atpage[myref])} >> \stoptext >> >> Is there a way to mask the brackets? > > "\atpage[myref]" > My lua function doesn't just print the parameter. I have a functio

Re: [NTG-context] lua and brackets

2011-11-03 Thread Hans Hagen
On 3-11-2011 10:15, Martin Fechner wrote: Hi all, I try to call a lua-function, but it seems that it doesn't work if the parameter contains squared brackets. Here is a short example: \starttext sometext \reference[myref]{} is \ctxlua{tex.print(\atpage[myref])} \stoptext Is there a way to

[NTG-context] lua and brackets

2011-11-03 Thread Martin Fechner
Hi all, I try to call a lua-function, but it seems that it doesn't work if the parameter contains squared brackets. Here is a short example: \starttext sometext \reference[myref]{} is \ctxlua{tex.print(\atpage[myref])} \stoptext Is there a way to mas

Re: [NTG-context] Italic correction spoils XHTML-output

2011-10-31 Thread Aditya Mahajan
limitation by using \ctxlua{os.copy(...)}. Ideally, one should be able to use \ctxlua{os.rename(...)} but os.rename does not work on Windows. Aditya ___ If your question is of interest to others as well, please add an entry to

Re: [NTG-context] xml and lua again

2011-10-28 Thread Hans Hagen
e of a dimension with \number: \starttext \scratchdimen=3pt \number\scratchdimen \ctxlua{context(tex.dimen["scratchdimen"])} \stoptext which also means that you can say \scratchcounter=\scratchdimen and test dimens as if they are numbers ... this is why we can have \let\ifzeropt\ifcase w

Re: [NTG-context] xml and lua again

2011-10-28 Thread Wolfgang Schuster
h \number: \starttext \scratchdimen=3pt \number\scratchdimen \ctxlua{context(tex.dimen["scratchdimen"])} \stoptext Wolfgang ___ If your question is of interest to others as well, please add an entry to

Re: [NTG-context] Luatex question

2011-10-25 Thread Lutz Haseloff
Thank you for your detailed information. 2011/10/25 Hans Hagen : > On 25-10-2011 14:09, Lutz Haseloff wrote: >> >> Hi all, >> >> some months ago I printed the name of the current font with following >> code: >> >> \starttext >> The current font

Re: [NTG-context] Luatex question

2011-10-25 Thread Hans Hagen
On 25-10-2011 14:09, Lutz Haseloff wrote: Hi all, some months ago I printed the name of the current font with following code: \starttext The current font is: \ctxlua{tex.print(font.getfont(font.current()).fullname)}. \stoptext Now I get an error message: ! LuaTeX error:1: no string to print

Re: [NTG-context] Luatex question

2011-10-25 Thread luigi scarso
On Tue, Oct 25, 2011 at 2:09 PM, Lutz Haseloff wrote: > Hi all, > > some months ago I printed the name of the current font with following code: > > \starttext > The current font is: > \ctxlua{tex.print(font.getfont(font.current()).fullname)}. > \stoptext > &

[NTG-context] Luatex question

2011-10-25 Thread Lutz Haseloff
Hi all, some months ago I printed the name of the current font with following code: \starttext The current font is: \ctxlua{tex.print(font.getfont(font.current()).fullname)}. \stoptext Now I get an error message: ! LuaTeX error :1: no string to print stack traceback: [C]: in function

Re: [NTG-context] arguments on context call

2011-10-16 Thread Meer, H. van der
Thanks, I was already trying to jump through the hoops of \ctxlua, but this is really simple and exactly what I needed. The offline calls to context/metapost figure production now can get all the information needed to synchronize with the main document. Hans van der Meer On 16 okt. 2011, at 19

[NTG-context] beta

2011-10-12 Thread Hans Hagen
\setupbodyfont [cambria] \starttext \ctxlua{moduledata.fonts.show_a_lot("Cambria")} \stoptext It probably needs to be improved. Users are welcome to submit additional (language related) sample alphabets etc. It might also become an option for mtx-fonts.lua == There has been a cha

[NTG-context] \url interaction and splitting

2011-09-15 Thread Aditya Mahajan
\dosetcolorattribute\??ur\c!color \goto{\hyphenatedurl{\ctxlua{structures.references.urls.get("#1","\@@uralternative","\@@urspace")}}}[fileorurl(#1)]% \endgroup} but this makes \url inherit the style from \setupinteraction rather than \setupurl. Also, \url does

Re: [NTG-context] MKIV strange results in Adobe Reader

2011-09-08 Thread Peter Rolf
> color rendered seems to kick in (in acrobat). > You can try to add \startluacode function backends.codeinjections.rgbtransparencygroup() local d = lpdf.dictionary { S = lpdf.constant("Transparency"), CS = lpdf.constant("DeviceRGB"),

Re: [NTG-context] Fwd: Bib-module

2011-08-15 Thread Hans Hagen
telse{#1}% {\getparameters[\??pb][k=\s!unknown,t=article,n=,s=,a=,y=,o=,u=,#1]}% {\getparameters[\??pb][k=#1,t=article,n=,s=,a=,y=,o=,u=]}% \ctxlua{bibtex.hacks.register("\@@pbk")}% \catcode\commentasciicode\othercatcode \dodostartpublication} \def\dodostartpublication#1\s

Re: [NTG-context] How well do ConTeXt (lua)module for other users?

2011-07-19 Thread Jaroslav Hajtmar
luacode into my-module.mkiv file, then I have a problem with catcodes inside strings defining by [[ ... ]]. > > Or must be module consists of two separate files (my-module.lua and my-module.mkiv)? Must I to load the Lua module file (my-module.lua) into ConTeXt module file (my-module.m

Re: [NTG-context] How well do ConTeXt (lua)module for other users?

2011-07-19 Thread Wolfgang Schuster
file (my-module.lua) into > ConTeXt module file (my-module.mkiv) by command \ctxlua{dofile("my-module.lua > ");} and then load module file (my-module.mkiv) into my user file by command > \usemodule[my-module]? > > Is there something like \useluamodule[] or > \usem

[NTG-context] How well do ConTeXt (lua)module for other users?

2011-07-19 Thread Jaroslav Hajtmar
de strings defining by [[ ... ]]. Or must be module consists of two separate files (my-module.lua and my-module.mkiv)? Must I to load the Lua module file (my-module.lua) into ConTeXt module file (my-module.mkiv) by command \ctxlua{dofile("my-module.lua ");} and then load module file (

Re: [NTG-context] Finding values ​​of the context macros inside Lua functions (=expansion inside Lua functions?)

2011-07-17 Thread Jaroslav Hajtmar
context(values[arg]) else context("Invalid index.") end else context("Invalid command.") end end \stopluacode \starttext \starttabulate \NC \type{\macroI} \EQ \ctxlua{test("\\macroI")

Re: [NTG-context] Finding values ​​of the context macros inside Lua functions (=expansion inside Lua functions?)

2011-07-17 Thread Wolfgang Schuster
context("Invalid index.") end else context("Invalid command.") end end \stopluacode \starttext \starttabulate \NC \type{\macroI} \EQ \ctxlua{test("\\macroI")} \NC\NR \NC \type{\macroII} \EQ \ctxlua{test("

Re: [NTG-context] Finding values ​​of the context macros inside Lua functions (=expansion inside Lua functions?)

2011-07-17 Thread Jaroslav Hajtmar
1 um 14:42 schrieb Jaroslav Hajtmar: Thanx Wolfgang. But I guess I was wrong to express.. I need to pass parameter '\\macroI' to the function and turn it up a inside luafunction expand to its value. Not possible. Ie when \def\macroI{6} Then I need when I make in y

Re: [NTG-context] Finding values ​​of the context macros inside Lua functions (=expansion inside Lua functions?)

2011-07-17 Thread Wolfgang Schuster
> > Then I need when I make in your example \ctxlua{test("\\macroI")} get the > result : > "The argument “6” is a positive number" and not result "The argument “6” is a > string." That’s odd because for me \ctxlua{test("\macroI")} results

Re: [NTG-context] Finding values ​​of the context macros inside Lua functions (=expansion inside Lua functions?)

2011-07-17 Thread Jaroslav Hajtmar
Thanx Wolfgang. But I guess I was wrong to express.. I need to pass parameter '\\macroI' to the function and turn it up a inside luafunction expand to its value. Ie when \def\macroI{6} Then I need when I make in your example \ctxlua{test("\\macroI")} get the result :

Re: [NTG-context] Finding values ​​of the context macros inside Lua functions (=expansion inside Lua functions?)

2011-07-17 Thread Wolfgang Schuster
t;,arg) else context("The argument \\quotation{%s} is a negative number",arg) end else context("The argument \\quotation{%s} is a string."

[NTG-context] Finding values ​​of the context macros inside Lua functions (=expansion inside Lua functions?)

2011-07-17 Thread Jaroslav Hajtmar
g.." is number.\\par ") else context(arg.." is not number.\\par") end if type(tonumber(arg))=='number' then context(arg.." is number.\\par ") else context(arg.." is not number.\\par") end end \stopluacode \starttext \

Re: [NTG-context] Optimal way to defining of macros in Luacode in ConTeXt

2011-07-14 Thread Hans Hagen
On 14-7-2011 5:12, Jaroslav Hajtmar wrote: To show what macros I want to convert, I mention these examples: \def\opencsvfile{% \dosingleempty\doopencsvfile% } \def\doopencsvfile[#1]{% \dosinglegroupempty\dodoopencsvfile } \def\dodoopencsvfile#1{% \iffirstargument \ctxlua

Re: [NTG-context] Optimal way to defining of macros in Luacode in ConTeXt

2011-07-14 Thread Jaroslav Hajtmar
macros I want to convert, I mention these examples: \def\opencsvfile{% \dosingleempty\doopencsvfile% } \def\doopencsvfile[#1]{% \dosinglegroupempty\dodoopencsvfile } \def\dodoopencsvfile#1{% \iffirstargument \ctxlua{thirddata.scancsv.opencsvfile("#1")} \else \ctxlu

Re: [NTG-context] ' not working anymore

2011-07-04 Thread Philipp Gesang
ext/base] grep -n xmlsetent * lxml-ini.mkiv:343:\def\xmlsetentity#1#2{\ctxlua{xml.registerentity('#1',\!!bs\detokenize{#2}\!!es)}} lxml-ini.mkiv:346:% \xmlsetentity{tex}{\TEX{}} % {} needed Regards, Philipp >Shouldn't it be

Re: [NTG-context] context.labeltext(...)

2011-07-04 Thread Willi Egger
context.bTD() if i < nofdays +1 then context(i) else context() end context.eTD() context.eTR() end context.eTABLE() end \stopluacode \def\maandtabel#1{\

Re: [NTG-context] break strings

2011-06-13 Thread Hans Hagen
LuigiYY(s) end end \stopluacode \def\ThisHelpsLuigiX#1{\ctxlua{LuigiX('#1')}} \def\ThisHelpsLuigiY#1{\ctxlua{LuigiY('#1')}} \def\LuigiYY#1{#1\hskip\zeropoint plus .1pt\relax} The disadvantage of the lua way is that for long strings we end up with a lot of

Re: [NTG-context] Getting arguments by Lua

2011-06-09 Thread Peter Münster
On Thu, Jun 09 2011, Procházka Lukáš Ing. - Pontex s. r. o. wrote: > but I'd need to get also the source file name ("Source.mkiv") and the option > ("--result" -> "Result.pdf"). \starttext result (lua): \ctxlua{context(environment.outputfilena

Re: [NTG-context] Random selection of a word in a set with lua and mkiv

2011-06-08 Thread Otared Kavian
ysis) for some reason. > > Anyone knows why ? > > \enableregime[il1] > \starttext > \startluacode > userdata = userdata or {} > math.randomseed( os.time() ) > function userdata.random(...) > context(arg[math.random(1, #arg)]) > e

Re: [NTG-context] Random selection of a word in a set with lua and mkiv

2011-06-08 Thread Mathieu Dupont
> > math.randomseed( os.time() )function userdata.random(...) > > context(arg[math.random(1, #arg)]) > > end\stopluacode\def\CHOOSERANDOM#1{\ctxlua{userdata.random(#1)}}\dorecurse{10}{\CHOOSERANDOM{"Maths", > > "Physics", "Alge

Re: [NTG-context] Random selection of a word in a set with lua and mkiv

2011-06-08 Thread Hans Hagen
userdata.random(...) context(arg[math.random(1, #arg)]) end\stopluacode\def\CHOOSERANDOM#1{\ctxlua{userdata.random(#1)}}\dorecurse{10}{\CHOOSERANDOM{"Maths", "Physics", "Algebra", "Analysis", "Chemistry", "Geometry", "Wave eq

Re: [NTG-context] Random selection of a word in a set with lua and mkiv

2011-06-08 Thread Mathieu Dupont
[math.random(1, #arg)]) end\stopluacode\def\CHOOSERANDOM#1{\ctxlua{userdata.random(#1)}}\dorecurse{10}{\CHOOSERANDOM{"Maths", "Physics", "Algebra", "Analysis", "Chemistry", "Geometry", "Wave equation", "Schrödinger equati

Re: [NTG-context] Random selection of a word in a set with lua and mkiv

2011-06-08 Thread Hans Hagen
\ctxlua{document.r("math physics")} (untested) - Hans Hagen | PRAGMA ADE Ridderstraat 27 | 8061 GH Hasselt | The Netherlands tel: 038 477 53 69 | voip: 087 875 68 74 |

Re: [NTG-context] xml syntax for \externalfigure

2011-06-04 Thread Thomas A. Schmitz
esent = true >end >end >context.externalfigure({file}, args_present and t) > end > \stopluacode > > \startxmlsetups xml:externalfigure > \ctxlua{my_externalfigure("\xmlatt{#1}{resource}", >{width = "\xmlatt{#1}{width}", height = "\xmlatt{#1}{hei

Re: [NTG-context] xml syntax for \externalfigure

2011-06-03 Thread Hans Hagen
setups xml:externalfigure \ctxlua{my_externalfigure("\xmlatt{#1}{resource}", {width = "\xmlatt{#1}{width}", height = "\xmlatt{#1}{height}"})} \stopxmlsetups My first idea was "\expanded{\externalfigure[...][\doif...]}" but it does not work... you can

Re: [NTG-context] xml syntax for \externalfigure

2011-06-03 Thread Peter Münster
igure(file, t) local args_present for k, v in pairs(t) do if v == "" then t[k] = nil else args_present = true end end context.externalfigure({file}, args_present and t) end \stopluacode \startxmlsetups xml:externalfigure \ctxlua{my_ex

Re: [NTG-context] checking mainlanguage setup

2011-06-01 Thread Hans Hagen
On 1-6-2011 10:14, Hans Hagen wrote: [[ ]] vs " " is a lua thing ... but when you pass things from within tex, expansions happens the same in both; you can try context("\detokenize{...}") Sorry, that should have been \ctxlua{"\detokenize{...}"} which takes

Re: [NTG-context] t-filter: no table created when Unicode characters are included

2011-05-01 Thread Aditya Mahajan
uatex sets locale to "C". To see the differences in the environment, just do "set >/tmp/set-shell" and run context on: --8<---cut here---start----->8--- \starttext \ctxlua{os.execute"set >/tmp/set-context"} \stoptex

Re: [NTG-context] t-filter: no table created when Unicode characters are included

2011-05-01 Thread Peter Münster
o see the differences in the environment, just do "set >/tmp/set-shell" and run context on: --8<---cut here---start->8--- \starttext \ctxlua{os.execute"set >/tmp/set-context"} \stoptext --8<---cut here

Re: [NTG-context] t-filter: no table created when Unicode characters are included

2011-05-01 Thread Paul Menzel
quot;] ] $ > - If that also fails, then some other program that reads a file and writes > its contents to another file. Usinng the following \defineexternalfilter [rest] [filter={cat \externalfilterinputfile\space | tee \externalfilterou

Re: [NTG-context] t-filter: no table created when Unicode characters are included

2011-04-30 Thread Aditya Mahajan
rst file with a unicode letter (no table)? - If that also fails, then a simple markdown file with a unicode letter. - If that also fails, then some other program that reads a file and writes its contents to another file. - Manually execute the shell command from inside ConTeXt using \ctxlua

Re: [NTG-context] Skipping item numbers in an itemized list?

2011-04-27 Thread Alasdair McAndrew
an use: > > > \defineconversion[fancy][1,2,5,6,8] > > This is ok if the complete list is not too long and when you know > which numbers the "holes" should have, but I would suspect that > Alasdair want to be able to increment somewhere the actual counte

Re: [NTG-context] Skipping item numbers in an itemized list?

2011-04-27 Thread Ulrike Fischer
ewhere the actual counter by 1 or 2 without having to check the actual number first. > There is no interface to increment the counter by arbitrary amount, but > you can define your own interface to structures.counters.add: > > \unprotected > \def\a

Re: [NTG-context] Skipping item numbers in an itemized list?

2011-04-27 Thread Aditya Mahajan
st, \setstructurecounter[\currentitemgroupcounter]{5} There is no interface to increment the counter by arbitrary amount, but you can define your own interface to structures.counters.add: \unprotected \def\addtostructurecounter [#1]#2{\ctxlua{structures.counters.add ("\@@thestructurecount

[NTG-context] line numbers in margin from xml in context mkiv

2011-04-26 Thread Jon Crump
ups xml:pb \def\svopage{\xmlatt{#1}{n}.} \xmlflush{#1} \stopxmlsetups \startluacode function filter(lb) if math.mod(lb,5) == 0 then context.svopage() context(lb) end end \stopluacode \define[1]\MyNumber% {\ctxlua{filter(#1)}\endgraf} \startxmlsetups xml:lb \xmld

Re: [NTG-context] label bug with latest beta (2011.04.22)

2011-04-23 Thread Hans Hagen
) local l = lists.result[n] local t = l.titledata if t then texsprint(t.label or default or "") end end and then in strc-lst.mkiv: \edef\currentlistlabel{\ctxlua{structures.lists.la

Re: [NTG-context] Some problems creating a wiki page

2011-04-15 Thread Hans Hagen
et are the same as using texexec, not context. IIRC, there were some security concerns with MkIV: \ctxlua{os.execute("cat /etc/passwd")} Althoug I admit that I tested it long ago (early days of mkiv) there is some control built in: system.executionmode system.executionlist the mode

<    3   4   5   6   7   8   9   10   11   12   >