ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
* Table generator : Issues with borders and rotated cells
@ 2018-06-19  1:26 Xavier Dionne
  2018-06-27  8:50 ` Wolfgang Schuster
  0 siblings, 1 reply; 2+ messages in thread
From: Xavier Dionne @ 2018-06-19  1:26 UTC (permalink / raw)
  To: ntg-context


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

Hi everyone,

Excuse my poor English. I recently updated my online table generator (http://latex-tables.com) to support ConTeXt. It also supports many languages, like LaTeX, Plain TeX, Markdown, HTML and more. It uses the eXtreme table format and supports many features including :
- Borders, border width and border color
- Merged cells
- Background color
- Alignment (flushleft, center, flushright)
- Splitted tables
- Rotated tables
- Caption
- More...

However, I have many issues that I have trouble to fix.

1/ I have many troubles with borders, because I can't set the color and the width of each border. Instead, I use "fake rows" and "fake cells" when it is necessary. However, I can't figure out how to set the height of a row to 0.4pt. It's always bigger. So, instead I use "location=hanging" on this row but, because of this, borders are hidden behind the next row's background. What can I do about this ?

MWE without background color :

\definecolor[Siren][r=0.502,g=0,b=0.251]
\definecolor[Rose][r=1,g=0,b=0.502]
\definecolor[FlushOrange][r=1,g=0.502,b=0]
\definecolor[ElectricViolet][r=0.502,g=0,b=1]
\definecolor[Chartreuse][r=0.502,g=1,b=0]
\definecolor[BlushPink][r=1,g=0.502,b=1]
\placetable[none]{}{
  \startxtable[align=lohi,framecolor=Siren,frame=off,leftframe=on,rightframe=on]
    \startxrow[offset=overlay,location=hanging,topframe=on]
      \startxcell\stopxcell
      \startxcell[framecolor=Rose]\stopxcell
    \stopxrow
    \startxrow
      \startxcell[rightframe=off,framecolor=cyan] A\stopxcell
      \startxcell[rightframe=off,framecolor=FlushOrange] B\stopxcell
      \startxcell[width=0pt,framecolor=ElectricViolet]\stopxcell
    \stopxrow
    \startxrow[offset=overlay,location=hanging,topframe=on,framecolor=Chartreuse]
      \startxcell\stopxcell
      \startxcell[framecolor=BlushPink]\stopxcell
    \stopxrow
  \stopxtable
}

MWE with background color

\definecolor[Siren][r=0.502,g=0,b=0.251]
\definecolor[Rose][r=1,g=0,b=0.502]
\definecolor[FlushOrange][r=1,g=0.502,b=0]
\definecolor[ElectricViolet][r=0.502,g=0,b=1]
\definecolor[Chartreuse][r=0.502,g=1,b=0]
\definecolor[BlushPink][r=1,g=0.502,b=1]
\definecolor[Dolly][r=1,g=1,b=0.502]
\placetable[none]{}{
  \startxtable[align=lohi,background=color,backgroundcolor=Dolly,framecolor=Siren,frame=off,leftframe=on,rightframe=on]
    \startxrow[offset=overlay,location=hanging,topframe=on,background=none]
      \startxcell\stopxcell
      \startxcell[framecolor=Rose]\stopxcell
    \stopxrow
    \startxrow
      \startxcell[rightframe=off,framecolor=cyan] A\stopxcell
      \startxcell[rightframe=off,framecolor=FlushOrange] B\stopxcell
      \startxcell[width=0pt,framecolor=ElectricViolet]\stopxcell
    \stopxrow
    \startxrow[offset=overlay,location=hanging,topframe=on,framecolor=Chartreuse]
      \startxcell\stopxcell
      \startxcell[framecolor=BlushPink]\stopxcell
    \stopxrow
  \stopxtable
}

2/ I have trouble with rotated cells. It seems to affect the width of the table. How can I use a rotated cell without setting manually a fixed width.

MWE :

\placetable[none]{}{
  \startxtable[align=lohi]
    \startxrow
      \startxcell \rotate[rotation=90]{Test test test}\stopxcell
      \startxcell Test\stopxcell
    \stopxrow
    \startxrow
      \startxcell Test\stopxcell
      \startxcell Test\stopxcell
    \stopxrow
  \stopxtable
}

Thank you !

- X.D.

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

[-- Attachment #2: Type: text/plain, Size: 492 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://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki     : http://contextgarden.net
___________________________________________________________________________________

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

* Re: Table generator : Issues with borders and rotated cells
  2018-06-19  1:26 Table generator : Issues with borders and rotated cells Xavier Dionne
@ 2018-06-27  8:50 ` Wolfgang Schuster
  0 siblings, 0 replies; 2+ messages in thread
