ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
* [NTG-context] Row span in tabulate
@ 2024-12-29  0:02 Jeong Dal via ntg-context
  2024-12-29  8:31 ` [NTG-context] " Florent Michel
  0 siblings, 1 reply; 5+ messages in thread
From: Jeong Dal via ntg-context @ 2024-12-29  0:02 UTC (permalink / raw)
  To: mailing list for ConTeXt users; +Cc: Jeong Dal


[-- Attachment #1.1: Type: text/plain, Size: 808 bytes --]

Sorry.
Here is a sample code.

Thank you.

Best regards,

Dalyoung




\startuseMPgraphic{recBox}{w,h,sx,sy,lColor}
  numeric u;    u := 1cm;
  draw unitsquare xyscaled (\MPvar{w}, \MPvar{h}) shifted (\MPvar{sx},\MPvar{sy}) withpen pencircle scaled 3pt withcolor \MPvar{lColor};
\stopuseMPgraphic
\defineoverlay
  [kBox]
  [\useMPgraphic{recBox}{w=2u,h=LineHeight+4pt, sx=.8u,sy=LineHeight-2pt,lColor=darkred}]

\starttext

\framed[frame=on,background=kBox]{
\starttable[|cw(.7cm)|cw(.7cm)|cw(1cm)|cw(1cm)|]
\HL
\NC  \NS[2][c] q          \NC\AR
\NC  p\NC    \NC 00 \NC 01\NC\AR
\HL
\NC 1 \NC 2   \NC 3 \NC 4\NC\AR
\NC 1 \NC 2   \NC 3 \NC 4\NC\AR
\NC 1 \NC 2   \NC 3 \NC 4\NC\AR
\NC 1 \NC 2   \NC 3 \NC 4\NC\AR
\NC 1 \NC 2   \NC 3 \NC 4\NC\AR
\HL
\stoptable
}
\stoptext


[-- Attachment #1.2: Type: text/html, Size: 7298 bytes --]

[-- Attachment #2: Type: text/plain, Size: 511 bytes --]

___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!

maillist : ntg-context@ntg.nl / https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl
webpage  : https://www.pragma-ade.nl / https://context.aanhet.net (mirror)
archive  : https://github.com/contextgarden/context
wiki     : https://wiki.contextgarden.net
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [NTG-context] Re: Row span in tabulate
  2024-12-29  0:02 [NTG-context] Row span in tabulate Jeong Dal via ntg-context
@ 2024-12-29  8:31 ` Florent Michel
  2024-12-29  9:58   ` Jeong Dal via ntg-context
  0 siblings, 1 reply; 5+ messages in thread
From: Florent Michel @ 2024-12-29  8:31 UTC (permalink / raw)
  To: mailing list for ConTeXt users


[-- Attachment #1.1: Type: text/plain, Size: 2583 bytes --]

Hi,

Not sure whether that's the best solution or not, but your example seems to
work on my side if I replace \starttable with
\starttabulate and \stoptable with \stoptabulate as follows:

_________________________________________________________________

\startuseMPgraphic{recBox}{w,h,sx,sy,lColor}
  numeric u;    u := 1cm;
  draw unitsquare xyscaled (\MPvar{w}, \MPvar{h}) shifted
(\MPvar{sx},\MPvar{sy}) withpen pencircle scaled 3pt withcolor
\MPvar{lColor};
\stopuseMPgraphic
\defineoverlay
  [kBox]
  [\useMPgraphic{recBox}{w=2u,h=LineHeight+4pt,
sx=.8u,sy=LineHeight-2pt,lColor=darkred}]

\starttext

\framed[frame=on,background=kBox]{
\starttabulate[|cw(.7cm)|cw(.7cm)|cw(1cm)|cw(1cm)|]
\HL
\NC  \NS[2][c] q          \NC\AR
\NC  p\NC    \NC 00 \NC 01\NC\AR
\HL
\NC 1 \NC 2   \NC 3 \NC 4\NC\AR
\NC 1 \NC 2   \NC 3 \NC 4\NC\AR
\NC 1 \NC 2   \NC 3 \NC 4\NC\AR
\NC 1 \NC 2   \NC 3 \NC 4\NC\AR
\NC 1 \NC 2   \NC 3 \NC 4\NC\AR
\HL
\stoptabulate
}
\stoptext
_________________________________________________________________

Best regards,
Florent


Le dim. 29 déc. 2024 à 00:04, Jeong Dal via ntg-context <ntg-context@ntg.nl>
a écrit :

> Sorry.
> Here is a sample code.
>
> Thank you.
>
> Best regards,
>
> Dalyoung
>
>
>
>
> \startuseMPgraphic{recBox}{w,h,sx,sy,lColor}
> numeric u; u := 1cm;
> draw unitsquare xyscaled (\MPvar{w}, \MPvar{h}) shifted (\MPvar{sx},\MPvar
> {sy}) withpen pencircle scaled 3pt withcolor \MPvar{lColor};
> \stopuseMPgraphic
> \defineoverlay
> [kBox]
> [\useMPgraphic{recBox}{w=2u,h=LineHeight+4pt, sx=.8u,sy=LineHeight-2pt,
> lColor=darkred}]
>
> \starttext
>
> \framed[frame=on,background=kBox]{
> \starttable[|cw(.7cm)|cw(.7cm)|cw(1cm)|cw(1cm)|]
> \HL
> \NC \NS[2][c] q \NC\AR
> \NC p\NC \NC 00 \NC 01\NC\AR
> \HL
> \NC 1 \NC 2 \NC 3 \NC 4\NC\AR
> \NC 1 \NC 2 \NC 3 \NC 4\NC\AR
> \NC 1 \NC 2 \NC 3 \NC 4\NC\AR
> \NC 1 \NC 2 \NC 3 \NC 4\NC\AR
> \NC 1 \NC 2 \NC 3 \NC 4\NC\AR
> \HL
> \stoptable
> }
> \stoptext
>
>
> ___________________________________________________________________________________
> If your question is of interest to others as well, please add an entry to
> the Wiki!
>
> maillist : ntg-context@ntg.nl /
> https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl
> webpage  : https://www.pragma-ade.nl / https://context.aanhet.net (mirror)
> archive  : https://github.com/contextgarden/context
> wiki     : https://wiki.contextgarden.net
>
> ___________________________________________________________________________________
>

[-- Attachment #1.2: Type: text/html, Size: 8108 bytes --]

[-- Attachment #2: Type: text/plain, Size: 511 bytes --]

___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!

maillist : ntg-context@ntg.nl / https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl
webpage  : https://www.pragma-ade.nl / https://context.aanhet.net (mirror)
archive  : https://github.com/contextgarden/context
wiki     : https://wiki.contextgarden.net
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [NTG-context] Re: Row span in tabulate
  2024-12-29  8:31 ` [NTG-context] " Florent Michel
