[NTG-context] luatex and xml
Hi, I am trying to parse a xml file with mkiv to process a list of invoices (factuur in dutch). The xml file looks like this 123456789 1 januari 2008 Omschrijving geleverde dienst a 1500,00 Omschrijving geleverde dienst b 200,00 I want to extract and sum the invoices (regels). I managed to get things working (printing) but don't know how to assign these values into lua variables for the summing. The test code looks like this % engine=luatex \starttext \startluacode document.xml = document.xml or { } -- define namespace document.xml = xml.load("factuur.xml") -- load the file n = xml.count(document.xml, "/factuur/regels/omschrijving") for i = 1, n do -- -- here I want to assign the values returned by xml.filter into local variable amount -- xml.sprint(xml.filter(document.xml, "/factuur/regels/bedrag/position(" .. i .. ")" )) end \stopluacode \stoptext Kind regards WN ___ 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://tex.aanhet.net archive : https://foundry.supelec.fr/projects/contextrev/ wiki : http://contextgarden.net ___
Re: [NTG-context] oldstyle features and typing
On May 17, 2008, at 9:06 PM, Hans Hagen wrote: > in node-ini ... you can play with this change ... > > > function nodes.process_characters(head) > --~ if status.output_active then > if false then > return head, false -- true > else > Great! Yes, this seems to take care of the problem; thanks a lot, Hans! Best Thomas ___ 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://tex.aanhet.net archive : https://foundry.supelec.fr/projects/contextrev/ wiki : http://contextgarden.net ___
Re: [NTG-context] oldstyle features and typing
Thomas A. Schmitz wrote: > On May 17, 2008, at 6:58 PM, Hans Hagen wrote: > >>> Another interesting feature is that numbers in the typing >>> environmnet come >>> out in oldstyle (they look nice, BTW). This is expected, and can be >>> avoided by using a complete typescript and loading tt fonts with >>> fefault >>> features, and other with oldstyle features. Nevertheless, I find it >>> to be >>> an interesting side effect. >> \def\mkinitializeverbatim >> {\ctxlua{buffers.visualizers.reset()}% >>\def\obs{\obeyedspace}% >>\verbatimfont >>\resetfontfeature >>\obeycharacters} > > Since we're speaking about oldstyle numbers, here's an interesting > little bug in mkiv that has bugged me (no pun intended) for quite some > time now. Is there a solution to this one too? > > Best > > Thomas > > \definefontfeature >[mytest] > > [mode > =node,script=latn,language=dflt,kern=yes,tlig=yes,trep=yes,onum=yes] > > \starttypescript [serif] [test] >\definefontsynonym [Serif] [name:TeXGyrePagella-Regular] > [features=mytest] > \stoptypescript > > \starttypescript [Test] >\definetypeface [Test] [rm] [serif] [test] [default] > \stoptypescript > > \usetypescript[Test] > \setupbodyfont[Test,12pt] > > \setupfootertexts[-- \pagenumber\ --] > > \starttext > -- 123456789 -- > \stoptext in node-ini ... you can play with this change ... function nodes.process_characters(head) --~ if status.output_active then if false then return head, false -- true else - Hans Hagen | PRAGMA ADE Ridderstraat 27 | 8061 GH Hasselt | The Netherlands tel: 038 477 53 69 | fax: 038 477 53 74 | www.pragma-ade.com | 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://tex.aanhet.net archive : https://foundry.supelec.fr/projects/contextrev/ wiki : http://contextgarden.net ___
Re: [NTG-context] missing btex ..etex in mp figure
Ok. In next example, f>0 is hide \starttext \startTEXpage\startMPcode %beginfig(2); h=2in; w=2.7in; path p[], q[], pp; for i=1.5,2,4: ii := i**2; p[i] = (w/ii,h){1/ii,-1}...(w/i,h/i)...(w,h/ii){1,-1/ii}; endfor for i=.5,1.5: q[i] = origin..(w,i*h) cutafter p1.5; endfor pp = buildcycle(q0.5, p2, q1.5, p4); fill pp withcolor .8white; z0=center pp; picture lab; lab=thelabel(btex $f>0$ etex, z0); unfill bbox lab; draw lab; draw q0.5; draw p2; draw q1.5; draw p4; makelabel.top(btex $P$ etex, p2 intersectionpoint q0.5); makelabel.rt(btex $Q$ etex, p2 intersectionpoint q1.5); %endfig; \stopMPcode\stopTEXpage \stoptext -- luigi it's new . it's powerful . it's luatex . http://www.luatex.org ___ 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://tex.aanhet.net archive : https://foundry.supelec.fr/projects/contextrev/ wiki : http://contextgarden.net ___
Re: [NTG-context] oldstyle features and typing
On May 17, 2008, at 6:58 PM, Hans Hagen wrote: >> >> Another interesting feature is that numbers in the typing >> environmnet come >> out in oldstyle (they look nice, BTW). This is expected, and can be >> avoided by using a complete typescript and loading tt fonts with >> fefault >> features, and other with oldstyle features. Nevertheless, I find it >> to be >> an interesting side effect. > > \def\mkinitializeverbatim > {\ctxlua{buffers.visualizers.reset()}% >\def\obs{\obeyedspace}% >\verbatimfont >\resetfontfeature >\obeycharacters} Since we're speaking about oldstyle numbers, here's an interesting little bug in mkiv that has bugged me (no pun intended) for quite some time now. Is there a solution to this one too? Best Thomas \definefontfeature [mytest] [mode =node,script=latn,language=dflt,kern=yes,tlig=yes,trep=yes,onum=yes] \starttypescript [serif] [test] \definefontsynonym [Serif] [name:TeXGyrePagella-Regular] [features=mytest] \stoptypescript \starttypescript [Test] \definetypeface [Test] [rm] [serif] [test] [default] \stoptypescript \usetypescript[Test] \setupbodyfont[Test,12pt] \setupfootertexts[-- \pagenumber\ --] \starttext -- 123456789 -- \stoptext ___ 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://tex.aanhet.net archive : https://foundry.supelec.fr/projects/contextrev/ wiki : http://contextgarden.net ___
Re: [NTG-context] oldstyle features and typing
Aditya Mahajan wrote: > Hi, > > While using oldstyle features with mkiv, -- in a typing environment comes > out as a endash. I would consider this a bug. > > For example: > > \setfontfeature{oldstyle} > \starttext > \starttyping > -- A comment 123 > \stoptyping > > \stoptext > > Another interesting feature is that numbers in the typing environmnet come > out in oldstyle (they look nice, BTW). This is expected, and can be > avoided by using a complete typescript and loading tt fonts with fefault > features, and other with oldstyle features. Nevertheless, I find it to be > an interesting side effect. \def\mkinitializeverbatim {\ctxlua{buffers.visualizers.reset()}% \def\obs{\obeyedspace}% \verbatimfont \resetfontfeature \obeycharacters} - Hans Hagen | PRAGMA ADE Ridderstraat 27 | 8061 GH Hasselt | The Netherlands tel: 038 477 53 69 | fax: 038 477 53 74 | www.pragma-ade.com | 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://tex.aanhet.net archive : https://foundry.supelec.fr/projects/contextrev/ wiki : http://contextgarden.net ___
Re: [NTG-context] a question about ConTeXt + AUCTeX
On May 17, 2008, at 11:28 AM, Taco Hoekwater wrote: > Emacs has a setenv command, so you could "do" the whole setuptex > in elisp with commands like this in your emacs startup script: > > (setenv "TEXMF" > "{$TEXMFOS,$TEXMFPROJECT,$TEXMFFONTS,$TEXMFLOCAL,$TEXMFEXTRA,!! > $TEXMFMAIN}") > > Maybe that is an idea? > > Cheers, > Taco Yes, that would be possible (but you would also have to set the PATH variable). Another idea on Mac OS X is the use of an environment.plist which will set variables for all GUI applications. I'm not very much in favor of that, though, because it has created problems in the past with Geben Wierda's TeX installer. Since I spend much of my time in a terminal window anyway, I find it easiest to start emacs and/or gvim from there. Best Thomas ___ 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://tex.aanhet.net archive : https://foundry.supelec.fr/projects/contextrev/ wiki : http://contextgarden.net ___
Re: [NTG-context] some minor problems (mkiv)
Taco Hoekwater wrote: > > Peter Rolf wrote: >> hi, >> >> i'm still trying to make my code run with mkiv. here are two minor >> problems. the first one is easy to deal with, but the second one >> currently breaks my testbed. >> >> >> % engine=luatex >> \setupcolors[state=start] >> >> \starttext >> >> \startMPcode >> label("no color",origin) withcolor red; % always black >> \stopMPcode > > Interesting problem, that one. The lack of color is easily explained > because there is an implied textext() around the string., but it is > not that easily solved, I suspect. actually this was a bug but probably only taco has the version that fixes it (after all, we must stay at least a week ahead of you) >> \string{\{} > > Side note wrt. the example: don't you want \string\{ instead? > > Anyway, the underlying problem is something for Aditya to look at, > maybe. Too many commands are now 'math mode only' because of changes > in char-def.lua. - Hans Hagen | PRAGMA ADE Ridderstraat 27 | 8061 GH Hasselt | The Netherlands tel: 038 477 53 69 | fax: 038 477 53 74 | www.pragma-ade.com | 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://tex.aanhet.net archive : https://foundry.supelec.fr/projects/contextrev/ wiki : http://contextgarden.net ___
Re: [NTG-context] missing btex ..etex in mp figure
Taco Hoekwater wrote: > > luigi scarso wrote: >> In >> >> \starttext >> \startTEXpage >> \startlua >> metapost.process("metafun",{"beginfig(1);", >> "a=.7in; b=0.5in;", >> "z0=(0,0); z1=(a,0); z2=(0,b);", >> "z0=.5[z1,z3]=.5[z2,z4];", >> "draw z1..z2..z3..z4..cycle;", >> "drawarrow z0..z1;", >> "drawarrow z0..z2;", >> "label.top(btex $a$ etex, .5[z0,z1]);", >> "label.lft(btex $b$ etex, .5[z0,z2]);", >> "endfig;"}) >> \stoplua >> \stopTEXpage >> \stoptext >> >> there are no labels, but I believe that it's wrong. > > The MPlib library embedded in luatex does not actually > support btex .. etex blocks. > > It is planned to intercept such blocks in the mkiv lua > code, but for now, just use textext(). why not use \starttext \startMPpage a=.7in; b=0.5in; z0=(0,0); z1=(a,0); z2=(0,b); z0=.5[z1,z3]=.5[z2,z4]; draw z1..z2..z3..z4..cycle; drawarrow z0..z1; drawarrow z0..z2; label.top(btex $a$ etex, .5[z0,z1]); label.lft(btex $b$ etex, .5[z0,z2]); endfig; \stopMPpage \stoptext this uses: metapost.graphic(mpsformat,str,preamble) which does intercept the btex/etex - Hans Hagen | PRAGMA ADE Ridderstraat 27 | 8061 GH Hasselt | The Netherlands tel: 038 477 53 69 | fax: 038 477 53 74 | www.pragma-ade.com | 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://tex.aanhet.net archive : https://foundry.supelec.fr/projects/contextrev/ wiki : http://contextgarden.net ___
Re: [NTG-context] a question about ConTeXt + AUCTeX
Thomas A. Schmitz wrote: > > Yes, you're both right. What I do (and what I find the easiest way): > start emacs from the same terminal where you have issued > "source .luatex" with the command "open -a emacs". That way, emacs > should know about path variables. Emacs has a setenv command, so you could "do" the whole setuptex in elisp with commands like this in your emacs startup script: (setenv "TEXMF" "{$TEXMFOS,$TEXMFPROJECT,$TEXMFFONTS,$TEXMFLOCAL,$TEXMFEXTRA,!!$TEXMFMAIN}") Maybe that is an idea? Cheers, Taco ___ If your question is of interest to others as well, please add an entry to the Wiki! maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context webpage : http://www.pragma-ade.nl / http://tex.aanhet.net archive : https://foundry.supelec.fr/projects/contextrev/ wiki : http://contextgarden.net ___
Re: [NTG-context] a question about ConTeXt + AUCTeX
On May 17, 2008, at 10:53 AM, Jean Magnan de Bornier wrote: > Le 17 mai à 10:11:13 Dalyoung Jeong <[EMAIL PROTECTED]> écrit notamment: > > | However, the same command worked well in a terminal. >> > | Maybe the system setup of yours is different from mine. > | Usually I run "source .luatex" first before running luatex. > | So my guess is that emacs couldn't know the luatex path even > though it > | is known in another program "terminal". >> > | Am I correct? If so, how to apply environment .luatex to global > | condition? Otherwise, what are wrong in my setup? > > Yes I think you are correct; if you start emacs *from this terminal > from > which you issued "source .luatex"* you will probably see that emacs > knows > luatex; this is what I had on my system, before I found how to have > all my > emacs know the proper environment. I am on linux and I believe you > are on > mac, so I'm not sure my experience can be extended to you? > > If needed I will be more specific. > > hth Yes, you're both right. What I do (and what I find the easiest way): start emacs from the same terminal where you have issued "source .luatex" with the command "open -a emacs". That way, emacs should know about path variables. Thomas ___ 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://tex.aanhet.net archive : https://foundry.supelec.fr/projects/contextrev/ wiki : http://contextgarden.net ___
Re: [NTG-context] a question about ConTeXt + AUCTeX
Le 17 mai à 10:11:13 Dalyoung Jeong <[EMAIL PROTECTED]> écrit notamment: | However, the same command worked well in a terminal. > | Maybe the system setup of yours is different from mine. | Usually I run "source .luatex" first before running luatex. | So my guess is that emacs couldn't know the luatex path even though it | is known in another program "terminal". > | Am I correct? If so, how to apply environment .luatex to global | condition? Otherwise, what are wrong in my setup? Yes I think you are correct; if you start emacs *from this terminal from which you issued "source .luatex"* you will probably see that emacs knows luatex; this is what I had on my system, before I found how to have all my emacs know the proper environment. I am on linux and I believe you are on mac, so I'm not sure my experience can be extended to you? If needed I will be more specific. hth -- Jean ___ 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://tex.aanhet.net archive : https://foundry.supelec.fr/projects/contextrev/ wiki : http://contextgarden.net ___
Re: [NTG-context] a question about ConTeXt + AUCTeX
Dear Thomas, Thank you for your reply. XeTeX+ ConTeXt is working after adding a command as you said. (customize-variaable) But Lua + ConTeXt is not working. If I do "mtxrun --script context ...", then it complains. %%% Running `Other' on `test-lua' with ``mtxrun --script context %t'' MtxRun | unknown script: context % If I changed the command "texmfstart texexec --lua %t", then I got the following. Running `LuaConTeXt' on `test-lua' with ``texmfstart texexec --lua test-lua.tex'' TeXExec | processing document 'test-lua.tex' TeXExec | no ctx file found TeXExec | tex processing method: context TeXExec | TeX run 1 TeXExec | writing option file test-lua.top TeXExec | using randomseed 828 TeXExec | tex engine: luatex TeXExec | tex format: cont-en LuaTools | using format name /Users/dalyoung/luatex-cache/context/ 5759d5068ca15ba6658b2e6454390744/formats/cont-en.fmt LuaTools | no luc/lua with name /Users/dalyoung/luatex-cache/context/ 5759d5068ca15ba6658b2e6454390744/formats/cont-en LuaTools | LuaTools | runtime: 0.023 seconds TeXUtil | parsing file test-lua.tui TeXUtil | shortcuts : 169 TeXUtil | expansions: 308 TeXUtil | reductions: 0 TeXUtil | divisions : 0 TeXUtil | loaded files: 1 TeXUtil | temporary files: 0 TeXUtil | commands: 21 TeXUtil | programs: 0 TeXUtil | tuo file saved TeXExec | runtime: 0.891602 LuaConTeXt finished at Sat May 17 16:14:24 However, the same command worked well in a terminal. Maybe the system setup of yours is different from mine. Usually I run "source .luatex" first before running luatex. So my guess is that emacs couldn't know the luatex path even though it is known in another program "terminal". Am I correct? If so, how to apply environment .luatex to global condition? Otherwise, what are wrong in my setup? Thank you. Best regards, Dalyoung Jeong ___ 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://tex.aanhet.net archive : https://foundry.supelec.fr/projects/contextrev/ wiki : http://contextgarden.net ___