Re: [NTG-context] print context version

2012-11-26 Thread Aditya Mahajan
\ctxlua{context(os.resultof(git --no-pager log --pretty='\%h of \%aD' -1))} \stoptext But what is the easiest way to typeset the context version? There must be something easier than \ctxlua{context(os.resultof(context --version | grep current))}, right? \contextversion Aditya

Re: [NTG-context] mplib messages

2012-11-12 Thread Hans Hagen
On 11/12/2012 10:43 AM, Alan BRASLAU wrote: Hello, Were do MetaPost messages go using mplib? (/dev/null?) I see nothing on the console nor in the log file. Alan \starttext \startMPpage message a circle ; draw fullcircle scaled 2 cm ; \stopMPpage \stoptext \starttext \ctxlua

[NTG-context] \externalfigure and large-paged pdfs

2012-11-08 Thread Taco Hoekwater
\vss \bgroup \localbegstru... \grph_include_finalize ...tedexternalfigureframed {\vfilll \box \foundextern... \grph_include_place ...ode \grph_include_finalize \fi \ctxlua {figures.pop

Re: [NTG-context] \externalfigure and large-paged pdfs

2012-11-08 Thread Hans Hagen
\fi \ctxlua {figures.pop()... l.2 \externalfigure[plankaart] It seems that \externalfigure forces execution of \raggedcenter, and if your PDF's page is large enough, that then fails. There is, in fact, a workaroud: \starttext {\setupalign[nothyphenated

Re: [NTG-context] \dorecurse within TABLE

2012-10-26 Thread luigi scarso
is better \starttext \dorecurse{8}{\recurselevel\crlf} \startluacode global_cnt=0; \stopluacode \bTABLE %% ok, but why 17 ? \dorecurse{8}{\bTR\bTD\ctxlua{global_cnt=global_cnt+1;context(global_cnt-17)}:\recurselevel\eTD\eTR} \eTABLE %% straight \startluacode context.bTABLE() for i=1,8 do context.bTR

Re: [NTG-context] using variable for subscript in math+lua

2012-10-25 Thread Otared Kavian
Hi Philipp, Thanks to you, Dalyoung and Hans for the nice example using luacode. I was wonedring how would you modify your code in order to be able to change the name of the matrix if necessary. For instance, how to modify your code in such a way that upon saying \ctxlua

Re: [NTG-context] using variable for subscript in math+lua

2012-10-25 Thread Hans Hagen
that upon saying \ctxlua{document.print_matrix(b,3)} one gets a 3x3 matrix whos coefficients are b_{11},…b_{33}. if the two of you can come up with some specs we can make a small module if needed Hans

Re: [NTG-context] using variable for subscript in math+lua

2012-10-25 Thread Procházka Lukáš
to modify your code in such a way that upon saying \ctxlua{document.print_matrix(b,3)} one gets a 3x3 matrix whos coefficients are b_{11},…b_{33}. Thanks in advance: OK Something like this? · document.print_matrix = function

Re: [NTG-context] using variable for subscript in math+lua

2012-10-25 Thread Philipp Gesang
in such a way that upon saying \ctxlua{document.print_matrix(b,3)} one gets a 3x3 matrix whos coefficients are b_{11},…b_{33}. This may be overkill but you can just wrap the matrix command in some TeX macro: · % macros=mkvi

Re: [NTG-context] using variable for subscript in math+lua

2012-10-24 Thread Philipp Gesang
and column context.NC(string.format(schema, i, j)) end context.NR() end context.stopmatrix() end \stopluacode \starttext \startformula \ctxlua{document.print_matrix(3)} \stopformula \startformula \ctxlua{document.print_matrix(9,4)} \stopformula

Re: [NTG-context] Referring to multiple elements

2012-09-28 Thread Marco Patzer
] {\iffirstargument {#left }%% \fi \ctxlua{userdata.inwithranges(#label)}%% \ifsecondargument {#right}%% \fi} Then you can write: See \inrange{figures} [fig:a,fig:c,fig:d,fig:e,fig:g,fig:x,fig:h] See \inrange{figures}{TT} [fig:a,fig:c,fig:d,fig:e,fig:g,fig:x,fig:h] See

Re: [NTG-context] Referring to multiple elements

2012-09-14 Thread Sietse Brouwer
functions sometime this weekend. But they should be doable, really. (And, of course, you may be far more experienced in LuaTeX than I, I don't know.) Cheers, Sietse % should be below startluacode block, but clearer like so \def\inwithranges[#1]% {\ctxlua{u.inwithranges(#1)}} \startluacode u

Re: [NTG-context] xml cross-references in lua?

2012-09-12 Thread Thomas A. Schmitz
userdata = userdata or { } userdata.bibitems = { } \stopluacode \startxmlsetups xml:document \xmlflush{#1} \stopxmlsetups \startxmlsetups xml:bibitem \ctxlua{userdata.bibitems[\letterhash\xmlatt{#1}{xml:id}] = #1} \stopxmlsetups \def\BibAuthor#1#2{[2:\xmlfirst{\cldcontext{userdata.bibitems['#2

Re: [NTG-context] xml cross-references in lua?

2012-09-11 Thread Hans Hagen
{xml:define} \xmlprocessbuffer{whatever}{demo}{} \startluacode userdata = userdata or { } userdata.bibitems = { } \stopluacode \startxmlsetups xml:document \xmlflush{#1} \stopxmlsetups \startxmlsetups xml:bibitem \ctxlua{userdata.bibitems[\letterhash\xmlatt{#1}{xml:id}] = #1

Re: [NTG-context] Lua conditionals fail inside \starttexdefinition

2012-09-05 Thread Hans Hagen
\ctxlua{context(tostring(some condition)} given that the condition returns true/false - Hans Hagen | PRAGMA ADE Ridderstraat 27 | 8061 GH Hasselt | The Netherlands tel: 038 477

Re: [NTG-context] TeX expansion within lua

2012-09-04 Thread Wolfgang Schuster
the dimen value in Lua? \starttext \scratchdimen = 20pt \the\scratchdimen \ctxlua{tex.dimen.scratchdimen = 10pt} \the\scratchdimen \stoptext Wolfgang ___ If your question is of interest to others as well, please add

Re: [NTG-context] built-in units command (mkiv) fails

2012-08-26 Thread Wolfgang Schuster
kilometersolidushour ConTeXt: ver: 2012.08.16 22:20 MKIV fmt: 2012.8.22 phys-dim.mkiv %\ctxlua{ %languages.labels.define(setupprefixtext,prefixes)% %languages.labels.define(setupunittext,units)% %languages.labels.define(setupoperatortext,operators)% %languages.labels.define

Re: [NTG-context] Creating TeX dimensions and counters registers directly in Lua

2012-08-22 Thread Wolfgang Schuster
]])} \directlua{tex.newcount(myothercount)} etc... \stoptext again fails... Is there any source or examples to study anything about it? AFAIK there is no tex.setdimen but what’s the problem to use Lua tables to save the values. \starttext \ctxlua{mydimension = number.topoints

Re: [NTG-context] Creating TeX dimensions and counters registers directly in Lua

2012-08-22 Thread Jaroslav Hajtmar
ConTeXt converting functions do not work etc. .. Thanx Jaroslav Here is another example: \starttext \newdimen\mytexdimension \mytexdimension=100pt \ctxlua{myluadimension = number.topoints(1)} \ctxlua{context(myluadimension)} \the\mytexdimension \hbox to\mytexdimension{X} % FAILS

Re: [NTG-context] Creating TeX dimensions and counters registers directly in Lua

2012-08-22 Thread Hans Hagen
! In addition, I solve the problem at LuaTEX, so ConTeXt converting functions do not work etc. .. Thanx Jaroslav Here is another example: \starttext \newdimen\mytexdimension \mytexdimension=100pt \ctxlua{myluadimension = number.topoints(1)} \ctxlua{context(myluadimension)} \the\mytexdimension

Re: [NTG-context] Creating TeX dimensions and counters registers directly in Lua

2012-08-22 Thread Peter Münster
On Wed, Aug 22 2012, Jaroslav Hajtmar wrote: \ctxlua{myluadimension = number.topoints(1)} \ctxlua{context(myluadimension)} \def\myluadimension{\ctxlua{context(myluadimension)}} ... \hbox to\myluadimension{X} -- Peter

[NTG-context] Ctx ... Lua

2012-08-22 Thread Procházka Lukáš
Hello, sometimes in this mail discussion I'm encountering a Ctx/Lua command which has been unknown for me or I would use other (known) commands to do the job. So - would it be possible to explain - what's the difference/advantage btw \directlua and \ctxlua - what \ctxcommand{} does - what

Re: [NTG-context] Creating TeX dimensions and counters registers directly in Lua

2012-08-22 Thread Jaroslav Hajtmar
converting functions do not work etc. .. Thanx Jaroslav Here is another example: \starttext \newdimen\mytexdimension \mytexdimension=100pt \ctxlua{myluadimension = number.topoints(1)} \ctxlua{context(myluadimension)} \the\mytexdimension \hbox to\mytexdimension{X} % FAILS

Re: [NTG-context] Ctx ... Lua

2012-08-22 Thread Wolfgang Schuster
/advantage btw \directlua and \ctxlua No difference, just another name, there are even more synonyms. - what \ctxcommand{} does \ctxcommand{...} == \ctxlua{commands} - what \cldcontext{} does? \cldcontext{...} == \ctxlua{context(...)} There is also \cldcommand{...} which is a short form

[NTG-context] Lua: document v. userdata

2012-08-22 Thread Rogers, Michael K
In a recent thread, Hans used the document namespace, where I (naively) expected userdata: On Aug 22, 2012, at 6:32 AM, Hans Hagen wrote: \ctxlua{document.myluadimension = 200pt} Is there a reason not to use userdata.myluadimension? Or is document.myluadimension safe, because myluadimension

Re: [NTG-context] Lua: document v. userdata

2012-08-22 Thread Hans Hagen
On 22-8-2012 14:55, Rogers, Michael K wrote: In a recent thread, Hans used the document namespace, where I (naively) expected userdata: On Aug 22, 2012, at 6:32 AM, Hans Hagen wrote: \ctxlua{document.myluadimension = 200pt} Is there a reason not to use userdata.myluadimension

Re: [NTG-context] Ctx ... Lua

2012-08-22 Thread Hans Hagen
it be possible to explain - what's the difference/advantage btw \directlua and \ctxlua No difference, just another name, there are even more synonyms. The \ctxlua variant is somewhat more future proof. In the past \directlua had a mandate extra argument. Also, the \ctxlua macro can use a dedicated message

Re: [NTG-context] test for (negative) number

2012-08-21 Thread Procházka Lukáš
On Mon, 20 Aug 2012 20:11:32 +0200, Sietse Brouwer sbbrou...@gmail.com wrote: Hi Peter, I recommend using the following handy little idiom: \ctxlua{commands.doifelse(-45 0)}{big}{small} % small It lets you do all sorts of things that are tricky in TeX: \ctxlua{ commands.doifelse( string.len

Re: [NTG-context] test for (negative) number

2012-08-21 Thread Wolfgang Schuster
Am 21.08.2012 um 08:32 schrieb Procházka Lukáš l...@pontex.cz: On Mon, 20 Aug 2012 20:11:32 +0200, Sietse Brouwer sbbrou...@gmail.com wrote: Hi Peter, I recommend using the following handy little idiom: \ctxlua{commands.doifelse(-45 0)}{big}{small} % small It lets you do all

Re: [NTG-context] test for (negative) number

2012-08-21 Thread Peter Rolf
Aug 2012 20:11:32 +0200, Sietse Brouwer sbbrou...@gmail.com wrote: Hi Peter, I recommend using the following handy little idiom: \ctxlua{commands.doifelse(-45 0)}{big}{small} % small It lets you do all sorts of things that are tricky in TeX: \ctxlua{ commands.doifelse( string.len( -45 ) 5

Re: [NTG-context] test for (negative) number

2012-08-21 Thread Procházka Lukáš
... I also found another solution reposter before: \ctxlua{commands.testcase(condition)} { If true...} {If false} Note that both blocks (if-true and if-false) are mandatory. Considering Wolfgang's last answer, it would be better to write: \ctxcommand{testcase(condition

Re: [NTG-context] test for (negative) number

2012-08-21 Thread Hans Hagen
On 21-8-2012 17:13, Procházka Lukáš wrote: I also found another solution reposter before: \ctxlua{commands.testcase(condition)} { If true...} {If false} yes, but testcase is an unfortunate name and sort of obsolete (so best use doifelse

Re: [NTG-context] test for (negative) number

2012-08-20 Thread Sietse Brouwer
Hi Peter, I recommend using the following handy little idiom: \ctxlua{commands.doifelse(-45 0)}{big}{small} % small It lets you do all sorts of things that are tricky in TeX: \ctxlua{ commands.doifelse( string.len( -45 ) 5 ) }{long}{short} Cheers, Sietse

Re: [NTG-context] Throwing an error on missing image with \externalfigure

2012-08-17 Thread Hans Hagen
an error after grepping the log-file. or this: \externalfigure[rubish.pdf] \ifcase\figurestatus\relax \ctxlua{os.exit(999)} \fi - Hans Hagen | PRAGMA ADE Ridderstraat 27 | 8061 GH

Re: [NTG-context] \startcomponent, \startproduct... + automatic file name

2012-08-09 Thread Sietse Brouwer
? And for the general case, what about `\ctxlua{commands.processedfile}`? That looks like it should print the current filename, as long as any inclusions use the ConTeXt commands and not \input. --Sietse On Thu, Aug 9, 2012 at 1:24 PM, Procházka Lukáš Ing. - Pontex s. r. o. l...@pontex.cz wrote: Great, thank you

Re: [NTG-context] \startcomponent, \startproduct... + automatic file name

2012-08-09 Thread Wolfgang Schuster
for startproject, startenvironment, and startproduct, I assume? And for the general case, what about `\ctxlua{commands.processedfile}`? That looks like it should print the current filename, as long as any inclusions use the ConTeXt commands and not \input. You can use \currentcomponent

Re: [NTG-context] Strange bug with \ in footnotes

2012-08-05 Thread Hans Hagen
Someone\footnote{Prof.\ 3 ABC} 4 \stoptext 5 Ok, the next is only for those who want to spend some time on the internals ... \starttext \def\TestA#1% {\writestatus{Test A}{#1}% \ctxlua{str = #1 print(str) context(str) io.savedata(temp.tmp,str)}} \def\TestB#1% {\writestatus{Test B}{#1

Re: [NTG-context] Struggling with ConTeXt

2012-08-03 Thread Olivier Binda
} \startxmlsetups xml:c \ctxlua{ title = test=..lxml.att(#1,title) context(title)}% \stopxmlsetups \starttext test : \xmlprocessdata {maths}{?xml version='1.0' standalone='yes?c title=My title/c} {} \stoptext \endinput Context gives the can't concatenate with a nil value Luatex error when

Re: [NTG-context] Struggling with ConTeXt

2012-08-03 Thread Hans Hagen
:*} \stopxmlsetups \xmlregistersetup{xml:test} \startxmlsetups xml:c \ctxlua{ title = test=..lxml.att(#1,title) context(title)}% \stopxmlsetups \starttext test : \xmlprocessdata {maths}{?xml version='1.0' standalone='yes?c title=My title/c} {} \stoptext \endinput Context gives the can't concatenate

[NTG-context] Struggling with ConTeXt

2012-08-02 Thread Olivier Binda
for me: \startluacode function set(node) p = lxml.att(node,p) -- or p = lxml.att(lxml.id(node),p) end \stopluacode \startxmlsetups xml:section \ctxlua{set(#1)} \stopxmlsetups it looks like it returns the p attribute of the node before #1 the following snipet works though (which is strange because I

Re: [NTG-context] t-degrade.tex (solved)

2012-07-31 Thread Peter Münster
\csname##1\endcsname\relax}}% \ctxlua{figures.push { name = \p_grph_include_name, label = \p_grph_include_label, @@ -312,8 +316,8 @@ resolution = \externalfigureparameter\c!resolution, color = \internalspotcolorparent{\externalfigureparameter\c

Re: [NTG-context] Broken Nightly?

2012-06-26 Thread Hans Hagen
On 26-6-2012 06:36, Kip Warner wrote: On Tue, 2012-06-26 at 05:27 +0200, Wolfgang Schuster wrote: grph-epd.mkiv (untested): \startsetups system:graphics:epdf %\ctxlua{figures.mergegoodies(\@@efinteraction)}% \ctxlua{figures.mergegoodies(\externalfiguresparameter\c!interaction

Re: [NTG-context] Broken Nightly?

2012-06-25 Thread Wolfgang Schuster
Am 26.06.2012 um 01:59 schrieb Kip Warner: Hey list, I'm using ConTeXt 2012.06.25 and I noticed a broken compilation of my book: grph-epd.mkiv (untested): \startsetups system:graphics:epdf %\ctxlua{figures.mergegoodies(\@@efinteraction)}% \ctxlua{figures.mergegoodies

Re: [NTG-context] Broken Nightly?

2012-06-25 Thread Kip Warner
On Tue, 2012-06-26 at 05:27 +0200, Wolfgang Schuster wrote: grph-epd.mkiv (untested): \startsetups system:graphics:epdf %\ctxlua{figures.mergegoodies(\@@efinteraction)}% \ctxlua{figures.mergegoodies(\externalfiguresparameter\c!interaction)}% \reference[\figurereference]{}% todo

Re: [NTG-context] Testing the changing dimensions of boxes (in cycles) via Lua

2012-06-15 Thread luigi scarso
of box via ConTeXt (works fine): \setmybox \lsize=5cm \dorecurse{3}{%    \lsize=\dimexpr(\lsize+7mm)    \setmybox    height of box: \the\ht0\par    width of box: \the\wd0\par \box0\par } \page ... and Height of box via Lua (do not working): \setmybox \ctxlua{ tex.dimen.lsize=5

Re: [NTG-context] Testing the changing dimensions of boxes (in cycles) via Lua

2012-06-15 Thread Jaroslav Hajtmar
=5cm \dorecurse{3}{% \lsize=\dimexpr(\lsize+7mm) \setmybox height of box: \the\ht0\par width of box: \the\wd0\par \box0\par } \page ... and Height of box via Lua (does it work ?): \setmybox \ctxlua{tex.dimen.lsize=5*72.27*65536/25.4;i=0} \dorecurse{3}{% \ctxlua{ --[=[ for i=1, 3 do

[NTG-context] Testing the changing dimensions of boxes (in cycles) via Lua

2012-06-14 Thread Jaroslav Hajtmar
=\dimexpr(\lsize+7mm) \setmybox height of box: \the\ht0\par width of box: \the\wd0\par \box0\par } \page ... and Height of box via Lua (do not working): \setmybox \ctxlua{ tex.dimen.lsize=5*72.27*65536/25.4 for i=1, 3 do tex.dimen.lsize=tex.dimen.lsize+7*72.27*65536/25.4 context

Re: [NTG-context] feature request for \getspr{}

2012-06-08 Thread Peter Münster
On Fri, Jun 08 2012, Hans Hagen wrote: I've added moduledata.spreadsheets.settings.numberseparator but you have to test it after the next upload. Tested. Thanks! Just a minor comment: \setupspreadsheet[numberseparator=,] would be nicer than \ctxlua

Re: [NTG-context] feature request for \getspr{}

2012-06-08 Thread Hans Hagen
On 8-6-2012 12:21, Peter Münster wrote: On Fri, Jun 08 2012, Hans Hagen wrote: I've added moduledata.spreadsheets.settings.numberseparator but you have to test it after the next upload. Tested. Thanks! Just a minor comment: \setupspreadsheet[numberseparator=,] would be nicer than \ctxlua

Re: [NTG-context] indexing puzzle

2012-05-26 Thread Alan Bowen
userdata.locuskey(x) context(string.gsub(x,(%d+),function (s) return string.format(%04d,tonumber(s)) end)) end \stopluacode \def\locuskey#1{\ctxlua{userdata.locuskey(#1)}} The Mark IV/Luatex one was much nicer, less frustrating to figure out. On May 24, 2012, at 7:06 AM, Alan Bowen wrote

Re: [NTG-context] indexing puzzle

2012-05-26 Thread Rogers, Michael K
(s) return string.format(%04d,tonumber(s)) end)) end \stopluacode \def\locuskey#1{\ctxlua{userdata.locuskey(#1)}} The Mark IV/Luatex one was much nicer, less frustrating to figure out. On May 24, 2012, at 7:06 AM, Alan Bowen wrote: For anyone interested in producing classical indices locorum

Re: [NTG-context] indexing puzzle

2012-05-26 Thread Alan Bowen
+#3}} % Def. of \locuskey \startluacode userdata = userdata or { } function userdata.locuskey(x) context(string.gsub(x,(%d+),function (s) return string.format(%04d,tonumber(s)) end)) end \stopluacode \def\locuskey#1{\ctxlua{userdata.locuskey(#1)}} The Mark IV/Luatex one was much

Re: [NTG-context] Use figures without file extension

2012-05-26 Thread Rogers, Michael K
\stopluacode \starttext img1 is \ctxlua{userdata.mytype(img1)}\par img2 is \ctxlua{userdata.mytype(img2)} \stoptext Michael This e-mail message (including any attachments) is for the sole use of the intended recipient(s) and may contain confidential

Re: [NTG-context] indexing puzzle

2012-05-24 Thread Rogers, Michael K
\startluacode userdata = userdata or { } function userdata.locuskey(x) context(string.gsub(x,(%d+),function (s) return string.format(%04d,tonumber(s)) end)) end \stopluacode \def\locuskey#1{\ctxlua{userdata.locuskey(#1)}} The Mark IV/Luatex one was much nicer, less frustrating to figure out. On May 24

Re: [NTG-context] Problem calling system

2012-05-17 Thread Procházka Lukáš Ing . - Pontex s . r . o .
... Finally, I use the following to avoid ' in arguments and to keep to os.execute(): \bgroup \catcode`\%=11 \ctxlua{os.execute(([[echo lua -e print 'EXECUTE']]):gsub('(.-)', [[%1]]))} \egroup % Or: \startluacode os.execute(([[echo lua -e print 'EXECUTE']]):gsub('(.-)', [[%1

Re: [NTG-context] Problem calling system

2012-05-15 Thread Procházka Lukáš Ing . - Pontex s . r . o .
Hello, I slightly modified the example - my code now is: \ctxlua{os.execute([[echo lua -e print 'WWW']])} \starttext A \stoptext So now I'm able to diagnose what exactly is passed to the command line. I'm getting: ... languageslanguage en is active lua -e print WWW {c

Re: [NTG-context] Problem calling system

2012-05-15 Thread Hans Hagen
On 15-5-2012 09:05, Procházka Lukáš Ing. - Pontex s. r. o. wrote: Hello, I slightly modified the example - my code now is: \ctxlua{os.execute([[echo lua -e print 'WWW']])} \starttext A \stoptext So now I'm able to diagnose what exactly is passed to the command line. I'm getting

Re: [NTG-context] Problem calling system

2012-05-15 Thread Procházka Lukáš Ing . - Pontex s . r . o .
os.execute([[echo lua -e print 'WWW']]) lua -e print 'WWW' =os.exec nil =os.spawn nil - There is no '/ substitution in standalone Lua (?!). does os.exec or os.spawn work ok? Well, the 'os.exec' works, in condition that it is called with cmd /c: \ctxlua{os.execute([[echo lua -e print

Re: [NTG-context] Problem calling system

2012-05-14 Thread Hans Hagen
require 'lfs' - there is no error. From within the Context code, I'm getting (see CmdLine.log): lua.exe: (command line):1: '=' expected near 'lfs' lua.exe: (command line):1: '=' expected near 'eof'... What could be the problem? My OS is WinXP 32b. And how about \ctxlua{os.execute(lua

Re: [NTG-context] Problem calling system

2012-05-14 Thread Procházka Lukáš Ing . - Pontex s . r . o .
\ctxlua{os.execute(lua -e require 'lfs')} ... Gives: ... fontslatin modern fonts are not preloaded languageslanguage en is active ! LuaTeX error main ctx instance:1: attempt to call global 'e' (a nil value) stack traceback: main ctx instance:1: in main chunk

Re: [NTG-context] Problem calling system

2012-05-14 Thread Hans Hagen
On 14-5-2012 12:23, Procházka Lukáš Ing. - Pontex s. r. o. wrote: \ctxlua{os.execute(lua -e require 'lfs')} \ctxlua{os.execute([[lua -e require 'lfs']])} - Hans Hagen | PRAGMA ADE

[NTG-context] Split \startalign content on more pages

2012-05-13 Thread elgo...@libero.it
\sbc{} is a command defined by me. \define[1]\sbc{\ctxlua{context(\%.2f, #1)}}% I'm writing a technical report and I use that command to substitute numbers to letters in formulas. ___ If your question is of interest

Re: [NTG-context] Split \startalign content on more pages

2012-05-13 Thread luigi scarso
On Sun, May 13, 2012 at 3:54 PM, elgo...@libero.it elgo...@libero.it wrote: \sbc{} is a command defined by me. \define[1]\sbc{\ctxlua{context(\%.2f, #1)}}% I'm writing a technical report and I use that command to substitute numbers to letters in formulas. ok, I'm using \def\sbc#1{#1} \let\sbd

Re: [NTG-context] Split \startalign content on more pages

2012-05-13 Thread Aditya Mahajan
On Sun, 13 May 2012, elgo...@libero.it wrote: \sbc{} is a command defined by me. \define[1]\sbc{\ctxlua{context(\%.2f, #1)}}% I'm writing a technical report and I use that command to substitute numbers to letters in formulas. Please create a complete working minimal example. Aditya

[NTG-context] Split \startalign content on more pages

2012-05-13 Thread elgo...@libero.it
- % comando \sb \def\sb#1{\ctxlua{tex.print(#1)}}% definizione comando di sostituzione dei valori numerici a quelli letterali % comando \sba \def\sba#1{\ctxlua{tex.print(string.format(\%.0f, #1))}}% sostituisce numero a valori letterali scrivendolo senza cifre decimali % comando \sbb \define

Re: [NTG-context] \systemparameter{n}

2012-05-07 Thread Peter Rolf
Am 06.05.2012 22:26, schrieb Hans Hagen: On 3-5-2012 19:01, Peter Rolf wrote: Hi, the system parameter 'n' is not properly set on the third run. % test.tex \starttext \ifnum\systemparameter{n}=1\relax \ctxlua{print(*** 1st run)}\fi \ifnum\systemparameter{n}=2\relax \ctxlua{print

Re: [NTG-context] \systemparameter{n}

2012-05-06 Thread Hans Hagen
On 3-5-2012 19:01, Peter Rolf wrote: Hi, the system parameter 'n' is not properly set on the third run. % test.tex \starttext \ifnum\systemparameter{n}=1\relax \ctxlua{print(*** 1st run)}\fi \ifnum\systemparameter{n}=2\relax \ctxlua{print(*** 2nd run)}\fi \ifnum\systemparameter{n}=3

Re: [NTG-context] Font for MetaPost graphics

2012-05-05 Thread Hans Hagen
()}% \settrue\MPLIBtextgetdone % no \global needed \fi \dowithnextbox{\ctxlua{metapost.settext(\number\nextbox,#1)}}\hbox} \def\MPLIBresettexts {\ctxlua{metapost.resettextexts()}%$ \setfalse\MPLIBtextgetdone} \starttext Serif \startMPcode draw textext(\ss Sans) ; \stopMPcode Serif

[NTG-context] Wiki - results differ?

2012-05-04 Thread Procházka Lukáš Ing . - Pontex s . r . o .
Hello, Wiki and a file processed on a local computer give different results - - please compare http://wiki.contextgarden.net/Command/doif...; and the example attached: \starttext \ctxlua{test = true} Test is \ctxlua{commands.testcase(test)}{True}{False}. \ctxlua{test = false

[NTG-context] \systemparameter{n}

2012-05-03 Thread Peter Rolf
Hi, the system parameter 'n' is not properly set on the third run. % test.tex \starttext \ifnum\systemparameter{n}=1\relax \ctxlua{print(*** 1st run)}\fi \ifnum\systemparameter{n}=2\relax \ctxlua{print(*** 2nd run)}\fi \ifnum\systemparameter{n}=3\relax \ctxlua{print(*** 3rd run)}\fi

[NTG-context] extracting word count from a *.words file

2012-04-20 Thread Jelle Huisman
Hello all, Here is another question. Consider this test file: \starttext \setupspellchecking[state=start,method=2] \ctxlua{languages.words.threshold=3} \input knuth \stoptext Typesetting this file produces a word list 'test.words' which ends like this: [threshold]=1, [total]=122, [version

Re: [NTG-context] extracting word count from a *.words file

2012-04-20 Thread Philipp Gesang
Hi again, On 2012-04-20 16:32, Jelle Huisman wrote: Hello all, Here is another question. Consider this test file: \starttext \setupspellchecking[state=start,method=2] \ctxlua{languages.words.threshold=3} \input knuth \stoptext Typesetting this file produces a word list 'test.words

Re: [NTG-context] extracting word count from a *.words file

2012-04-20 Thread Marco
{% \dosingleempty\dowordcount} \def\dowordcount[#1]{% \ctxlua{userdata.wordcount(#1)}} \starttext % Set up the word count \ctxlua{languages.words.threshold=2} \setupspellchecking [state=start, method=2] \setupspellchecking [list=foo] \startsection [title=Foo] Foo Bar \stopsection

Re: [NTG-context] extracting word count from a *.words file

2012-04-20 Thread Jelle Huisman
On 04/20/2012 04:53 PM, Philipp Gesang wrote: Hi again, On 2012-04-20 16:32, Jelle Huisman wrote: Hello all, Here is another question. Consider this test file: \starttext \setupspellchecking[state=start,method=2] \ctxlua{languages.words.threshold=3} \input knuth \stoptext

Re: [NTG-context] Dump table of contents

2012-04-09 Thread Kip Warner
On Mon, 2012-04-09 at 00:08 -0400, Aditya Mahajan wrote: \def\loaddatafile#1% {\ctxlua { job.initialize(#1.tuc,#1.tua) }}% \loaddatafile{full-book} %with the .tex extension \starttext \placelist[chapter] \stoptext Thanks Aditya, but I tried doing that. ConTeXt

Re: [NTG-context] Dump table of contents

2012-04-09 Thread Aditya Mahajan
On Sun, 8 Apr 2012, Kip Warner wrote: On Mon, 2012-04-09 at 00:08 -0400, Aditya Mahajan wrote: \def\loaddatafile#1% {\ctxlua { job.initialize(#1.tuc,#1.tua) }}% \loaddatafile{full-book} %with the .tex extension Sorry, this should have read: WITHOUT the .tex extension

Re: [NTG-context] Dump table of contents

2012-04-08 Thread Aditya Mahajan
. \def\loaddatafile#1% {\ctxlua { job.initialize(#1.tuc,#1.tua) }}% \loaddatafile{full-book} %with the .tex extension \starttext \placelist[chapter] \stoptext Aditya ___ If your question is of interest

Re: [NTG-context] Hooking \stoptext

2012-03-07 Thread Procházka Lukáš Ing . - Pontex s . r . o .
to the user. More complicated example: t-Hook4.mkiv \startluacode function foo() local stoptext_p = context.stoptext context.stoptext = function(...) context(END) stoptext_p(...) end end \stopluacode \starttext \input knuth \ctxlua{foo()} % This should cause

Re: [NTG-context] Hooking \stoptext

2012-03-07 Thread Wolfgang Schuster
Am 07.03.2012 um 16:57 schrieb Procházka Lukáš Ing. - Pontex s. r. o.: ... Yes, that's it! Thanks a lot! You can also write your own stop/stop-commands for the document like \def\startmydocument {\starttext} \def\stopmydocument {\ctxlua{…}% \stoptext} and use them instead

Re: [NTG-context] Hooking \stoptext

2012-03-07 Thread Wolfgang Schuster
{\ctxlua{…}% \stoptext} and use them instead of \starttext and \stoptext. Or you use the predefined document environment which has before and after keys. \setupdocument[after={\blank\midaligned{\bf THE END}}] \startdocument \input knuth \stopdocument Wolfgang

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( BazaarRevision, os.resultofbzr

Re: [NTG-context] Including command output

2012-03-05 Thread Aditya Mahajan
On Mon, 5 Mar 2012, Kip Warner wrote: 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( BazaarRevision

Re: [NTG-context] Including command output

2012-03-05 Thread Kip Warner
} {\showboxdepth} {\tracinggroups} {\tracingifs} {\tracingscantokens} {\tracingnesting} {\tracingassigns} {into \tracingassigns=2} {\errorstopmode} {\tracingonline} {changing \tracingonline=1} {into \tracingonline=0} \BazaarRevision -\ctxlua {context.setevalue( BazaarRevision, os.resultofbzr revno | tr -d '\\n

Re: [NTG-context] Including command output

2012-03-05 Thread Aditya Mahajan
), author=Some Book (Bzr r\BazaarRevision)] Why don't you use the first version (\initializebazaarversion and \usebazaarversion)? \def\initializeBazaar {\ctxlua{context(\\global\\edef\\BazaarRevision{\%s}, os.resultofbzr revno | tr -d '\\n')}} \initializeBazaar

Re: [NTG-context] Including command output

2012-03-05 Thread Kip Warner
On Tue, 2012-03-06 at 00:04 -0500, Aditya Mahajan wrote: Why don't you use the first version (\initializebazaarversion and \usebazaarversion)? \def\initializeBazaar {\ctxlua{context(\\global\\edef\\BazaarRevision{\%s}, os.resultofbzr revno | tr -d '\\n

Re: [NTG-context] Including command output

2012-03-04 Thread Aditya Mahajan
{\ctxlua{context.setevalue( usebazaarrevision, os.resultofbzr revno | tr -d '\\n')}} \appendtoks \initilizebazaar \to \everystarttext and then use can use \usebazaarrevision in the main text. If you want to use the automagic way, you can define \BazaarRevision

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

2012-02-16 Thread Hans Hagen
() if #files 0 then context(table.remove(files, math.random(1,#files)) or dummy) else context(dummy) end end \stopluacode \def\CollectGraphics[#1]{\ctxlua{document.collectgraphics(#1)}} \def\ChooseGraphic {\ctxlua{document.choosegraphic

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

2012-02-16 Thread Hans Hagen
, ))) 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\CollectGraphics[#1]{\ctxlua{document.collectgraphics(#1)}} \def\ChooseGraphic

[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{šěřěžřýčřčžáýčý} % Here is a problem

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

2012-02-01 Thread Philipp Gesang
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{šěřěžřýčřčžáýčý} % Here is a problem \mymacro{asdfghjklqwertt} % Here is all OK \stoptext

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

2012-01-30 Thread Aditya Mahajan
] \externalfigure [\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

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

2012-01-05 Thread Wagner Macedo
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, but coding in Lua is better to me. -- Wagner Macedo

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

2012-01-05 Thread Wolfgang Schuster
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) if s == then ... else ... end } \stoptext I know that I can use some of \if* TeX

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

2012-01-05 Thread Wagner Macedo
. \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, but coding in Lua is better to me. What you’re trying is not possible

[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] 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

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\csname Coeff#1

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 expected... \setuprandomize[2012] \define[3

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 global namespace, you can use “userdata

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

2012-01-05 Thread Otared Kavian
: 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

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