TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I am struggling with my table formatting a bit and hope there is someone around here that can give me some help.

This is the table I have at the moment.

        \bTR \bTD No. \eTD \bTD[nc=2] Length              \eTD \eTR
        \bTR \bTD               \bTD [m] \eTD \bTD [inch] \eTD \eTR
        \bTR \bTD 1.  \eTD \bTD 1        \eTD \bTD 25.4   \eTD \eTR

now I want a rule on top of the first row and on the bottom of the second row. That's simple enough only I would like to do this by using something like this


This way I can use this setup on all the tables in my document.

Can this be done?

share|improve this question

\setupTABLE{header] does not accept first or last keys. You can only use \setupTABLE[header][1] etc, but that sets the style for the 1st column of the header. Currently, there is no way to set the style of the rows of the table header.

However, it is easy to define your own Metapost background that adds topframe and bottomframe to the table header and works with multipage tables.

\setupTABLE[header][each][background=tableheader, framecolor=darkblue, rulethickness=2bp]


    if \positiverow = 1 : % first row
        draw topboundary OverlayBox 
    elseif \positiverow = \noftblheadlines : % last row
        draw bottomboundary OverlayBox
        withcolor OverlayLineColor
        withpen pensquare scaled OverlayLineWidth;

    setbounds currentpicture to OverlayBox;

        \bTR \bTD No. \eTD \bTD[nc=2] Length         \eTD \eTR
        \bTR \bTD     \eTD \bTD{} [m] \eTD \bTD{} [inch] \eTD \eTR
        {\bTR \bTD 1.  \eTD \bTD 1        \eTD \bTD 25.4   \eTD \eTR}

enter image description here

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.