From: Eric Gerard <eric.b.gerard@gmail.com>
To: ntg-context@ntg.nl
Subject: Problem with luacode
Date: Tue, 20 Jan 2015 20:03:33 +0100 [thread overview]
Message-ID: <A6098789-7340-4195-B96E-C6C899150425@gmail.com> (raw)
Hello Hans,
sorry for that, here is the code I used to check some LUACODE.
\definepapersize[normal][width=14.85cm, height=21cm]
\setupbodyfont[10pt]
\enableregime[il1]
\setupcolor[xwi]
\setuplayout[backspace=16mm, leftmargin=15mm,leftmargindistance=1mm,topspace=10mm,header=0mm,footer=0mm,height=200mm,rightmargin=0mm,width=131mm,location=middle,marking=on]
\setuppapersize[normal][A4]
\definelayer[OngletGauche][x=0mm, y=0mm, width=\paperwidth, height=\paperheight]
\setupTABLE[r][1][color=dodgerblue,align={middle,lohi},height=1cm,style={\sansserif \bfx},framecolor=black]
% variables
\newdimen\hauteuronglet %height of tab
\hauteuronglet=1cm
%variables onglet bas
\newdimen\largeurzoneongletsbas % total width available for tabs
\newdimen\ordonneeongletsbas % vertical position of tab
\newdimen\abscisseongletsbas % horizontal position of tab
\newdimen\largeurongletbas % tab width
\startluacode
function test(opt_1, arg_1)
local table = lpeg.split(",",interfaces.tolist(opt_1))
local labels = lpeg.split(",",arg_1)
local NumLigne = table[1]
local NbTotalOnglets = table[2]
local PremierOnglet = table[3]
local decalage = tex.sp("6.5pt")
print(NumLigne)
print(NbTotalOnglets)
print(PremierOnglet)
tex.dimen.ordonneeongletsbas = tex.dimen.paperheight - tex.dimen.hauteuronglet * NumLigne
tex.dimen.largeurzoneongletsbas = tex.dimen.paperwidth - tex.dimen.backspace
tex.dimen.largeurongletbas = tex.dimen.largeurzoneongletsbas / NbTotalOnglets
tex.dimen.abscisseongletsbas = tex.dimen.backspace + tex.dimen.largeurongletbas * (PremierOnglet - 1)
local x_ongletsbas = tex.dimen.abscisseongletsbas - decalage
local y_ongletsbas = tex.dimen.ordonneeongletsbas
local largeurongletbas = tex.dimen.largeurongletbas
context.setupbackgrounds({"page"},{background = "OngletBas,OngletGauche,ACouper"})
context.setlayer({"OngletBas"},{hoffset = x_ongletsbas, voffset = y_ongletsbas},
context.setupTABLE({c},{1,2,3,4,5,6},{width = largeurongletbas})
context.bTABLE()
context.bTR()
context.bTD()
context(labels[1])
context.eTD()
context.eTR()
context.eTABLE()
)
end
interfaces.definecommand {
name = "test",
arguments = {
{ "option", "hash" },
{ "content", "string" },
},
macro = test,
}
\stopluacode
\starttext
\ss
\showframe
\input{tufte}
\test[1,6,1]{GROUND EGRESS}
\stoptext
This code is not working, I get an error while calling the function, and I don’t understand why.
Can you explain if you have a bit of time the remark you made about the overload of table ?
Eric Gerard
___________________________________________________________________________________
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 : http://foundry.supelec.fr/projects/contextrev/
wiki : http://contextgarden.net
___________________________________________________________________________________
next reply other threads:[~2015-01-20 19:03 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-01-20 19:03 Eric Gerard [this message]
2015-01-22 18:51 ` Hans Hagen
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=A6098789-7340-4195-B96E-C6C899150425@gmail.com \
--to=eric.b.gerard@gmail.com \
--cc=ntg-context@ntg.nl \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).