[NTG-context] Some Lua Code solved

2015-01-26 Thread Eric Gerard
(labelongletgauche)
context.stopframedtext()
end
)

if (y_ongletgauche + ho)  tex.dimen.paperheight then
context.setlayer(
{ ACouper },
{
hoffset = number.todimen(0),
voffset = number.todimen(y_ongletgauche 
+ ho),
},
function()

context.startframedtext(
{left},
{
align = lohi, middle,
width = 15mm,
height = 
number.todimen(hauteurzoneacouper),
offset = 0pt,
frameoffset = 0pt,
background = color,
backgroundcolor = gray,
})
context(C U T)
context.stopframedtext()
end
)
end

local topspace_odd = string.todimen(10mm)
local height_odd = tex.dimen.paperheight - NumLigne * ho - 
topspace_odd
context.definelayout(
{odd},
{
topspace = number.todimen(topspace_odd),
height = number.todimen(height_odd),
})

local topspace_even = NumLigne * ho
local height_even = tex.dimen.paperheight - topspace_even - 
topspace_odd
context.definelayout(
{even},
{
topspace = number.todimen(topspace_even),
height = number.todimen(height_even),
})
end
\stopluacode

\def\myTabs[#1][#2][#3][#4]{\ctxlua{userdata.onglets('#1', '#2', '#3', '#4')} } 
  

\starttext
\setuppapersize[normal]

\input{tufte}
\myTabs[numligne=\getvariable{userdata}{leftligne}][BOLD 
FACE][numligne=\getvariable{userdata}{bottomligne}, nbcol=6, startcol=1, 
nbtabs=1][EVACUATION RAPIDE]

\page
\setuppapersize[upsidedown]
\input{tufte}

\page
\setuppapersize[normal]

\input{tufte}
\myTabs[numligne=\getvariable{userdata}{leftligne}][BOLD 
FACE][numligne=\getvariable{userdata}{bottomligne}, nbcol=6, startcol=2, 
nbtabs=2][PANNE AU DECOLLAGE, INTERRUP. D/L]

\page
\setuppapersize[upsidedown]
\input{tufte}

\page
\setuppapersize[normal]

\input{tufte}
\myTabs[numligne=\getvariable{userdata}{leftligne}][BOLD 
FACE][numligne=\getvariable{userdata}{bottomligne}, nbcol=6, startcol=4, 
nbtabs=2][FEU FUMEE CABINE, FEU MOTEUR]

\page
\setuppapersize[upsidedown]
\input{tufte}


\page
\setuppapersize[normal]

\input{tufte}
\myTabs[numligne=\getvariable{userdata}{leftligne}][BOLD 
FACE][numligne=\getvariable{userdata}{bottomligne}, nbcol=6, startcol=6, 
nbtabs=1][STICK INOP FEU AU SOL]

\page
\setuppapersize[upsidedown]
\input{tufte}

\page
\setvariables[userdata][bottomligne=3]
\setuppapersize[normal]

\input{tufte}
\myTabs[numligne=\getvariable{userdata}{leftligne}][BOLD 
FACE][numligne=\getvariable{userdata}{bottomligne}, nbcol=6, startcol=1, 
nbtabs=2][FEU APU, DOUBLE EXTINCTION]

\page
\setuppapersize[upsidedown]
\input{tufte}
\stoptext

I’m sure there is a way to automate the setuppapersize for even and odd pages, 
so I will work on that.

I have a question I don’t see the cutting lines on my printing while defining 
marking on ?

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
___

[NTG-context] Problem with luacode

2015-01-20 Thread Eric Gerard
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
___

[NTG-context] Using luacode

2015-01-19 Thread Eric Gerard
Dear list members

I think I don’t really understand the way to use a context command with luacode 
!
What I attempt to do is to write a function in lua which computes the position 
of one or several bottom tabs depending on : line number (1 is the lowest, 2 is 
above etc), number of tabs, horizontal position of the tab on the line.
The height of the tab is a Tex value \hauteuronglet
So I compute the x and y value and the width of the tab(s)
After that I want to define a layer with the tab(s) in a table
I can’t have the context.setlayer working properly.
For sure, this code should be cleaned after testing.

Here is the code I wrote

\definelayer[OngletBas][x=0mm, y=0mm, width=\paperwidth, height=\paperheight] 
% variables
\newdimen\hauteuronglet
\hauteuronglet=1cm

%variables onglet gauche
\newdimen\vertposonglet
\newdimen\hauteurzoneacouper
%variables onglet bas
\newdimen\largeurzoneongletsbas
\newdimen\ordonneeongletsbas
\newdimen\abscisseongletsbas
\newdimen\largeurongletbas

\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)

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}) 

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

I have to add also (I don’t understand why) but I need to add an offset of 
-6.5pt to adjust the position of the table.

Thanks in advance

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
___

Re: [NTG-context] Start an itemized list with a given number

2015-01-02 Thread Eric Gerard
Vielen dank für die Antwort und Ich wünsche Ihnen ein glückliches neues jahr.
Thanks for the answer, it works perfectly . Happy new year to every people in 
the list

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
___

[NTG-context] Start an itemized list with a given number

2014-12-30 Thread Eric Gerard
Hello everybody and thanks in advance for your advice,

I’m unable to find in the documentation and in the wiki the way to start an 
itemized list with a number different from 1, for instance with 3.

What I want to achieve is something like:

Insert the key
Try to turn the key
If key is working
3.  Open the door
If key is not working
3.  Change key
4.  Goto step 1
So what is the way to start the list after « If key is not working » with the 
number 3 ?

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
___