Hello Hans,

many thanks for your help.

I tried to adapt the code you sent me and in case it can help someone I provide 
you what I wrote.

I don’t pretend to make something perfectly correct but…

The idea is to make a checklist with left and bottom tabs.

The line position of left and bottom tabs are defined in two variables and each 
time the lua function is called it computes the topspace position of the even 
page.

\definepapersize
        [normal]
        [width=14.85cm,
        height=21cm]

\definepapersize
        [upsidedown]
        [normal,
        180]

\setupbodyfont
 [10pt,ss]

\setupcolor
 [xwi]

\setuppapersize
 [normal][A4]

\setuppapersize
 [upsidedown][A4]

\setuplayout
 [backspace=16mm,
  leftmargin=15mm,
  leftmargindistance=1mm,
  topspace=10mm,
  header=0mm,
  footer=0mm,
  height=200mm,
  rightmargin=0mm,
  width=131mm,
  location=middle,
  marking=on]

\definelayer
 [OngletGauche]
 [x=0mm,
  y=0mm,
  width=\paperwidth,
  height=\paperheight]

\definelayer
 [OngletBas]
 [x=0mm,
  y=0mm,
  width=\paperwidth,
  height=\paperheight]

\definelayer
 [ACouper]
 [x=0mm,
  y=0mm,
  width=\paperwidth,
  height=\paperheight]

% variables
\newdimen\hauteuronglet 
\hauteuronglet=1cm
\setvariables[userdata][bottomligne=4]
\setvariables[userdata][leftligne=10]


\setupTABLE
 [r][1]
 [color=dodgerblue,
  align={middle,lohi},
  height=1cm,
  style=\bfx,
  framecolor=black]

\startluacode
        userdata = userdata or { }

        function userdata.onglets(pos, word, opt_2, arg_2)
        
                local ongletgauche = utilities.parsers.settings_to_hash(pos)
                local labelongletgauche = word
        
                local ongletbas = utilities.parsers.settings_to_hash(opt_2)
                local labels  = utilities.parsers.settings_to_array(arg_2)
                
                local ho = tex.dimen.hauteuronglet

                local y_ongletgauche = ongletgauche["numligne"]
                
                y_ongletgauche = tex.dimen.paperheight - y_ongletgauche * ho
                                
                local hauteurzoneacouper =  tex.dimen.paperheight - 
(y_ongletgauche + ho)
                
                local NumLigne       = ongletbas["numligne"]
                local NbTotalOnglets = ongletbas["nbcol"]
                local PremierOnglet  = ongletbas["startcol"]
                local nbTabs = ongletbas["nbtabs"]

                local y_ongletbas               = tex.dimen.paperheight - (ho * 
NumLigne)
                local largeurongletbas  = (tex.dimen.paperwidth  - 
tex.dimen.leftmarginwidth) / NbTotalOnglets
                local x_ongletbas               = tex.dimen.leftmarginwidth   + 
largeurongletbas * (PremierOnglet - 1)
                local acouper = NbTotalOnglets - (nbTabs + PremierOnglet)
                
                context.setupbackgrounds({"page"},{background = "OngletBas, 
OngletGauche, ACouper"})

                context.setlayer(
                        { "OngletBas" },
                        {
                                hoffset = number.todimen(x_ongletbas),
                                        voffset = number.todimen(y_ongletbas),
                        },
                        function()

                        context.bTABLE({ width = 
number.todimen(largeurongletbas) })
                        context.bTR()
                                for i=1, nbTabs
                                        do
                                                context.bTD()
                                                context(labels[i])
                                                context.eTD()
                                        end
                                for i=nbTabs + PremierOnglet, NbTotalOnglets
                                        do
                                                context.bTD({background = 
"color",backgroundcolor = "gray"})
                                                context("C U T")
                                                context.eTD()
                                        end
                        context.eTR()
                        context.eTABLE()
                end
                )
                        
                context.setlayer(
                        { "OngletGauche" },
                        {
                                hoffset = number.todimen(0),
                                voffset = number.todimen(y_ongletgauche),
                        },
                        function()

                        context.startframedtext(
                                {"left"},
                                {
                                align = "lohi, middle",
                                width = "15mm",
                                height = "1cm",
                                offset = "0pt",
                                frameoffset = "0pt",
                                style = "bold",
                                })
                                context(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
___________________________________________________________________________________

Reply via email to