ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
* Margins around figures
@ 2007-09-07  4:16 Kumar Appaiah
  2007-09-07  7:18 ` Oliver Buerschaper
  0 siblings, 1 reply; 9+ messages in thread
From: Kumar Appaiah @ 2007-09-07  4:16 UTC (permalink / raw)
  To: ntg-context

Deat ConTeXt users,

I am making a presentation with ConTeXt, with numerous MetaPost
figures. Now, the only problem is that my white MetaPost figures don't
blend well with the dark background of the screen. This isn't too good
since the text labels in my figure's edges appear too close to the
edge. What I'd like to know is, whether there's a way to specify some
extra margin space around the figure, which would provide some more
white area around the MetaPost figure. Alternately, is there an
elegant MetaPost way of specifying figure margins?

Oh, and my MetaPost files are in separate .mp files; I include them
after converting.

Thanks!

Kumar
-- 
Kumar Appaiah,
458, Jamuna Hostel,
Indian Institute of Technology Madras,
Chennai - 600 036
___________________________________________________________________________________
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  : https://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________


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

* Re: Margins around figures
  2007-09-07  4:16 Margins around figures Kumar Appaiah
@ 2007-09-07  7:18 ` Oliver Buerschaper
  2007-09-07  8:23   ` Kumar Appaiah
  0 siblings, 1 reply; 9+ messages in thread
From: Oliver Buerschaper @ 2007-09-07  7:18 UTC (permalink / raw)
  To: mailing list for ConTeXt users

> I am making a presentation with ConTeXt, with numerous MetaPost
> figures. Now, the only problem is that my white MetaPost figures don't
> blend well with the dark background of the screen. This isn't too good
> since the text labels in my figure's edges appear too close to the
> edge. What I'd like to know is, whether there's a way to specify some
> extra margin space around the figure, which would provide some more
> white area around the MetaPost figure. Alternately, is there an
> elegant MetaPost way of specifying figure margins?


Perhaps

setbounds currentpicture to boundingbox currentpicture enlarged 5mm;

at the end of your MetaPost drawing might do what you want?

Oliver
___________________________________________________________________________________
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  : https://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________


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

* Re: Margins around figures
  2007-09-07  7:18 ` Oliver Buerschaper
@ 2007-09-07  8:23   ` Kumar Appaiah
  2007-09-07  9:27     ` Oliver Buerschaper
  2007-09-08  9:14     ` Mojca Miklavec
  0 siblings, 2 replies; 9+ messages in thread
From: Kumar Appaiah @ 2007-09-07  8:23 UTC (permalink / raw)
  To: ntg-context

On Fri, Sep 07, 2007 at 09:18:30AM +0200, Oliver Buerschaper wrote:
> Perhaps
> 
> setbounds currentpicture to boundingbox currentpicture enlarged 5mm;
> 
> at the end of your MetaPost drawing might do what you want?

That's probably in the right direction, but the MetaPost newbie I am,
I am unable to figure out the error:

mpost seminar.mp
This is MetaPost, Version 0.993 (Web2C 7.5.6)
(seminar.mp (/usr/share/texmf-texlive/metapost/base/TEX.mp)
(/usr/share/texmf-texlive/metapost/base/boxes.mp)
>> boundingbox.currentpicture.enlarged1cm
! Improper `clip'.
<to be read again> 
                   ;
l.26 ...o boundingbox currentpicture enlarged 1cm;
                                                  
?

What error could this be? The line I added is:
     setbounds currentpicture to boundingbox currentpicture enlarged 1cm;

Thanks!

Kumar
-- 
Kumar Appaiah,
458, Jamuna Hostel,
Indian Institute of Technology Madras,
Chennai - 600 036
___________________________________________________________________________________
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  : https://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________


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

* Re: Margins around figures
  2007-09-07  8:23   ` Kumar Appaiah
@ 2007-09-07  9:27     ` Oliver Buerschaper
  2007-09-07 10:31       ` Wolfgang Schuster
  2007-09-08  9:14     ` Mojca Miklavec
  1 sibling, 1 reply; 9+ messages in thread
From: Oliver Buerschaper @ 2007-09-07  9:27 UTC (permalink / raw)
  To: mailing list for ConTeXt users