@ 2024-12-29  9:58   ` Jeong Dal via ntg-context
  2024-12-29 11:07     ` Florent Michel
  0 siblings, 1 reply; 5+ messages in thread
From: Jeong Dal via ntg-context @ 2024-12-29  9:58 UTC (permalink / raw)
  To: mailing list for ConTeXt users; +Cc: Jeong Dal


[-- Attachment #1.1: Type: text/plain, Size: 1746 bytes --]

Dear Florent Michel,

Thank you for the checking.
As you said, using \starttabulate … \stoptabulate makes “[2][c]” disappear. 
But q is not at the center of the row.
There may be something more to do that I don’t know.

Thank you again.

Best regards,

Dalyoung



> 2024. 12. 29. 오후 5:31, Florent Michel <florent.m42@gmail.com> 작성:
> 
> Hi, 
> 
> Not sure whether that's the best solution or not, but your example seems to work on my side if I replace \starttable with \starttabulate and \stoptable with \stoptabulate as follows:
> 
> _________________________________________________________________
> 
> \startuseMPgraphic{recBox}{w,h,sx,sy,lColor}
>   numeric u;    u := 1cm;
>   draw unitsquare xyscaled (\MPvar{w}, \MPvar{h}) shifted (\MPvar{sx},\MPvar{sy}) withpen pencircle scaled 3pt withcolor \MPvar{lColor};
> \stopuseMPgraphic
> \defineoverlay
>   [kBox]
>   [\useMPgraphic{recBox}{w=2u,h=LineHeight+4pt, sx=.8u,sy=LineHeight-2pt,lColor=darkred}]
> 
> \starttext
> 
> \framed[frame=on,background=kBox]{
> \starttabulate[|cw(.7cm)|cw(.7cm)|cw(1cm)|cw(1cm)|]
> \HL
> \NC  \NS[2][c] q          \NC\AR
> \NC  p\NC    \NC 00 \NC 01\NC\AR
> \HL
> \NC 1 \NC 2   \NC 3 \NC 4\NC\AR
> \NC 1 \NC 2   \NC 3 \NC 4\NC\AR
> \NC 1 \NC 2   \NC 3 \NC 4\NC\AR
> \NC 1 \NC 2   \NC 3 \NC 4\NC\AR
> \NC 1 \NC 2   \NC 3 \NC 4\NC\AR
> \HL
> \stoptabulate
> }
> \stoptext
> _________________________________________________________________
> 
> Best regards,
> Florent
> 
> 
> Le dim. 29 déc. 2024 à 00:04, Jeong Dal via ntg-context <ntg-context@ntg.nl <mailto:ntg-context@ntg.nl>> a écrit :
> Sorry.
> Here is a sample code.
> 
> Thank you.
> 
> Best regards,
> 
> Dalyoung


[-- Attachment #1.2: Type: text/html, Size: 3431 bytes --]

[-- Attachment #2: Type: text/plain, Size: 511 bytes --]

___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!

maillist : ntg-context@ntg.nl / https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl
webpage  : https://www.pragma-ade.nl / https://context.aanhet.net (mirror)
archive  : https://github.com/contextgarden/context
wiki     : https://wiki.contextgarden.net
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [NTG-context] Re: Row span in tabulate
  2024-12-29  9:58   ` Jeong Dal via ntg-context
@ 2024-12-29 11:07     ` Florent Michel
  2024-12-29 18:32       ` Jeong Dal via ntg-context
  0 siblings, 1 reply; 5+ messages in thread
From: Florent Michel @ 2024-12-29 11:07 UTC (permalink / raw)
  To: mailing list for ConTeXt users


[-- Attachment #1.1: Type: text/plain, Size: 4061 bytes --]

Dear Dalyoung,

Ah, indeed you're right. Sorry about that!
After experimenting with the code a bit, it seems that centering does not
work if either the second or last column has a specified width. (I do not
know whether this is a bug or due to something I don't understand in how
tables work.)

I can see two possibilities:

* If that works for you, you can replace the line
    \starttabulate[|cw(0.7cm)|cw(0.7cm)|cw(1cm)|cw(1cm)|]
with
    \starttabulate[|cw(0.7cm)|c|cw(1cm)|c|]
(The MetaPost drawing may need to be adjusted.)

* If not, you may manually center the title using e.g. the \offset command
as shown below. (I presume there is a way to compute the correct offset
from the column widths and write a macro to avoid having to fine-tune it by
hand.)

____________________________________________
\startuseMPgraphic{recBox}{w,h,sx,sy,lColor}
  numeric u;    u := 1cm;
  draw unitsquare xyscaled (\MPvar{w}, \MPvar{h}) shifted
(\MPvar{sx},\MPvar{sy}) withpen pencircle scaled 3pt withcolor
\MPvar{lColor};
\stopuseMPgraphic
\defineoverlay
  [kBox]
  [\useMPgraphic{recBox}{w=2u,h=LineHeight+4pt,
sx=.8u,sy=LineHeight-2pt,lColor=darkred}]

\starttext

\framed[frame=on,background=kBox]{
\starttabulate[|cw(0.7cm)|cw(0.7cm)|cw(1cm)|cw(1cm)|]
\HL
\NC  \NS[2] \offset[x=1.15cm]{q} \NC\AR
\NC  p\NC    \NC 00 \NC 01\NC\AR
\HL
\NC 1 \NC 2   \NC 3 \NC 4\NC\AR
\NC 1 \NC 2   \NC 3 \NC 4\NC\AR
\NC 1 \NC 2   \NC 3 \NC 4\NC\AR
\NC 1 \NC 2   \NC 3 \NC 4\NC\AR
\NC 1 \NC 2   \NC 3 \NC 4\NC\AR
\HL
\stoptabulate
}
\stoptext
_____________________________________________________

Best regards,
Florent

Le dim. 29 déc. 2024 à 09:58, Jeong Dal via ntg-context <ntg-context@ntg.nl>
a écrit :

> Dear Florent Michel,
>
> Thank you for the checking.
> As you said, using \starttabulate … \stoptabulate makes “[2][c]”
> disappear.
> But q is not at the center of the row.
> There may be something more to do that I don’t know.
>
> Thank you again.
>
> Best regards,
>
> Dalyoung
>
>
>
> 2024. 12. 29. 오후 5:31, Florent Michel <florent.m42@gmail.com> 작성:
>
> Hi,
>
> Not sure whether that's the best solution or not, but your example seems
> to work on my side if I replace \starttable with
> \starttabulate and \stoptable with \stoptabulate as follows:
>
> _________________________________________________________________
>
> \startuseMPgraphic{recBox}{w,h,sx,sy,lColor}
>   numeric u;    u := 1cm;
>   draw unitsquare xyscaled (\MPvar{w}, \MPvar{h}) shifted
> (\MPvar{sx},\MPvar{sy}) withpen pencircle scaled 3pt withcolor
> \MPvar{lColor};
> \stopuseMPgraphic
> \defineoverlay
>   [kBox]
>   [\useMPgraphic{recBox}{w=2u,h=LineHeight+4pt,
> sx=.8u,sy=LineHeight-2pt,lColor=darkred}]
>
> \starttext
>
> \framed[frame=on,background=kBox]{
> \starttabulate[|cw(.7cm)|cw(.7cm)|cw(1cm)|cw(1cm)|]
> \HL
> \NC  \NS[2][c] q          \NC\AR
> \NC  p\NC    \NC 00 \NC 01\NC\AR
> \HL
> \NC 1 \NC 2   \NC 3 \NC 4\NC\AR
> \NC 1 \NC 2   \NC 3 \NC 4\NC\AR
> \NC 1 \NC 2   \NC 3 \NC 4\NC\AR
> \NC 1 \NC 2   \NC 3 \NC 4\NC\AR
> \NC 1 \NC 2   \NC 3 \NC 4\NC\AR
> \HL
> \stoptabulate
> }
> \stoptext
> _________________________________________________________________
>
> Best regards,
> Florent
>
>
> Le dim. 29 déc. 2024 à 00:04, Jeong Dal via ntg-context <
> ntg-context@ntg.nl> a écrit :
>
>> Sorry.
>> Here is a sample code.
>>
>> Thank you.
>>
>> Best regards,
>>
>> Dalyoung
>>
>
>
> ___________________________________________________________________________________
> If your question is of interest to others as well, please add an entry to
> the Wiki!
>
> maillist : ntg-context@ntg.nl /
> https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl
> webpage  : https://www.pragma-ade.nl / https://context.aanhet.net (mirror)
> archive  : https://github.com/contextgarden/context
> wiki     : https://wiki.contextgarden.net
>
> ___________________________________________________________________________________
>

[-- Attachment #1.2: Type: text/html, Size: 5610 bytes --]

[-- Attachment #2: Type: text/plain, Size: 511 bytes --]

___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!

maillist : ntg-context@ntg.nl / https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl
webpage  : https://www.pragma-ade.nl / https://context.aanhet.net (mirror)
archive  : https://github.com/contextgarden/context
wiki     : https://wiki.contextgarden.net
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [NTG-context] Re: Row span in tabulate
  2024-12-29 11:07     ` Florent Michel
@ 2024-12-29 18:32       ` Jeong Dal via ntg-context
  0 siblings, 0 replies; 5+ messages in thread
From: Jeong Dal via ntg-context @ 2024-12-29 18:32 UTC (permalink / raw)
  To: mailing list for ConTeXt users; +Cc: Jeong Dal


[-- Attachment #1.1: Type: text/plain, Size: 5246 bytes --]

Dear Florent Michel,

Your code is closer to what I want when I need to change some numbers.

Thank you so much.

Best regards,

Dalyoung



> 2024. 12. 29. 오후 8:07, Florent Michel <florent.m42@gmail.com> 작성:
> 
> Dear Dalyoung,
> 
> Ah, indeed you're right. Sorry about that! 
> After experimenting with the code a bit, it seems that centering does not work if either the second or last column has a specified width. (I do not know whether this is a bug or due to something I don't understand in how tables work.)
> 
> I can see two possibilities: 
> 
> * If that works for you, you can replace the line
>     \starttabulate[|cw(0.7cm)|cw(0.7cm)|cw(1cm)|cw(1cm)|]
> with 
>     \starttabulate[|cw(0.7cm)|c|cw(1cm)|c|]
> (The MetaPost drawing may need to be adjusted.)
> 
> * If not, you may manually center the title using e.g. the \offset command as shown below. (I presume there is a way to compute the correct offset from the column widths and write a macro to avoid having to fine-tune it by hand.)
> 
> ____________________________________________
> \startuseMPgraphic{recBox}{w,h,sx,sy,lColor}
>   numeric u;    u := 1cm;
>   draw unitsquare xyscaled (\MPvar{w}, \MPvar{h}) shifted (\MPvar{sx},\MPvar{sy}) withpen pencircle scaled 3pt withcolor \MPvar{lColor};
> \stopuseMPgraphic
> \defineoverlay
>   [kBox]
>   [\useMPgraphic{recBox}{w=2u,h=LineHeight+4pt, sx=.8u,sy=LineHeight-2pt,lColor=darkred}]
> 
> \starttext
> 
> \framed[frame=on,background=kBox]{
> \starttabulate[|cw(0.7cm)|cw(0.7cm)|cw(1cm)|cw(1cm)|]
> \HL
> \NC  \NS[2] \offset[x=1.15cm]{q} \NC\AR
> \NC  p\NC    \NC 00 \NC 01\NC\AR
> \HL
> \NC 1 \NC 2   \NC 3 \NC 4\NC\AR
> \NC 1 \NC 2   \NC 3 \NC 4\NC\AR
> \NC 1 \NC 2   \NC 3 \NC 4\NC\AR
> \NC 1 \NC 2   \NC 3 \NC 4\NC\AR
> \NC 1 \NC 2   \NC 3 \NC 4\NC\AR
> \HL
> \stoptabulate
> }
> \stoptext
> _____________________________________________________
> 
> Best regards,
> Florent
> 
> Le dim. 29 déc. 2024 à 09:58, Jeong Dal via ntg-context <ntg-context@ntg.nl <mailto:ntg-context@ntg.nl>> a écrit :
> Dear Florent Michel,
> 
> Thank you for the checking.
> As you said, using \starttabulate … \stoptabulate makes “[2][c]” disappear. 
> But q is not at the center of the row.
> There may be something more to do that I don’t know.
> 
> Thank you again.
> 
> Best regards,
> 
> Dalyoung
> 
> 
> 
>> 2024. 12. 29. 오후 5:31, Florent Michel <florent.m42@gmail.com <mailto:florent.m42@gmail.com>> 작성:
>> 
>> Hi, 
>> 
>> Not sure whether that's the best solution or not, but your example seems to work on my side if I replace \starttable with \starttabulate and \stoptable with \stoptabulate as follows:
>> 
>> _________________________________________________________________
>> 
>> \startuseMPgraphic{recBox}{w,h,sx,sy,lColor}
>>   numeric u;    u := 1cm;
>>   draw unitsquare xyscaled (\MPvar{w}, \MPvar{h}) shifted (\MPvar{sx},\MPvar{sy}) withpen pencircle scaled 3pt withcolor \MPvar{lColor};
>> \stopuseMPgraphic
>> \defineoverlay
>>   [kBox]
>>   [\useMPgraphic{recBox}{w=2u,h=LineHeight+4pt, sx=.8u,sy=LineHeight-2pt,lColor=darkred}]
>> 
>> \starttext
>> 
>> \framed[frame=on,background=kBox]{
>> \starttabulate[|cw(.7cm)|cw(.7cm)|cw(1cm)|cw(1cm)|]
>> \HL
>> \NC  \NS[2][c] q          \NC\AR
>> \NC  p\NC    \NC 00 \NC 01\NC\AR
>> \HL
>> \NC 1 \NC 2   \NC 3 \NC 4\NC\AR
>> \NC 1 \NC 2   \NC 3 \NC 4\NC\AR
>> \NC 1 \NC 2   \NC 3 \NC 4\NC\AR
>> \NC 1 \NC 2   \NC 3 \NC 4\NC\AR
>> \NC 1 \NC 2   \NC 3 \NC 4\NC\AR
>> \HL
>> \stoptabulate
>> }
>> \stoptext
>> _________________________________________________________________
>> 
>> Best regards,
>> Florent
>> 
>> 
>> Le dim. 29 déc. 2024 à 00:04, Jeong Dal via ntg-context <ntg-context@ntg.nl <mailto:ntg-context@ntg.nl>> a écrit :
>> Sorry.
>> Here is a sample code.
>> 
>> Thank you.
>> 
>> Best regards,
>> 
>> Dalyoung
> 
> ___________________________________________________________________________________
> If your question is of interest to others as well, please add an entry to the Wiki!
> 
> maillist : ntg-context@ntg.nl <mailto:ntg-context@ntg.nl> / https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl <https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl>
> webpage  : https://www.pragma-ade.nl <https://www.pragma-ade.nl/> / https://context.aanhet.net <https://context.aanhet.net/> (mirror)
> archive  : https://github.com/contextgarden/context <https://github.com/contextgarden/context>
> wiki     : https://wiki.contextgarden.net <https://wiki.contextgarden.net/>
> ___________________________________________________________________________________
> ___________________________________________________________________________________
> If your question is of interest to others as well, please add an entry to the Wiki!
> 
> maillist : ntg-context@ntg.nl / https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl
> webpage  : https://www.pragma-ade.nl / https://context.aanhet.net (mirror)
> archive  : https://github.com/contextgarden/context
> wiki     : https://wiki.contextgarden.net
> ___________________________________________________________________________________


[-- Attachment #1.2: Type: text/html, Size: 9011 bytes --]

[-- Attachment #2: Type: text/plain, Size: 511 bytes --]

___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!

maillist : ntg-context@ntg.nl / https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl
webpage  : https://www.pragma-ade.nl / https://context.aanhet.net (mirror)
archive  : https://github.com/contextgarden/context
wiki     : https://wiki.contextgarden.net
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2024-12-29 18:34 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-12-29  0:02 [NTG-context] Row span in tabulate Jeong Dal via ntg-context
2024-12-29  8:31 ` [NTG-context] " Florent Michel
2024-12-29  9:58   ` Jeong Dal via ntg-context
2024-12-29 11:07     ` Florent Michel
2024-12-29 18:32       ` Jeong Dal via ntg-context

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).