ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
* scale=... and specifying the width and height of a figure
@ 2012-10-16 21:08 Aditya Mahajan
  2012-10-16 21:21 ` Hans Hagen
  0 siblings, 1 reply; 5+ messages in thread
From: Aditya Mahajan @ 2012-10-16 21:08 UTC (permalink / raw)
  To: mailing list for ConTeXt users

Hi,

If scale option for a figure is set, \externalfigure does not honor the 
width and the height parameters. For example

\externalfigure[cow][width=1cm, height=3cm, scale=750]

gives a figure which has the usual aspect ratio.

I know that settings scale=... along with width and height does not make 
sense. But, in one of my project, I set

\setupexternalfigures[scale=750]

as that makes sense for most of the figures, and if I try to use

\externalfigure[cow][width=1cm, height=3cm]

then the aspect ratio of the figures does not change.

Not sure if this should be classified as a bug, but I am posting it here 
in case anyone else encounters the same issue and needs to know how to 
override this behavior:

\externalfigure[cow][width=1cm, height=3cm, scale=]

Aditya
___________________________________________________________________________________
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] 5+ messages in thread

* Re: scale=... and specifying the width and height of a figure
  2012-10-16 21:08 scale=... and specifying the width and height of a figure Aditya Mahajan
@ 2012-10-16 21:21 ` Hans Hagen
  2012-10-16 21:33   ` Aditya Mahajan
  0 siblings, 1 reply; 5+ messages in thread
From: Hans Hagen @ 2012-10-16 21:21 UTC (permalink / raw)
  To: mailing list for ConTeXt users

On 16-10-2012 23:08, Aditya Mahajan wrote:
> Hi,
>
> If scale option for a figure is set, \externalfigure does not honor the
> width and the height parameters. For example
>
> \externalfigure[cow][width=1cm, height=3cm, scale=750]
>
> gives a figure which has the usual aspect ratio.
>
> I know that settings scale=... along with width and height does not make
> sense. But, in one of my project, I set
>
> \setupexternalfigures[scale=750]
>
> as that makes sense for most of the figures, and if I try to use
>
> \externalfigure[cow][width=1cm, height=3cm]
>
> then the aspect ratio of the figures does not change.
>
> Not sure if this should be classified as a bug, but I am posting it here
> in case anyone else encounters the same issue and needs to know how to
> override this behavior:
>
> \externalfigure[cow][width=1cm, height=3cm, scale=]

if needed you can use an abstraction:

\starttext

\defineexternalfigure[whatever][width=3cm,height=4cm]
\defineexternalfigure[another] [scale=500]

\externalfigure[cow]
\externalfigure[cow][whatever]
\externalfigure[cow][another]

\stoptext


-----------------------------------------------------------------
                                           Hans Hagen | PRAGMA ADE
               Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
     tel: 038 477 53 69 | voip: 087 875 68 74 | www.pragma-ade.com
                                              | www.pragma-pod.nl
-----------------------------------------------------------------
___________________________________________________________________________________
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] 5+ messages in thread

* Re: scale=... and specifying the width and height of a figure
  2012-10-16 21:21 ` Hans Hagen
@ 2012-10-16 21:33   ` Aditya Mahajan
  2012-10-16 21:43     ` Hans Hagen
  0 siblings, 1 reply; 5+ messages in thread
From: Aditya Mahajan @ 2012-10-16 21:33 UTC (permalink / raw)
  To: Hans Hagen; +Cc: mailing list for ConTeXt users

On Tue, 16 Oct 2012, Hans Hagen wrote:

> On 16-10-2012 23:08, Aditya Mahajan wrote:
>> Hi,
>> 
>> If scale option for a figure is set, \externalfigure does not honor the
>> width and the height parameters. For example
>> 
>> \externalfigure[cow][width=1cm, height=3cm, scale=750]
>> 
>> gives a figure which has the usual aspect ratio.
>> 
>> I know that settings scale=... along with width and height does not make
>> sense. But, in one of my project, I set
>> 
>> \setupexternalfigures[scale=750]
>> 
>> as that makes sense for most of the figures, and if I try to use
>> 
>> \externalfigure[cow][width=1cm, height=3cm]
>> 
>> then the aspect ratio of the figures does not change.
>> 
>> Not sure if this should be classified as a bug, but I am posting it here
>> in case anyone else encounters the same issue and needs to know how to
>> override this behavior:
>> 
>> \externalfigure[cow][width=1cm, height=3cm, scale=]
>
> if needed you can use an abstraction:
>
> \starttext
>
> \defineexternalfigure[whatever][width=3cm,height=4cm]
> \defineexternalfigure[another] [scale=500]
>
> \externalfigure[cow]
> \externalfigure[cow][whatever]
> \externalfigure[cow][another]
>
> \stoptext

