Hello,
I am making progress and I almost get what I want to achieve but I still
have two problems :
how to color cells not containing numbers with the same color as the others
?
how to color in salmon, for example, cells 1 2  ?
                                                                     3
Thank you
Fabrice

\usecolors[X11]

\startuseMPgraphic{DiagonalRule}
  rulethickness := \frameddimension{rulethickness};

  drawoptions(
    withpen pencircle scaled rulethickness
    withcolor \MPcolor{\framedparameter{framecolor}});

  pair leftcorner, rightcorner;
  leftcorner  := (rulethickness, \overlayheight-rulethickness);
  rightcorner := (\overlaywidth-rulethickness, rulethickness);

  draw leftcorner -- rightcorner;
\stopuseMPgraphic

\defineoverlay
  [DiagonalRule]
  [\useMPgraphic{DiagonalRule}]

\define[2]\DiagonalLabel{%
  \setuptabulate [after={\blank[\frameddimension{offset}]}]
  \starttabulate [|p|r|]
    \NC    \NC #2 \NC\NR
    \NC #1 \NC    \NC\NR
  \stoptabulate
}


\starttext
\startluacode
   function Binom(n,k)
        if k > n then
             return ""
        elseif (n == 0 or k == 0) then
             return 1
        else
             return math.round((n*Binom(n-1,k-1))/k)
        end
      end
  context.startxtable({"align={middle,lohi},
width=1cm,offset=0.8ex,bodyfont=9pt,framecolor=cyan"})
  context.startxrow()

context.startxcell({"background=DiagonalRule,background=color,backgroundcolor=thistle2"})
  context("\\DiagonalLabel{\\m{n}}{\\m{k}}")
  context.stopxcell()
  for j = 0, 7 do
  context.startxcell({"background=color,backgroundcolor=thistle2"})
  context(j)
  context.stopxcell()
  end
  context.startxcell({"background=color,backgroundcolor=thistle2"})
  context("\\dots")
  context.stopxcell()
  context.stopxrow()
  for i = 0, 7 do
  context.startxrow()
  context.startxcell({"background=color,backgroundcolor=thistle2"})
  context(i)
  context.stopxcell()
  for j = 0, 8 do
  context.startxcell()
  context(Binom(i,j))
  context.stopxcell()
  end
  context.stopxrow()
  end
  context.startxrow()
  context.startxcell({"background=color,backgroundcolor=thistle2"})
  context("\\dots")
  context.stopxcell()
  for i = 0, 8 do
  context.startxcell({"background=color,backgroundcolor=thistle2"})
  context("")
  context.stopxcell()
  end
  context.stopxrow()
  context.stopxtable()
\stopluacode
\stoptext

Le lun. 20 juil. 2020 à 14:55, Hans Hagen <j.ha...@xs4all.nl> a écrit :

> On 7/20/2020 2:40 PM, Jeong Dal wrote:
>
> > I also wonder where is the boundary of ConTeXt.
> The boundaries are set and shift by users (the mailing list) and
> curiosity (personal).
>
> Hans
>
> -----------------------------------------------------------------
>                                            Hans Hagen | PRAGMA ADE
>                Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
>         tel: 038 477 53 69 | www.pragma-ade.nl | www.pragma-pod.nl
> -----------------------------------------------------------------
>
> ___________________________________________________________________________________
> 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://context.aanhet.net
> archive  : https://bitbucket.org/phg/context-mirror/commits/
> wiki     : http://contextgarden.net
>
> ___________________________________________________________________________________
>
___________________________________________________________________________________
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://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki     : http://contextgarden.net
___________________________________________________________________________________

Reply via email to