ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
* Center two frames
@ 2015-01-13 21:43 Fabrice Couvreur
  2015-01-14 12:14 ` Pablo Rodriguez
  0 siblings, 1 reply; 6+ messages in thread
From: Fabrice Couvreur @ 2015-01-13 21:43 UTC (permalink / raw)
  To: mailing list for ConTeXt users


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

Hi,
I wish the second frame is centered with the first frame. I guess this is
the figure that prevents this. However, even by reducing the value of u, it
does not work.
Best regards,
Fabrice

\definecolor[Border][c=0.00, m=0.00, y=0.00, k=0.25]

\defineframed
   [Myframed]
   [width=0.6\textwidth,
    foregroundstyle={\switchtobodyfont[10pt]},
    align={high,flushleft},
    frame=off,
    framecolor=0.625white,
    background=borderline,
    ]

\definefiller[dots][left=\dontleavehmode,right=\hskip\zeropoint\par]

\startsetups[table:initialize]
  \setupTABLE[start]
             [align={lohi,right}
             offset=1ex,
             frame=off,
             ]
  \setupTABLE[column][first][width=0.25\textwidth]
  \setupTABLE[column][2][width=0.35\textwidth]
\stopsetups

\starttext

\startuniqueMPgraphic{borderline}
path p ; p := unitsquare xscaled \overlaywidth yscaled \overlayheight ;
draw p withcolor \MPcolor{Border} dashed evenly withpen pencircle scaled
1.2pt ;
\stopuniqueMPgraphic

\defineoverlay[borderline][\uniqueMPgraphic{borderline}]

\placefigure[right,none]{}{
\start
\switchtobodyfont[7pt]
\startMPcode
numeric u;
u=0.7cm;
z0=(0,0) ;
z1=(2.5u,0) ;
z2=(2.5u,2.5u) ;
z3=(0,2.5u) ;
z4=(-0.2u,0) ;
z5=(-0.2u,2.5u) ;
z6=(0,2.7u) ;
z7=(2.5u,2.7u) ;
z8=(1.25u,1.25u) ;
drawdblarrow z4--z5 ;
drawdblarrow z6--z7 ;
fill z0--z1--z2--z3--cycle withcolor green ;
draw z0--z1--z2--z3--cycle ;
label.top("\unit{100 meter}",0.5[z6,z7]) ;
label.lft("\unit{100 meter}",0.5[z4,z5]) ;
\stopMPcode
\stop}
Compléter chacun des algorithmes ci-dessous afin qu'ils affichent en
\unit{square meter}, puis en hectares, la superficie d'un terrain
rectangulaire de longueur $L$ mètres et de largeur $l$ mètres, saisies en
entrée.

\startbuffer
\input knuth
\stopbuffer

\blank[big]
\startmidaligned
\Myframed{\getbuffer}
\stopmidaligned

\startbuffer
\input ward
\stopbuffer

\blank[big]
\startmidaligned
\Myframed{\getbuffer}
\stopmidaligned
\stoptext

[-- Attachment #1.2: Type: text/html, Size: 2751 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 two frames
  2015-01-13 21:43 Center two frames Fabrice Couvreur
@ 2015-01-14 12:14 ` Pablo Rodriguez
  2015-01-14 16:30   ` Wolfgang Schuster
  0 siblings, 1 reply; 6+ messages in thread
From: Pablo Rodriguez @ 2015-01-14 12:14 UTC (permalink / raw)
  To: mailing list for ConTeXt users

On 01/13/2015 10:43 PM, Fabrice Couvreur wrote:
> Hi,
> I wish the second frameis centered with the first frame. I guess this is
> the figure that prevents this. However, even by reducing the value of u,
> it does not work.
> Best regards,
> Fabrice

Hi Fabrice,

I think that the figure gives a different width to center the frame.

Reducing the value of u to 0.175cm does work (although this is almost
useless :-)).

An xtable may do what you need:

%~ \showframe
\definecolor[Border][c=0.00, m=0.00, y=0.00, k=0.25]

\defineframed
   [Myframed]
   [width=0.6\textwidth,
    foregroundstyle={\switchtobodyfont[10pt]},
    align={high,flushleft},
    frame=off,
    framecolor=0.625white,
    background=borderline,
    ]

\definefiller[dots][left=\dontleavehmode,right=\hskip\zeropoint\par]

\starttext

\startuniqueMPgraphic{borderline}
path p ; p := unitsquare xscaled \overlaywidth yscaled \overlayheight ;
draw p withcolor \MPcolor{Border} dashed evenly withpen pencircle scaled
1.2pt ;
\stopuniqueMPgraphic

\defineoverlay[borderline][\uniqueMPgraphic{borderline}]

\startxtable[frame=off]
    \startxrow
        \startxcell[align=normal]
Compléter chacun des algorithmes ci-dessous afin qu'ils affichent en
\unit{square meter}, puis en hectares, la superficie d'un terrain
rectangulaire de longueur $L$ mètres et de largeur $l$ mètres, saisies
en entrée.
        \stopxcell
        \startxcell
\switchtobodyfont[7pt]
\startMPcode
numeric u;
u=0.7cm;
z0=(0,0) ;
z1=(2.5u,0) ;
z2=(2.5u,2.5u) ;
z3=(0,2.5u) ;
z4=(-0.2u,0) ;
z5=(-0.2u,2.5u) ;
z6=(0,2.7u) ;
z7=(2.5u,2.7u) ;
z8=(1.25u,1.25u) ;
drawdblarrow z4--z5 ;
drawdblarrow z6--z7 ;
fill z0--z1--z2--z3--cycle withcolor green ;
draw z0--z1--z2--z3--cycle ;
label.top("\unit{100 meter}",0.5[z6,z7]) ;
label.lft("\unit{100 meter}",0.5[z4,z5]) ;
\stopMPcode
        \stopxcell
    \stopxrow
\stopxtable
\startbuffer
\input knuth
\stopbuffer

\blank[big]
\startmidaligned
\Myframed{\getbuffer}
\stopmidaligned

\startbuffer
\input ward
\stopbuffer

\blank[big]
\startmidaligned
\Myframed{\getbuffer}
\stopmidaligned
\stoptext

I hope 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 two frames
  2015-01-14 12:14 ` Pablo Rodriguez