I actually use these abstractions, but with the default value also set. 
That's the whole point of having the defaults, right? So, my current 
solution is:

\setupexternalfigures[scale=750, factor=max, maxwidth=\textwidth, maxheight=\textheight]

\defineexternalfigure[grid]
     [width=0.55\paperwidth, height=0.33\paperwidth, scale=, factor=]

Around five months ago, I did not need to reset scale and factor.

Aditya
___________________________________________________________________________________
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] 5+ messages in thread

* Re: scale=... and specifying the width and height of a figure
  2012-10-16 21:33   ` Aditya Mahajan
@ 2012-10-16 21:43     ` Hans Hagen
  2012-10-16 21:57       ` Aditya Mahajan
  0 siblings, 1 reply; 5+ messages in thread
From: Hans Hagen @ 2012-10-16 21:43 UTC (permalink / raw)
  To: Aditya Mahajan; +Cc: mailing list for ConTeXt users

On 16-10-2012 23:33, Aditya Mahajan wrote:

> I actually use these abstractions, but with the default value also set.
> That's the whole point of having the defaults, right? So, my current
> solution is:
>
> \setupexternalfigures[scale=750, factor=max, maxwidth=\textwidth,
> maxheight=\textheight]
>
> \defineexternalfigure[grid]
>      [width=0.55\paperwidth, height=0.33\paperwidth, scale=, factor=]
>
> Around five months ago, I did not need to reset scale and factor.

The code now uses the new inheritance mechamisn and in mkii external 
figures had a whole bunch of (sometimes tricky) resets. Some were reset, 
some not. One complication with externalfigures is that scaling can 
depend on combinations (width, maxwidth etc).

This is not much different from \setupframed .. when someone uses that 
one global all kind of derived mechanisms get affected. (In fact, there 
are many such global settings.)

Hans

-----------------------------------------------------------------
                                           Hans Hagen | PRAGMA ADE
               Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
     tel: 038 477 53 69 | voip: 087 875 68 74 | www.pragma-ade.com
                                              | www.pragma-pod.nl
-----------------------------------------------------------------
___________________________________________________________________________________
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] 5+ messages in thread

* Re: scale=... and specifying the width and height of a figure
  2012-10-16 21:43     ` Hans Hagen
@ 2012-10-16 21:57       ` Aditya Mahajan
  0 siblings, 0 replies; 5+ messages in thread
From: Aditya Mahajan @ 2012-10-16 21:57 UTC (permalink / raw)
  To: Hans Hagen; +Cc: mailing list for ConTeXt users

On Tue, 16 Oct 2012, Hans Hagen wrote:

> On 16-10-2012 23:33, Aditya Mahajan wrote:
>
>> I actually use these abstractions, but with the default value also set.
>> That's the whole point of having the defaults, right? So, my current
>> solution is:
>> 
>> \setupexternalfigures[scale=750, factor=max, maxwidth=\textwidth,
>> maxheight=\textheight]
>> 
>> \defineexternalfigure[grid]
>>      [width=0.55\paperwidth, height=0.33\paperwidth, scale=, factor=]
>> 
>> Around five months ago, I did not need to reset scale and factor.
>
> The code now uses the new inheritance mechamisn and in mkii external figures 
> had a whole bunch of (sometimes tricky) resets. Some were reset, some not.

I know. In the past I had to work around the fact that scale could not be 
set globally (because it was reset at each invocation). The current 
behavior (everything inherits from the global setting) is more predictable 
and easier to handle.

> One complication with externalfigures is that scaling can depend on 
> combinations (width, maxwidth etc).

... and the only way to figure out that dependence is to read the source 
code. At some stage I'll try to document how scale and factor work.

Aditya
___________________________________________________________________________________
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] 5+ messages in thread

end of thread, other threads:[~2012-10-16 21:57 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-10-16 21:08 scale=... and specifying the width and height of a figure Aditya Mahajan
2012-10-16 21:21 ` Hans Hagen
2012-10-16 21:33   ` Aditya Mahajan
2012-10-16 21:43     ` Hans Hagen
2012-10-16 21:57       ` Aditya Mahajan

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