Am 16.09.25 um 18:36 schrieb Matthias Weber:
Dear All (a last question for today…)


I am following the example from the wiki at https:// wiki.contextgarden.net/Tables/Natural_tables_with_TABLE#Diagonal_rules <https://wiki.contextgarden.net/Tables/ Natural_tables_with_TABLE#Diagonal_rules>
The first part is just copied, and works fine.

I would like the cells to be perfect squares, which is why I added \setupTABLE [start] [width=.8cm, height=.8cm]. That works, too, but the letter a from the diagonal label is now in the second row. I don’t know whether I need to modify the definition of
DiagonalLabel, or my setupTABLE isn’t right.

Thanks (again, and again, and again)!

– You don’t want to use dollar notation for math anymore.
– In this case, declare the tabulate columns as inline math.
– I had to use a fixed width for the tabulate columns to get the right distances.
– Getting rid of the tabulate is even better.


\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 [distance=none,]
  \setupinterlinespace[2ex]
  \starttabulate [|mw(.2em)|mw(.2em)|]
    \NC    \NC #2 \NC\NR
    \NC #1 \NC    \NC\NR
  \stoptabulate
}

% or

\define[2]\DiagonalLabel{%
  \setupinterlinespace[1.9ex]
  \hfill\im{#2}\\
  \im{#1}
}



\starttext

\setupTABLE [start] [width=.8cm, height=.8cm]
\bTABLE
    \bTR
      \bTD [background=DiagonalRule]
        \DiagonalLabel{a}{b}
      \eTD
      \bTD 0 \eTD
      \bTD 1 \eTD
    \eTR
    \bTR
      \bTD 0 \eTD
      \bTD 1  \eTD
      \bTD 2  \eTD
    \eTR
      \bTR
      \bTD 2 \eTD
      \bTD 2  \eTD
      \bTD 2 \eTD
    \eTR
  \eTABLE

\stoptext


Hraban

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

maillist : [email protected] / 
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
___________________________________________________________________________________

Reply via email to