2

I have a special layout of page to make. It contains blocks of text, a graph and tables. I don't know in advance the length of the tables in the document. I have a dummy two tables example to show what I want to do. sample document

And the code to do that is here:

    \setupcolors[state=start]
    \setuplayout[backspace=20mm,
    topspace=20mm,
    header=0mm, 
    footer=10mm,
    leftedge=0.5in,
    rightedge=0.5in,
    width=fit,
    rightmargin=0mm]

    \starttext

    \startuseMPgraphic{FunnyFrame}
    picture p ; numeric o ; path a, b ; pair c ;
    p := textext.rt(\MPstring{FunnyFrame}) ;
    o := BodyFontSize ;
    a := unitsquare xyscaled(OverlayWidth,OverlayHeight) ;
    pickup pencircle scaled OverlayLineWidth ;
    b := a  ;
    fill b withcolor .5[white, blue] ;
    draw b withcolor .5[white, blue] ;
    setbounds currentpicture to a ;
    \stopuseMPgraphic

    \defineoverlay[FunnyFrame][\useMPgraphic{FunnyFrame}]
    \defineblank[aroundFrame][1pt]
    \defineframedtext[FunnyText][frame=off,background=FunnyFrame,align={middle,hilo}, color=white,backgroundoffset=0pt,offset=3pt,width=\hsize,margin=no,before={\blank[aroundFrame]},after={\blank[aroundFrame]}]
    \def\StartFrame{\startFunnyText}
    \def\StopFrame {\stopFunnyText }
    \setMPtext{FunnyFrame}{} % initialize the text variable


    \defineparagraphs[DetailTablesColumns][n=2, distance=0pt, tolerance=very tolerant]
    \setupparagraphs[DetailTablesColumns][1][width=2.5cm]

    \setupTABLE[row][each][framecolor=white,rulethickness=2pt,frame=on]
    \setupTABLE[row][even]
    [background=color,backgroundcolor=white,frame=off]
    \setupTABLE[row][odd]
    [background=color,backgroundcolor=gray,frame=off]
    \setupTABLE[header][each]
    [background=color,backgroundcolor=darkblue,foregroundcolor=white,style=bold]
    \setupTABLE[column][each][width=.25\hsize]

    \startDetailTablesColumns
    \StartFrame[width=\hsize]
    Some funny title

    With subtitle
    \StopFrame
    \DetailTablesColumns
    \bTABLE[align=right,option=stretch,split=repeat]
    \bTABLEhead
    \bTR
    \bTH A1 \eTH \bTH B1 \eTH \bTH C1 \eTH \bTH D1 \eTH
    \eTR
    \eTABLEhead
    \bTABLEbody
    \dorecurse{3}
    {
    \bTR
    \bTD 1 \eTD \bTD 2 \eTD \bTD 3 \eTD \bTD 4 \eTD
    \eTR
    }
    \eTABLEbody
    \eTABLE
    \stopDetailTablesColumns

    \startDetailTablesColumns
    \StartFrame[width=\hsize]
    Another funny title

    Still with subtitle
    \StopFrame
    \DetailTablesColumns
    \bTABLE[align=right,option=stretch,split=repeat]
    \bTABLEhead
    \bTR
    \bTH A \eTH \bTH B \eTH \bTH C \eTH \bTH D \eTH
    \eTR
    \eTABLEhead
    \bTABLEbody
    \dorecurse{26}
    {
    \bTR
    \bTD 1 \eTD \bTD 2 \eTD \bTD 3 \eTD \bTD 4 \eTD
    \eTR
    }
    \eTABLEbody
    \eTABLE
    \stopDetailTablesColumns
    \startDetailTablesColumns
    \StartFrame[width=\hsize]
    Another funny title

    Still with subtitle
    \StopFrame
    \DetailTablesColumns
    \bTABLE[align=right,option=stretch]
    \bTABLEhead
    \bTR
    \bTH A \eTH \bTH B \eTH \bTH C \eTH \bTH D \eTH
    \eTR
    \eTABLEhead
    \bTABLEbody
    \dorecurse{24}
    {
    \bTR
    \bTD 1 \eTD \bTD 2 \eTD \bTD 3 \eTD \bTD 4 \eTD
    \eTR
    }
    \eTABLEbody
    \eTABLE
    \stopDetailTablesColumns

    \stoptext

I would want to be able to define my table only once, as this is dynamically generated. Any idea ?

I used paragraphs because that seemed to work, but I'm open to trying something else if needed.

closed as unclear what you're asking by Henri Menke, Mensch, Stefan Pinnow, Bobyandbob, TeXnician Jan 30 '18 at 7:53

Please clarify your specific problem or add additional details to highlight exactly what you need. As it's currently written, it’s hard to tell exactly what you're asking. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.

  • 1
    I'm not sure what you are asking. Your code seems to work just fine. Also this question is really old, so I'm voting to close as unclear. – Henri Menke Jan 30 '18 at 1:01

Browse other questions tagged or ask your own question.