> mpost seminar.mp
> This is MetaPost, Version 0.993 (Web2C 7.5.6)
> (seminar.mp (/usr/share/texmf-texlive/metapost/base/TEX.mp)
> (/usr/share/texmf-texlive/metapost/base/boxes.mp)
>>> boundingbox.currentpicture.enlarged1cm
> ! Improper `clip'.
> <to be read again>
>                    ;
> l.26 ...o boundingbox currentpicture enlarged 1cm;
>
> ?

Oh, seems like I forgot that you wanted to run MetaPost externally.  
The command "enlarged" isn't contained in standard MetaPost but only  
in the extension MetaFun (i.e. MetaPost plus quite a number of  
predefined MetaPost macros) that comes with ConTeXt. Therefore the  
error is thrown ...

Why not try this (in ConTeXt):

---

\starttext

\startuseMPgraphic{yourPicture}
	% put your MetaPost code here (without beginfig(); and endfig;)
	setbounds currentpicture to boundingbox currentpicture enlarged 1cm;
\stopuseMPgraphic

\useMPgraphic{yourPicture}

\stoptext

---

Best,
Oliver
___________________________________________________________________________________
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  : https://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________


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

* Re: Margins around figures
  2007-09-07  9:27     ` Oliver Buerschaper
@ 2007-09-07 10:31       ` Wolfgang Schuster
  2007-09-07 17:46         ` Kumar Appaiah
  0 siblings, 1 reply; 9+ messages in thread
From: Wolfgang Schuster @ 2007-09-07 10:31 UTC (permalink / raw)
  To: mailing list for ConTeXt users

2007/9/7, Oliver Buerschaper <oliver.buerschaper@mpq.mpg.de>:
> > mpost seminar.mp
> > This is MetaPost, Version 0.993 (Web2C 7.5.6)
> > (seminar.mp (/usr/share/texmf-texlive/metapost/base/TEX.mp)
> > (/usr/share/texmf-texlive/metapost/base/boxes.mp)
> >>> boundingbox.currentpicture.enlarged1cm
> > ! Improper `clip'.
> > <to be read again>
> >                    ;
> > l.26 ...o boundingbox currentpicture enlarged 1cm;
> >
> > ?
>
> Oh, seems like I forgot that you wanted to run MetaPost externally.
> The command "enlarged" isn't contained in standard MetaPost but only
> in the extension MetaFun (i.e. MetaPost plus quite a number of
> predefined MetaPost macros) that comes with ConTeXt. Therefore the
> error is thrown ...
>
> Why not try this (in ConTeXt):
>
> ---
>
> \starttext
>
> \startuseMPgraphic{yourPicture}
>         % put your MetaPost code here (without beginfig(); and endfig;)
>         setbounds currentpicture to boundingbox currentpicture enlarged 1cm;
> \stopuseMPgraphic
>
> \useMPgraphic{yourPicture}
>
> \stoptext

He can set the offset in ConTeXt and not in MetaPost, e.g.

\offset[leftoffset=...]{\externalfigure[fugurename]}

The \offset command is described in the details manual, he can also
look at the definition in core-box.

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  : https://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________


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

* Re: Margins around figures
  2007-09-07 10:31       ` Wolfgang Schuster
@ 2007-09-07 17:46         ` Kumar Appaiah
  2007-09-07 18:08           ` Kumar Appaiah
  0 siblings, 1 reply; 9+ messages in thread
From: Kumar Appaiah @ 2007-09-07 17:46 UTC (permalink / raw)
  To: ntg-context

On Fri, Sep 07, 2007 at 12:31:26PM +0200, Wolfgang Schuster wrote:
> He can set the offset in ConTeXt and not in MetaPost, e.g.
> 
> \offset[leftoffset=...]{\externalfigure[fugurename]}
> 
> The \offset command is described in the details manual, he can also
> look at the definition in core-box.

Well, that seems to be a nice option, but it fills the offset region
in the background colour instead of white. I'll try to figure out if
there's some workaround for that. Also, I'll try Oliver's solution,
though it seems to generate full pages and not individual images.

But, is there still an elegant way to have more margin in MetaPost
images?

Thanks!

Kumar
-- 
Kumar Appaiah,
458, Jamuna Hostel,
Indian Institute of Technology Madras,
Chennai - 600 036
___________________________________________________________________________________
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  : https://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________


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

* Re: Margins around figures
  2007-09-07 17:46         ` Kumar Appaiah
@ 2007-09-07 18:08           ` Kumar Appaiah
  0 siblings, 0 replies; 9+ messages in thread
From: Kumar Appaiah @ 2007-09-07 18:08 UTC (permalink / raw)
  To: ntg-context

On Fri, Sep 07, 2007 at 11:16:50PM +0530, Kumar Appaiah wrote:
> But, is there still an elegant way to have more margin in MetaPost
> images?

OK, a cheap and dirty workaround: define a blank label at a location
outside the bounds of your actual picture, and MetaPost does the
needful. Inelegant, but works for now.

My next "free-time-assignment" is to learn MetaFun, since I've read
enough to know that by not knowing it, I'm missing something
significant.

Thanks!

Kumar
-- 
Kumar Appaiah,
458, Jamuna Hostel,
Indian Institute of Technology Madras,
Chennai - 600 036
___________________________________________________________________________________
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  : https://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________


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

* Re: Margins around figures
  2007-09-07  8:23   ` Kumar Appaiah
  2007-09-07  9:27     ` Oliver Buerschaper
@ 2007-09-08  9:14     ` Mojca Miklavec
  2007-09-08 11:57       ` Kumar Appaiah
  1 sibling, 1 reply; 9+ messages in thread
From: Mojca Miklavec @ 2007-09-08  9:14 UTC (permalink / raw)
  To: mailing list for ConTeXt users

On 9/7/07, Kumar Appaiah wrote:
> On Fri, Sep 07, 2007 at 09:18:30AM +0200, Oliver Buerschaper wrote:
> > Perhaps
> >
> > setbounds currentpicture to boundingbox currentpicture enlarged 5mm;
> >
> > at the end of your MetaPost drawing might do what you want?
>
> That's probably in the right direction, but the MetaPost newbie I am,
> I am unable to figure out the error:
>
> mpost seminar.mp
> This is MetaPost, Version 0.993 (Web2C 7.5.6)
> (seminar.mp (/usr/share/texmf-texlive/metapost/base/TEX.mp)
> (/usr/share/texmf-texlive/metapost/base/boxes.mp)
> >> boundingbox.currentpicture.enlarged1cm
> ! Improper `clip'.
> <to be read again>
>                    ;
> l.26 ...o boundingbox currentpicture enlarged 1cm;
>
> ?
>
> What error could this be? The line I added is:
>      setbounds currentpicture to boundingbox currentpicture enlarged 1cm;

Since plain metapost doesn't know about ConTeXt (metafun) extentions,
you need to:
- either add a line "input metafun ;" at the top of your metapost files
- or run "mptopdf seminar.mp" which will run metapost+create PDF
instead of running "mpost/mp seminar.mp" first and convert to PDF
later

When including a picture in ConTeXt, one options could also be to use:
\framed[frame=off,offset=1cm,strut=no,background=color,backgroundcolor=white]%
{\externalfigure[...]}
But that's slightly long and tedious, unless you write your own macro
wrapper around it.

Mojca
___________________________________________________________________________________
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  : https://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________


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

* Re: Margins around figures
  2007-09-08  9:14     ` Mojca Miklavec
@ 2007-09-08 11:57       ` Kumar Appaiah
  0 siblings, 0 replies; 9+ messages in thread
From: Kumar Appaiah @ 2007-09-08 11:57 UTC (permalink / raw)
  To: ntg-context

Dear Mojka,

On Sat, Sep 08, 2007 at 11:14:30AM +0200, Mojca Miklavec wrote:
> Since plain metapost doesn't know about ConTeXt (metafun) extentions,
> you need to:
> - either add a line "input metafun ;" at the top of your metapost files

This works just as I expect! Many thanks!

> - or run "mptopdf seminar.mp" which will run metapost+create PDF
> instead of running "mpost/mp seminar.mp" first and convert to PDF
> later

This gives me some font issues, but I am not really bothered, since
the excitement of seeing the first solution work has stopped me from
probing further here.

> When including a picture in ConTeXt, one options could also be to use:
> \framed[frame=off,offset=1cm,strut=no,background=color,backgroundcolor=white]%
> {\externalfigure[...]}
> But that's slightly long and tedious, unless you write your own macro
> wrapper around it.

I understand, but it will be useful elsewhere.

Again, many thanks!

Kumar
-- 
Kumar Appaiah,
458, Jamuna Hostel,
Indian Institute of Technology Madras,
Chennai - 600 036
___________________________________________________________________________________
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  : https://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________


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

end of thread, other threads:[~2007-09-08 11:57 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-09-07  4:16 Margins around figures Kumar Appaiah
2007-09-07  7:18 ` Oliver Buerschaper
2007-09-07  8:23   ` Kumar Appaiah
2007-09-07  9:27     ` Oliver Buerschaper
2007-09-07 10:31       ` Wolfgang Schuster
2007-09-07 17:46         ` Kumar Appaiah
2007-09-07 18:08           ` Kumar Appaiah
2007-09-08  9:14     ` Mojca Miklavec
2007-09-08 11:57       ` Kumar Appaiah

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