ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
From: Vladimir Lomov <lomov.vl@gmail.com>
To: mailing list for ConTeXt users <ntg-context@ntg.nl>
Subject: Re: How to place a (right) brace in a TABLE?
Date: Fri, 21 May 2010 13:29:49 +0900	[thread overview]
Message-ID: <20100521042949.GG11459@smoon2> (raw)
In-Reply-To: <4BF5172F.1020501@googlemail.com>

[-- Attachment #1: Type: text/plain, Size: 4178 bytes --]

** Wolfgang Schuster [2010-05-20 13:04:15 +0200]:

'>'  = Wolfgang Schuster
'>>' = 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

Thank you Wolfgang for examples. Now I got idea of background. Nice.

But actually I want something different. I couldn't describe this more
clearly than before so I attach PDF file that shows what I want to do.
(I made it with the help of asymptote: first I made a table in LaTeX,
then the table was put in background and after braces and letters were
placed on top of the table.)

I thought may be there is context (mkiv) way to do this, i.e. one
could specify which rows in a column to be grouped and what symbol will
be put after a brace.

If there is no simple (elegant, context-way?) solution then I have to
use "non-elegant" (imho, ugly) way: add an additional column with brace
and symbol.

---
WBR, Vladimir Lomov.

P.S. I'm impressed how you made a brace in metapost. I alway wonder how
people could write numbers that gives a nice figure (may be by triali
and error?).

-- 
The reason that every major university maintains a department of
mathematics is that it's cheaper than institutionalizing all those people.

[-- Attachment #2: smp.pdf --]
[-- Type: application/pdf, Size: 10568 bytes --]

[-- Attachment #3: Type: text/plain, Size: 486 bytes --]

___________________________________________________________________________________
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-21  4:29 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
2010-05-21  4:29   ` Vladimir Lomov [this message]

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=20100521042949.GG11459@smoon2 \
    --to=lomov.vl@gmail.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).