From: Wolfgang Schuster @ 2018-06-27  8:50 UTC (permalink / raw)
  To: mailing list for ConTeXt users; +Cc: Xavier Dionne


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


> Xavier Dionne <mailto:xavier.dionne@hotmail.com>
> 19. Juni 2018 um 03:26
>
> Hi everyone,
>
> Excuse my poor English. I recently updated my online table generator 
> (http://latex-tables.com) to support ConTeXt. It also supports many 
> languages, like LaTeX, Plain TeX, Markdown, HTML and more. It uses the 
> eXtreme table format and supports many features including :
>
> - Borders, border width and border color
>
> - Merged cells
>
> - Background color
>
> - Alignment (flushleft, center, flushright)
>
> - Splitted tables
>
> - Rotated tables
>
> - Caption
>
> - More...
>
> However, I have many issues that I have trouble to fix.
>
> 1/ I have many troubles with borders, because I can't set the color 
> and the width of each border. Instead, I use "fake rows" and "fake 
> cells" when it is necessary. However, I can't figure out how to set 
> the height of a row to 0.4pt. It's always bigger. So, instead I use 
> "location=hanging" on this row but, because of this, borders are 
> hidden behind the next row's background. What can I do about this ?
>

Frames accept only a single color and line thickness for all borders but 
there are two ways to set different values for each side The first 
method is to disable the frame and apply a background graphic where you 
draw different lines for each side. The other method is to create a 
custom renderer for each frame (top, bottom etc.) where you can than 
apply a different color or linewidth for each side, below (and also 
attached) is a example where I show how this can be done.

Wolfgang


%%%% begin meta-imp-mpframe.mkiv
\startuseMPgraphic{mp_frame_left}
   draw leftboundary OverlayBox
     withpen pensquare scaled \frameddimension{leftrulethickness}
     withcolor \MPcolor{\framedparameter{leftframecolor}} ;
   setbounds currentpicture to OverlayBox ;
\stopuseMPgraphic

\startuseMPgraphic{mp_frame_right}
   draw rightboundary OverlayBox
     withpen pensquare scaled \frameddimension{rightrulethickness}
     withcolor \MPcolor{\framedparameter{rightframecolor}} ;
   setbounds currentpicture to OverlayBox ;
\stopuseMPgraphic

\startuseMPgraphic{mp_frame_top}
   draw topboundary OverlayBox
     withpen pensquare scaled \frameddimension{toprulethickness}
     withcolor \MPcolor{\framedparameter{topframecolor}} ;
   setbounds currentpicture to OverlayBox ;
\stopuseMPgraphic

\startuseMPgraphic{mp_frame_bottom}
   draw bottomboundary OverlayBox
     withpen pensquare scaled \frameddimension{bottomrulethickness}
     withcolor \MPcolor{\framedparameter{bottomframecolor}} ;
   setbounds currentpicture to OverlayBox ;
\stopuseMPgraphic

\installleftframerenderer   {mp} {\useMPgraphic{mp_frame_left}}
\installrightframerenderer  {mp} {\useMPgraphic{mp_frame_right}}
\installtopframerenderer    {mp} {\useMPgraphic{mp_frame_top}}
\installbottomframerenderer {mp} {\useMPgraphic{mp_frame_bottom}}

\setupframed
   [     leftframecolor=\framedparameter{framecolor},
        rightframecolor=\framedparameter{framecolor},
          topframecolor=\framedparameter{framecolor},
       bottomframecolor=\framedparameter{framecolor},
      leftrulethickness=\framedparameter{rulethickness},
     rightrulethickness=\framedparameter{rulethickness},
       toprulethickness=\framedparameter{rulethickness},
    bottomrulethickness=\framedparameter{rulethickness}]

\endinput
%%%% end meta-imp-mpframe.mkiv


%%%% begin mpframe.tex
\useMPlibrary[mpframe]

\definextable
   [mp]
   [width=2cm,
    height=2cm,
    align={middle,lohi},
    foregroundstyle=\ssd,
    framecolor=red,
    % use the custom frame renderer for all four sides:
    leftframe=mp,
    rightframe=mp,
    topframe=mp,
    bottomframe=mp]

\starttext

\startxtable[mp]
     \startxrow[bottomrulethickness=2pt]
         \startxcell[rightframecolor=blue]
             A
         \stopxcell
         \startxcell[leftframe=off]
             B
         \stopxcell
     \stopxrow
     \startxrow
         \startxcell[leftframecolor=green,leftrulethickness=2pt]
             C
         \stopxcell
         \startxcell[rightframecolor=orange,rightrulethickness=2pt]
             D
         \stopxcell
     \stopxrow
\stopxtable

\stoptext
%%%% end mpframe.tex


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

[-- Attachment #2: meta-imp-mpframe.mkiv --]
[-- Type: text/plain, Size: 1735 bytes --]

\startuseMPgraphic{mp_frame_left}
  draw leftboundary OverlayBox 
    withpen pensquare scaled \frameddimension{leftrulethickness}
    withcolor \MPcolor{\framedparameter{leftframecolor}} ;
  setbounds currentpicture to OverlayBox ;
\stopuseMPgraphic

\startuseMPgraphic{mp_frame_right}
  draw rightboundary OverlayBox 
    withpen pensquare scaled \frameddimension{rightrulethickness}
    withcolor \MPcolor{\framedparameter{rightframecolor}} ;
  setbounds currentpicture to OverlayBox ;
\stopuseMPgraphic

\startuseMPgraphic{mp_frame_top}
  draw topboundary OverlayBox 
    withpen pensquare scaled \frameddimension{toprulethickness}
    withcolor \MPcolor{\framedparameter{topframecolor}} ;
  setbounds currentpicture to OverlayBox ;
\stopuseMPgraphic

\startuseMPgraphic{mp_frame_bottom}
  draw bottomboundary OverlayBox 
    withpen pensquare scaled \frameddimension{bottomrulethickness}
    withcolor \MPcolor{\framedparameter{bottomframecolor}} ;
  setbounds currentpicture to OverlayBox ;
\stopuseMPgraphic

\installleftframerenderer   {mp} {\useMPgraphic{mp_frame_left}}
\installrightframerenderer  {mp} {\useMPgraphic{mp_frame_right}}
\installtopframerenderer    {mp} {\useMPgraphic{mp_frame_top}}
\installbottomframerenderer {mp} {\useMPgraphic{mp_frame_bottom}}

\setupframed
  [     leftframecolor=\framedparameter{framecolor},
       rightframecolor=\framedparameter{framecolor},
         topframecolor=\framedparameter{framecolor},
      bottomframecolor=\framedparameter{framecolor},
     leftrulethickness=\framedparameter{rulethickness},
    rightrulethickness=\framedparameter{rulethickness},
      toprulethickness=\framedparameter{rulethickness},
   bottomrulethickness=\framedparameter{rulethickness}]

\endinput

[-- Attachment #3: mpframe.tex --]
[-- Type: application/x-tex, Size: 647 bytes --]

[-- Attachment #4: Type: text/plain, Size: 492 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://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki     : http://contextgarden.net
___________________________________________________________________________________

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

end of thread, other threads:[~2018-06-27  8:50 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-06-19  1:26 Table generator : Issues with borders and rotated cells Xavier Dionne
2018-06-27  8:50 ` Wolfgang Schuster

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