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: How to place a (right) brace in a TABLE?
Date: Thu, 20 May 2010 13:04:15 +0200	[thread overview]
Message-ID: <4BF5172F.1020501@googlemail.com> (raw)
In-Reply-To: <20100520094532.GF11459@smoon2>

Am 20.05.10 11:45, schrieb Vladimir Lomov:
> Hi.
>
> (Sorry for unclear question in topic.)
>
> I want to put a brace (right or left isn't matter now) in a TABLE (may
> be another table environment) like in below scheme
>
> a11 a12| a13
> a21 a22| a23
> a31 a32  a33
> a41 a42  a43
> a51 a52| a53
> a61 a62| a63
>
> Here '|' marks place and elements which should be grouped by a brace.
>
> Thanks in advance, Vladimir Lomov.
>
> P.S. I'm new in context and don't have any idea how to achieve this. I
> thought about graphics (metapost) to draw a brace or join two cells and
> draw big brace. And, yes I use mkiv and latest beta (context minimal).

You can play with this:

\def\linkeklammer
   {\setbox\scratchbox\hbox{$\left\{\vrule height .5\vsize depth 
.5\vsize width 0pt\relax\right.$}%
    \rightaligned{\hbox to 
.5\wd\scratchbox{\raise\dp\scratchbox\box\scratchbox\hss}}}

\def\rechteklammer
   {\setbox\scratchbox\hbox{$\left.\vrule height .5\vsize depth .5\vsize 
width 0pt\relax\right\}$}%
    \leftaligned{\hbox to 
.5\wd\scratchbox{\hss\raise\dp\scratchbox\box\scratchbox}}}

\defineoverlay[linkeklammer] [\linkeklammer]
\defineoverlay[rechteklammer][\rechteklammer]

\starttext

\bTABLE
   \bTR[align={middle,middle},frame=off,offset=1ex]
     \bTD[background=linkeklammer] text \eTD
     \bTD text\\text\\text \eTD
     \bTD[background=rechteklammer] text \eTD
   \eTR
\eTABLE

\stoptext

and this:

\startuseMPgraphic{accolade}
z1  = (-233,0) ;
z2  = (-220,22) ;
z3  = (-155,211) ;
z4  = (-200,690) ;
z5  = (-142,1033) ;
z6  = (-97,1106) ;
z7  = (-71,1125) ;
z8  = (-61,1104) ;
z9  = (-80,1077) ;
z10 = (-108,1002) ;
z11 = (-129,666) ;
z12 = (-117,207) ;
z13 = (-197,19) ;
z14 = (-208,0) ;
z15 = (-197,-19) ;
z16 = (-117,-207) ;
z17 = (-129,-666) ;
z18 = (-108,-1026) ;
z19 = (-80,-1077) ;
z20 = (-61,-1104) ;
z21 = (-71,-1125) ;
z22 = (-97,-1106) ;
z23 = (-143,-1031) ;
z24 = (-199,-673) ;
z25 = (-155,-211) ;
z26 = (-220,-22) ;
fill z1 for i=2 upto 14: .. z[i] endfor & z14 for j=15 upto 26: .. z[j] 
endfor .. z1 & cycle ;
\stopuseMPgraphic

\defineoverlay[leftbrace] [\leftaligned 
{\scale[height=\overlayheight]{\useMPgraphic{accolade}}}]
\defineoverlay[rightbrace][\rightaligned{\mirror{\scale[height=\overlayheight]{\useMPgraphic{accolade}}}}] 


\starttext

\framedtext[frame=off,loffset=1em,roffset=1em,background={leftbrace,rightbrace}]{\input 
knuth\par}

\setupTABLE[frame=off,offset=1ex]
\setupTABLE[row][each][align={middle,lohi}]
\bTABLE
   \bTR
     \bTD[nr=3,background=leftbrace] drei \eTD
     \bTD[nr=2,background=leftbrace] zwei \eTD
     \bTD f \eTD
     \bTD o \eTD
     \bTD u \eTD
     \bTD r \eTD
     \bTD [nr=3,background=rightbrace] three \eTD
   \eTR
   \bTR
     \bTD [background=leftbrace] eins \eTD
     \bTD null \eTD
     \bTD [background=rightbrace] one \eTD
     \bTD [nr=2,background=rightbrace] two \eTD
   \eTR
   \bTR
     \bTD v \eTD
     \bTD i \eTD
     \bTD e \eTD
     \bTD r \eTD
   \eTR
\eTABLE

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


  reply	other threads:[~2010-05-20 11:04 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-05-20  9:45 Vladimir Lomov
2010-05-20 11:04 ` Wolfgang Schuster [this message]
2010-05-21  4:29   ` Vladimir Lomov

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=4BF5172F.1020501@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).