@ 2015-01-14 16:30   ` Wolfgang Schuster
  2015-01-14 17:50     ` Fabrice
  0 siblings, 1 reply; 6+ messages in thread
From: Wolfgang Schuster @ 2015-01-14 16:30 UTC (permalink / raw)
  To: mailing list for ConTeXt users


> Am 14.01.2015 um 13:14 schrieb Pablo Rodriguez <oinos@gmx.es>:
> 
> \defineframed
>   [Myframed]
>   [width=0.6\textwidth,
>    foregroundstyle={\switchtobodyfont[10pt]},
>    align={high,flushleft},
>    frame=off,
>    framecolor=0.625white,
>    background=borderline,
>    ]

You can replace the framed command with a framed text environment, e.g.

\defineframedtext
  [Myframed]
  [width=0.6\textwidth,
   foregroundstyle={\switchtobodyfont[10pt]},
   align={high,flushleft},
   frame=off,
   framecolor=0.625white,
   background=borderline,
   location=middle,
   offset=.5ex]

and change

> \startmidaligned
> \Myframed{\getbuffer}
> \stopmidaligned

to

\startMyframed
\getbuffer
\stopMyframed

Wolfgang
___________________________________________________________________________________
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 two frames
  2015-01-14 16:30   ` Wolfgang Schuster
@ 2015-01-14 17:50     ` Fabrice
  2015-01-14 18:02       ` Wolfgang Schuster
  2015-01-14 19:20       ` Pablo Rodriguez
  0 siblings, 2 replies; 6+ messages in thread
From: Fabrice @ 2015-01-14 17:50 UTC (permalink / raw)
  To: ntg-context

Dear Pablo,
Following a post to which you had already answered, I have been able to 
do using a XTABLE.
But I wanted to know if it was possible to do otherwise. But apparently 
not, so I'll hold your solution.

Dear Wolfgang,
Why is it better to use a framed text environment?
___________________________________________________________________________________
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 two frames
  2015-01-14 17:50     ` Fabrice
@ 2015-01-14 18:02       ` Wolfgang Schuster
  2015-01-14 19:20       ` Pablo Rodriguez
  1 sibling, 0 replies; 6+ messages in thread
From: Wolfgang Schuster @ 2015-01-14 18:02 UTC (permalink / raw)
  To: mailing list for ConTeXt users


> Am 14.01.2015 um 18:50 schrieb Fabrice <couvreur.fabrice@wanadoo.fr>:
> 
> Dear Pablo,
> Following a post to which you had already answered, I have been able to do using a XTABLE.
> But I wanted to know if it was possible to do otherwise. But apparently not, so I'll hold your solution.
> 
> Dear Wolfgang,
> Why is it better to use a framed text environment?

With framedtext you need only one environment to put a frame around your text and center it
(you can also set the distance before and after the environment) while the \framed command
requires you to center the content with additional commands, you have to add also a manual
blank command to set a distance before/after the text.

Wolfgang

___________________________________________________________________________________
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 two frames
  2015-01-14 17:50     ` Fabrice
  2015-01-14 18:02       ` Wolfgang Schuster
@ 2015-01-14 19:20       ` Pablo Rodriguez
  1 sibling, 0 replies; 6+ messages in thread
From: Pablo Rodriguez @ 2015-01-14 19:20 UTC (permalink / raw)
  To: mailing list for ConTeXt users

On 01/14/2015 06:50 PM, Fabrice wrote:
> Dear Pablo,
> Following a post to which you had already answered, I have been able to 
> do using a XTABLE.
> But I wanted to know if it was possible to do otherwise. But apparently 
> not, so I'll hold your solution.

Hi Fabrice,

I guess that placing an invisible object besides the second frame would
do the same. This looks like a more complex workaround to me.

I must confess that I don’t know whether there are another approaches to
the issue you are facing.


Pablo


> Dear Wolfgang,
> Why is it better to use a framed text environment?
> ___________________________________________________________________________________
> 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
> ___________________________________________________________________________________
> 


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

end of thread, other threads:[~2015-01-14 19:20 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-01-13 21:43 Center two frames Fabrice Couvreur
2015-01-14 12:14 ` Pablo Rodriguez
2015-01-14 16:30   ` Wolfgang Schuster
2015-01-14 17:50     ` Fabrice
2015-01-14 18:02       ` Wolfgang Schuster
2015-01-14 19:20       ` Pablo Rodriguez

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