ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
* Adjusting the size of a figure when using placefigure
@ 2009-11-25  1:44 Curiouslearn
  2009-11-25  2:20 ` luigi scarso
  0 siblings, 1 reply; 4+ messages in thread
From: Curiouslearn @ 2009-11-25  1:44 UTC (permalink / raw)
  To: mailing list for ConTeXt users

Please see the figure generated by the following minimal example. Due
to the dimensions chosen in the figure, the figure is wider than the
text width. Is there an option in \placefigure or another command that
can help to make this figure smaller (without changing the code of the
original figure)?

 Thank you.

\setuppapersize[letter][letter]
\setuplayout[leftedge=0in,leftmargin=1in,leftmargindistance=0in,rightmargin=1in,rightmargindistance=0in,rightedge=0in,leftedgedistance=0in,rightedgedistance=0in,topspace=0.5in,width=6.5in,height=10in]

\setupcolors[state=start]


\starttext
	\startuseMPgraphic{firstFig}
		numeric u;
		u:=1in;
		draw (0,0)--(4u,0) withpen pencircle scaled 2pt withcolor red;
	\stopuseMPgraphic
	
	\startuseMPgraphic{secondFig}
		numeric u;
		u:=1in;
		draw (0,0)--(4u,0) withpen pencircle scaled 2pt withcolor blue;
	\stopuseMPgraphic
	
	\placefigure[here]{Two figures next to each other}
	\startcombination[2*1]	
		{\useMPgraphic{firstFig}}{(a)}
		{\useMPgraphic{secondFig}}{(b)}
	\stopcombination
		
It can be seen that due to the dimensions in the figure, the figure is
wider than the text. Is there a way to make the figure as wide as the
text by setting some option of "\placefigure".

\stoptext
___________________________________________________________________________________
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] 4+ messages in thread

* Re: Adjusting the size of a figure when using placefigure
  2009-11-25  1:44 Adjusting the size of a figure when using placefigure Curiouslearn
@ 2009-11-25  2:20 ` luigi scarso
  2009-11-25  4:33   ` Curiouslearn
  2009-11-25  7:15   ` Alan BRASLAU
  0 siblings, 2 replies; 4+ messages in thread
From: luigi scarso @ 2009-11-25  2:20 UTC (permalink / raw)
  To: mailing list for ConTeXt users

On Wed, Nov 25, 2009 at 2:44 AM, Curiouslearn <curiouslearn@gmail.com> wrote:
> Please see the figure generated by the following minimal example. Due
> to the dimensions chosen in the figure, the figure is wider than the
> text width. Is there an option in \placefigure or another command that
> can help to make this figure smaller (without changing the code of the
> original figure)?
>
>  Thank you.
>
> \setuppapersize[letter][letter]
> \setuplayout[leftedge=0in,leftmargin=1in,leftmargindistance=0in,rightmargin=1in,rightmargindistance=0in,rightedge=0in,leftedgedistance=0in,rightedgedistance=0in,topspace=0.5in,width=6.5in,height=10in]
>
> \setupcolors[state=start]
>
>
> \starttext
>        \startuseMPgraphic{firstFig}
>                numeric u;
>                u:=1in;
>                draw (0,0)--(4u,0) withpen pencircle scaled 2pt withcolor red;
>        \stopuseMPgraphic
>
>        \startuseMPgraphic{secondFig}
>                numeric u;
>                u:=1in;
>                draw (0,0)--(4u,0) withpen pencircle scaled 2pt withcolor blue;
>        \stopuseMPgraphic
>
>        \placefigure[here]{Two figures next to each other}
>        \startcombination[2*1]
>                {\useMPgraphic{firstFig}}{(a)}
>                {\useMPgraphic{secondFig}}{(b)}
>        \stopcombination
>
> It can be seen that due to the dimensions in the figure, the figure is
> wider than the text. Is there a way to make the figure as wide as the
> text by setting some option of "\placefigure".
>
> \stoptext


\setuppapersize[letter][letter]
\setuplayout[leftedge=0in,leftmargin=1in,leftmargindistance=0in,rightmargin=1in,rightmargindistance=0in,rightedge=0in,leftedgedistance=0in,rightedgedistance=0in,topspace=0.5in,width=6.5in,height=10in]

\setupcolors[state=start]


\definemeasure[textgap]  [\dimexpr 1em\relax]
\definecombination[both][distance=\measure{textgap}]


\showframe
\starttext
       \startuseMPgraphic{firstFig}
               numeric u;
               u:=1in;
               draw (0,0)--(4u,0) withpen pencircle scaled 2pt withcolor red;
       \stopuseMPgraphic

       \startuseMPgraphic{secondFig}
               numeric u;
               u:=1in;
               draw (0,0)--(4u,0) withpen pencircle scaled 2pt withcolor blue;
       \stopuseMPgraphic

       \placefigure[here]{Two figures next to each other}
       \startcombination[both][2*1]
               {\scale[width=\dimexpr
0.5\textwidth-0.5\measure{textgap}\relax]{\useMPgraphic{firstFig}}}{(a)}
               {\scale[width=\dimexpr
0.5\textwidth-0.5\measure{textgap}\relax]{\useMPgraphic{secondFig}}}{(b)}
       \stopcombination

It can be seen that due to the dimensions in the figure, the figure is
wider than the text. Is there a way to make the figure as wide as the
text by setting some option of "\type{\placefigure}".

