The following macro is wrong: \def\TestC{% \directlua0{% \obeyspaces \obeylines code =[[ class Test(object): def __init__(self): self.a=[0,3,81,2,-1] self.b=self.a[:] self.a.sort() def get(self): return self.a,self.b ]] }} ! LuaTeX error [string "luas[0]"]:1: unexpected symbol near '\'. \TestC ...def get(self): return self.a,self.b ]] } I must preserve spaces and newlines. Any idea ? Thanks in advance -- luigi ---------------------------------------------------------------- If your question is of interest to others as well, please add an entry to the Wiki! maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context webpage : http://www.pragma-ade.nl / http://tex.aanhet.net archive : https://foundry.supelec.fr/projects/contextrev/ wiki : http://contextgarden.net
luigi scarso wrote:
The following macro is wrong: \def\TestC{% \directlua0{% \obeyspaces \obeylines
hm, you want to expand this kin dof stuff inside the directlua?
code =[[ class Test(object): def __init__(self): self.a=[0,3,81,2,-1] self.b=self.a[:] self.a.sort()
def get(self): return self.a,self.b ]] }}
! LuaTeX error [string "luas[0]"]:1: unexpected symbol near '\'. \TestC ...def get(self): return self.a,self.b ]] }
I must preserve spaces and newlines.
Any idea ?
just use \startluacode \stopluacode ----------------------------------------------------------------- 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 -----------------------------------------------------------------
On 8/26/07, Hans Hagen
luigi scarso wrote:
The following macro is wrong: \def\TestC{% \directlua0{% \obeyspaces \obeylines
hm, you want to expand this kin dof stuff inside the directlua? As a last resorse to preserve spaces
I must preserve spaces and newlines.
Any idea ?
just use
\startluacode
\stopluacode
No, it doesn't work for my needs because it doesn't preserve spaces and newline. This works, after putting code in testD.lua \def\TestD#1{% \directlua0{dofile('testD.lua')}% } -- luigi ---------------------------------------------------------------- If your question is of interest to others as well, please add an entry to the Wiki! maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context webpage : http://www.pragma-ade.nl / http://tex.aanhet.net archive : https://foundry.supelec.fr/projects/contextrev/ wiki : http://contextgarden.net
participants (2)
-
Hans Hagen
-
luigi scarso