ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
* Center horizontally and vertically a table with a graphic in a paragraph environment
@ 2015-01-09 13:23 Fabrice Couvreur
  2015-01-09 17:09 ` Pablo Rodriguez
  0 siblings, 1 reply; 6+ messages in thread
From: Fabrice Couvreur @ 2015-01-09 13:23 UTC (permalink / raw)
  To: mailing list for ConTeXt users


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

Hi,
Is it possible to center horizontally and vertically the table with the
graphics ?
Best regards,
Fabrice

\defineparagraphs[TwoColumns][n=2]
\setupparagraphs[TwoColumns][1][width=0.45\textwidth]

\startsetups[table:initialize]

\setupTABLE[start][align={middle,lohi},width=1.5cm,offset=0.5ex,style=small]
  \setupTABLE[row][first][background=color,backgroundcolor=lightgray]
\stopsetups

\usemodule[graph]
\definecolor[mycolor][c=.4,m=0,y=0,k=0]
\starttext
\startTwoColumns
\start
\switchtobodyfont[small]
\startMPpage[instance=graph]
    drawoptions(withpen pencircle scaled 1pt);
    w := 10cm; h := 8cm;
    ahlength := .25cm;
    draw begingraph (w,h)
        numeric xmin, xmax, ymin, ymax;
        xmin := 0; xmax :=100; ymax :=8000 ;ymin:=0;
        setrange((xmin,ymin),(xmax,ymax));
        for x=xmin step 10 until xmax:
            grid.bot(format("@g",x),x) withcolor \MPcolor{mycolor}
                withpen pencircle scaled .3pt;
        endfor
        for y=ymin step 1000 until ymax:
            grid.lft(format("@g",y),y) withcolor \MPcolor{mycolor}
                withpen pencircle scaled .3pt;
        endfor
        glabel.bot(textext("Nombre de chaises"),OUT);
        glabel.lft(textext("Euros") rotated 90,OUT);
        glabel.bot("${\cal C}$",(5,3000));
        glabel.top("${\cal R}$",(15,500));
        save a; numeric a[];
        a0 := 2000 ; a1 := 50 ; a2 := -0.2 ;
        gdraw makefunctionpath(xmin,90,1000,polynomial_function(a,2,x));
        b0 := 0 ; b1 := 80 ;
        gdraw makefunctionpath(xmin,90,1000,polynomial_function(b,1,x));
    endgraph ;
\stopMPpage
\stop
\TwoColumns
\framed[frame=off,width=local,align={lohi,middle},location=middle]{%
\bTABLE[setups=table:initialize]
\bTR
    \bTD Jours \eTD
    \bTD Entrées \eTD
\eTR
\bTR
    \bTD 1 \eTD
    \bTD \unknown \eTD
\eTR
\bTR
    \bTD 2 \eTD
    \bTD \unknown \eTD
\eTR
\bTR
    \bTD 3 \eTD
    \bTD \unknown \eTD
\eTR
\bTR
    \bTD 4 \eTD
    \bTD \unknown \eTD
\eTR
\bTR
    \bTD 5 \eTD
    \bTD 870 \eTD
\eTR
\bTR
    \bTD 6 \eTD
    \bTD 910 \eTD
\eTR
\bTR
    \bTD 7 \eTD
    \bTD 1\,000 \eTD
\eTR
\eTABLE
}
\stopTwoColumns
\stoptext

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

[-- Attachment #2: Type: text/plain, Size: 485 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
___________________________________________________________________________________

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

* Re: Center horizontally and vertically a table with a graphic in a paragraph environment
  2015-01-09 13:23 Center horizontally and vertically a table with a graphic in a paragraph environment Fabrice Couvreur
@ 2015-01-09 17:09 ` Pablo Rodriguez
  2015-01-09 19:00   ` Fabrice
  0 siblings, 1 reply; 6+ messages in thread
From: Pablo Rodriguez @ 2015-01-09 17:09 UTC (permalink / raw)
  To: mailing list for ConTeXt users

On 01/09/2015 02:23 PM, Fabrice Couvreur wrote:
> Hi,
> Is it possible to center horizontally and vertically the table with the
> graphics?

Hi Fabrice,

adding an xtable might do what you want (but unless you have narrower
left and right margins, there is no room to fit both tables [I guess]).

\showframe
\setuplayout[backspace=2.5cm, width=middle]

\startsetups[table:initialize]

\setupTABLE[start][align={middle,lohi},width=1.5cm,offset=0.5ex,style=small]
  \setupTABLE[row][first][background=color,backgroundcolor=lightgray]
\stopsetups

\usemodule[graph]
\definecolor[mycolor][c=.4,m=0,y=0,k=0]
\starttext
\startxtable
\startxrow
\startxcell
\start
\switchtobodyfont[small]
\startMPpage[instance=graph]
    drawoptions(withpen pencircle scaled 1pt);
    w := 10cm; h := 8cm;
    ahlength := .25cm;
    draw begingraph (w,h)
        numeric xmin, xmax, ymin, ymax;
        xmin := 0; xmax :=100; ymax :=8000 ;ymin:=0;
        setrange((xmin,ymin),(xmax,ymax));
        for x=xmin step 10 until xmax:
            grid.bot(format("@g",x),x) withcolor \MPcolor{mycolor}
                withpen pencircle scaled .3pt;
        endfor
        for y=ymin step 1000 until ymax:
            grid.lft(format("@g",y),y) withcolor \MPcolor{mycolor}
                withpen pencircle scaled .3pt;
        endfor
        glabel.bot(textext("Nombre de chaises"),OUT);
        glabel.lft(textext("Euros") rotated 90,OUT);
        glabel.bot("${\cal C}$",(5,3000));
        glabel.top("${\cal R}$",(15,500));
        save a; numeric a[];
        a0 := 2000 ; a1 := 50 ; a2 := -0.2 ;
        gdraw makefunctionpath(xmin,90,1000,polynomial_function(a,2,x));
        b0 := 0 ; b1 := 80 ;
        gdraw makefunctionpath(xmin,90,1000,polynomial_function(b,1,x));
    endgraph ;
\stopMPpage
\stop
\stopxcell
\startxcell[align={lohi,middle}]
\framed[frame=off,width=local,align={lohi,middle},location=middle]{%
\bTABLE[setups=table:initialize]
\bTR
    \bTD Jours \eTD
    \bTD Entrées \eTD
\eTR
\bTR
    \bTD 1 \eTD
    \bTD \unknown \eTD
\eTR
\bTR
    \bTD 2 \eTD
    \bTD \unknown \eTD
\eTR
\bTR
    \bTD 3 \eTD
    \bTD \unknown \eTD
\eTR
\bTR
    \bTD 4 \eTD
    \bTD \unknown \eTD
\eTR
\bTR
    \bTD 5 \eTD
    \bTD 870 \eTD
\eTR
\bTR
    \bTD 6 \eTD
    \bTD 910 \eTD
\eTR
\bTR
    \bTD 7 \eTD
    \bTD 1\,000 \eTD
\eTR
\eTABLE
}
\stopxcell
\stopxrow
\stopxtable
\stoptext

Just in case it helps,


Pablo
-- 
http://www.ousia.tk
___________________________________________________________________________________
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
___________________________________________________________________________________

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

* Re: Center horizontally and vertically a table with a graphic in a paragraph environment
  2015-01-09 17:09 ` Pablo Rodriguez