\stoptext

-- 
luigi
___________________________________________________________________________________
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] 4+ messages in thread

* Re: Adjusting the size of a figure when using placefigure
  2009-11-25  2:20 ` luigi scarso
@ 2009-11-25  4:33   ` Curiouslearn
  2009-11-25  7:15   ` Alan BRASLAU
  1 sibling, 0 replies; 4+ messages in thread
From: Curiouslearn @ 2009-11-25  4:33 UTC (permalink / raw)
  To: mailing list for ConTeXt users

Thanks Luigi. I did not know where exactly to put the width command.
Your solution works great.


On Tue, Nov 24, 2009 at 9:20 PM, luigi scarso <luigi.scarso@gmail.com> wrote:
> On Wed, Nov 25, 2009 at 2:44 AM, Curiouslearn <curiouslearn@gmail.com> wrote:
>> Please see the figure generated by the following minimal example. Due
>> to the dimensions chosen in the figure, the figure is wider than the
>> text width. Is there an option in \placefigure or another command that
>> can help to make this figure smaller (without changing the code of the
>> original figure)?
>>
>>  Thank you.
>>
>> \setuppapersize[letter][letter]
>> \setuplayout[leftedge=0in,leftmargin=1in,leftmargindistance=0in,rightmargin=1in,rightmargindistance=0in,rightedge=0in,leftedgedistance=0in,rightedgedistance=0in,topspace=0.5in,width=6.5in,height=10in]
>>
>> \setupcolors[state=start]
>>
>>
>> \starttext
>>        \startuseMPgraphic{firstFig}
>>                numeric u;
>>                u:=1in;
>>                draw (0,0)--(4u,0) withpen pencircle scaled 2pt withcolor red;
>>        \stopuseMPgraphic
>>
>>        \startuseMPgraphic{secondFig}
>>                numeric u;
>>                u:=1in;
>>                draw (0,0)--(4u,0) withpen pencircle scaled 2pt withcolor blue;
>>        \stopuseMPgraphic
>>
>>        \placefigure[here]{Two figures next to each other}
>>        \startcombination[2*1]
>>                {\useMPgraphic{firstFig}}{(a)}
>>                {\useMPgraphic{secondFig}}{(b)}
>>        \stopcombination
>>
>> It can be seen that due to the dimensions in the figure, the figure is
>> wider than the text. Is there a way to make the figure as wide as the
>> text by setting some option of "\placefigure".
>>
>> \stoptext
>
>
> \setuppapersize[letter][letter]
> \setuplayout[leftedge=0in,leftmargin=1in,leftmargindistance=0in,rightmargin=1in,rightmargindistance=0in,rightedge=0in,leftedgedistance=0in,rightedgedistance=0in,topspace=0.5in,width=6.5in,height=10in]
>
> \setupcolors[state=start]
>
>
> \definemeasure[textgap]  [\dimexpr 1em\relax]
> \definecombination[both][distance=\measure{textgap}]
>
>
> \showframe
> \starttext
>       \startuseMPgraphic{firstFig}
>               numeric u;
>               u:=1in;
>               draw (0,0)--(4u,0) withpen pencircle scaled 2pt withcolor red;
>       \stopuseMPgraphic
>
>       \startuseMPgraphic{secondFig}
>               numeric u;
>               u:=1in;
>               draw (0,0)--(4u,0) withpen pencircle scaled 2pt withcolor blue;
>       \stopuseMPgraphic
>
>       \placefigure[here]{Two figures next to each other}
>       \startcombination[both][2*1]
>               {\scale[width=\dimexpr
> 0.5\textwidth-0.5\measure{textgap}\relax]{\useMPgraphic{firstFig}}}{(a)}
>               {\scale[width=\dimexpr
> 0.5\textwidth-0.5\measure{textgap}\relax]{\useMPgraphic{secondFig}}}{(b)}
>       \stopcombination
>
> It can be seen that due to the dimensions in the figure, the figure is
> wider than the text. Is there a way to make the figure as wide as the
> text by setting some option of "\type{\placefigure}".
>
> \stoptext
>
> --
> luigi
> ___________________________________________________________________________________
> 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
> ___________________________________________________________________________________
>
___________________________________________________________________________________
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] 4+ messages in thread

* Re: Adjusting the size of a figure when using placefigure
  2009-11-25  2:20 ` luigi scarso
  2009-11-25  4:33   ` Curiouslearn
@ 2009-11-25  7:15   ` Alan BRASLAU
  1 sibling, 0 replies; 4+ messages in thread
From: Alan BRASLAU @ 2009-11-25  7:15 UTC (permalink / raw)
  To: ntg-context

Luigi,

Thank you for bringing to our attention the command \scale
allowing the easy rescaling of MP graphics.

On Wednesday 25 November 2009 03:20:09 luigi scarso wrote:
> \definemeasure[textgap]  [\dimexpr 1em\relax]
> 

Why the \dimexpr?
\definemeasure[textgap]  [1em]
works just fine.

Alan
___________________________________________________________________________________
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] 4+ messages in thread

end of thread, other threads:[~2009-11-25  7:15 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-11-25  1:44 Adjusting the size of a figure when using placefigure Curiouslearn
2009-11-25  2:20 ` luigi scarso
2009-11-25  4:33   ` Curiouslearn
2009-11-25  7:15   ` Alan BRASLAU

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