ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
From: Wolfgang Schuster <schuster.wolfgang@googlemail.com>
To: mailing list for ConTeXt users <ntg-context@ntg.nl>
Subject: Re: Natural Tables Cell Borders
Date: Wed, 6 Jan 2010 12:54:23 +0100	[thread overview]
Message-ID: <301282A4-11B3-416F-BFB0-818BFB2B1A2D@googlemail.com> (raw)
In-Reply-To: <3b4b12311001041902w306989eeta83f62963ee31564@mail.gmail.com>


Am 05.01.2010 um 04:02 schrieb Curiouslearn:

> Thanks Wolfgang. I am not yet proficient enough in Metapost or Context
> to understand your code. But will look at it more carefully later.
> 
> Meanwhile, is there any further work going on on Natural Tables? Are
> there plans to introduce the ability to have borders of different
> thickness for the same cell through simple options.


A TeX based solution won't be possible without Hans but you can set
the values in TeX (\framed, \setupTABLE) and use them in MetaPost.

The following example show you what can be done.

\unprotect

\startuseMPgraphic{tableborder}

%linecap := butt ;

numeric FrameOffset, LeftRuleThickness, RightRuleThickness, TopRuleThickness, BottomRuleThickness ;

FrameOffset         := \frameddimension{frameoffset}         ;
LeftRuleThickness   := \frameddimension{leftrulethickness}   ;
RightRuleThickness  := \frameddimension{rightrulethickness}  ;
TopRuleThickness    := \frameddimension{toprulethickness}    ;
BottomRuleThickness := \frameddimension{bottomrulethickness} ;

pair lt, rt, lb, rb ;

lt = (FrameOffset/2,OverlayHeight-FrameOffset/2) ;
rt = (OverlayWidth-FrameOffset/2,OverlayHeight-FrameOffset/2) ;
lb = (FrameOffset/2,FrameOffset/2) ;
rb = (OverlayWidth-FrameOffset/2,FrameOffset/2) ;

draw lt--rt withpen pencircle scaled TopRuleThickness    ;
draw lb--rb withpen pencircle scaled BottomRuleThickness ;
draw lb--lt withpen pencircle scaled LeftRuleThickness   ;
draw rb--rt withpen pencircle scaled RightRuleThickness  ;

setbounds currentpicture to OverlayBox ;

\stopuseMPgraphic

\defineoverlay
  [tableborder]
  [%\edef\topframeparameter   {\framedparameter\c!topframe   }%
   %\edef\bottomframeparameter{\framedparameter\c!bottomframe}%
   %\edef\leftframeparameter  {\framedparameter\c!leftframe  }%
   %\edef\rightframeparameter {\framedparameter\c!rightframe }%
   \useMPgraphic{tableborder}]

\setupTABLE
  [   toprulethickness=\framedparameter{rulethickness},
   bottomrulethickness=\framedparameter{rulethickness},
     leftrulethickness=\framedparameter{rulethickness},
    rightrulethickness=\framedparameter{rulethickness},
%              topframe=on,
%           bottomframe=on,
%             leftframe=on,
%            rightframe=on,
            background=tableborder,
                 frame=off]

\protect

\starttext

\start

\setupTABLE[y][1][bottomrulethickness=2pt]
\setupTABLE[3][3][bottomrulethickness=2pt,rightrulethickness=2pt]
\setupTABLE[1][3][bottomframe=off]

\bTABLE
    \bTR
        \bTD 1 \eTD
        \bTD 2 \eTD
        \bTD 3 \eTD
    \eTR
    \bTR
        \bTD 4 \eTD
        \bTD 5 \eTD
        \bTD 6 \eTD
    \eTR
    \bTR
        \bTD 7 \eTD
        \bTD 8 \eTD
        \bTD 9 \eTD
    \eTR
\eTABLE

\stop

\stoptext

Wolfgang

___________________________________________________________________________________
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
___________________________________________________________________________________


  parent reply	other threads:[~2010-01-06 11:54 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-12-31 22:04 Curiouslearn
2010-01-04 16:55 ` Wolfgang Schuster
2010-01-05  3:02   ` Curiouslearn
2010-01-05  8:48     ` Hans Hagen
2010-01-06 11:54     ` Wolfgang Schuster [this message]
2010-01-06 17:07       ` Curiouslearn

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=301282A4-11B3-416F-BFB0-818BFB2B1A2D@googlemail.com \
    --to=schuster.wolfgang@googlemail.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).