@ 2015-01-09 19:00   ` Fabrice
  2015-01-09 22:36     ` Fabrice
  0 siblings, 1 reply; 6+ messages in thread
From: Fabrice @ 2015-01-09 19:00 UTC (permalink / raw)
  To: ntg-context

Hi Pablo,
Thank you for your cooperation. That's what I want except the frame.
Fabrice
___________________________________________________________________________________
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
___________________________________________________________________________________

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

* Re: Center horizontally and vertically a table with a graphic in a paragraph environment
  2015-01-09 19:00   ` Fabrice
@ 2015-01-09 22:36     ` Fabrice
  2015-01-09 23:15       ` Pablo Rodriguez
  0 siblings, 1 reply; 6+ messages in thread
From: Fabrice @ 2015-01-09 22:36 UTC (permalink / raw)
  To: ntg-context


\startxcell[frame=off]
___________________________________________________________________________________
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
___________________________________________________________________________________

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

* Re: Center horizontally and vertically a table with a graphic in a paragraph environment
  2015-01-09 22:36     ` Fabrice
@ 2015-01-09 23:15       ` Pablo Rodriguez
  2015-01-10 10:45         ` Fabrice
  0 siblings, 1 reply; 6+ messages in thread
From: Pablo Rodriguez @ 2015-01-09 23:15 UTC (permalink / raw)
  To: mailing list for ConTeXt users

On 01/09/2015 11:36 PM, Fabrice wrote:
> 
> \startxcell[frame=off]

\startxtable[frame=off] seems to me a better option to remove the table
frames.


Pablo
-- 
http://www.ousia.tk
___________________________________________________________________________________
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
___________________________________________________________________________________

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

* Re: Center horizontally and vertically a table with a graphic in a paragraph environment
  2015-01-09 23:15       ` Pablo Rodriguez
@ 2015-01-10 10:45         ` Fabrice
  0 siblings, 0 replies; 6+ messages in thread
From: Fabrice @ 2015-01-10 10:45 UTC (permalink / raw)
  To: ntg-context

You're right Pablo.
Fabrice
___________________________________________________________________________________
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
___________________________________________________________________________________

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

end of thread, other threads:[~2015-01-10 10:45 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-01-09 13:23 Center horizontally and vertically a table with a graphic in a paragraph environment Fabrice Couvreur
2015-01-09 17:09 ` Pablo Rodriguez
2015-01-09 19:00   ` Fabrice
2015-01-09 22:36     ` Fabrice
2015-01-09 23:15       ` Pablo Rodriguez
2015-01-10 10:45         ` Fabrice

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