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
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
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
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
2007/9/7, Oliver Buerschaper
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
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
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
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
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
participants (4)
-
Kumar Appaiah
-
Mojca Miklavec
-
Oliver Buerschaper
-
Wolfgang Schuster