Re: [NTG-context] Scale image in MetaPost, maintaining aspect ratio

2018-07-07 Thread Marco Patzer
On Sat, 7 Jul 2018 14:27:38 -0600
Alan Braslau  wrote:

> For "historic" reasons,
> draw externalfigure "cow" scaled 5cm ;
> normalizes the figure to a square. This will not be changed as it is a
> very old feature of MetaFun.
> 
> The solution is
> draw rawtextext("\externalfigure[cow]") xsized 5cm ;
> where one can use xsized, ysized or xysized (taking a pair).

That works indeed. Thanks.

Marco
___
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://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki : http://contextgarden.net
___

Re: [NTG-context] Scale image in MetaPost, maintaining aspect ratio

2018-07-07 Thread Marco Patzer
On Sat, 7 Jul 2018 22:27:51 +0200
Hans Hagen  wrote:

> On 7/7/2018 8:58 PM, Marco Patzer wrote:
> > Hi!
> > 
> > How to scale an image in MetaPost, maintaining the aspect ratio
> > (without specifying the height explicitly)?
> > 
> > Example:
> > 
> > \setupexternalfigures [location=default]
> > \starttext
> >\externalfigure [cow][width=5cm]
> > 
> >\startMPcode
> >  draw externalfigure "cow" scaled 5cm;
> >\stopMPcode
> > \stoptext
> it's all in the metafun manual

No doubts about that. It's more a matter of knowing what to search
for.

> xsized 5cm

I tried it, same result - square image:

  draw externalfigure "cow" xsized 5cm;

As Alan mentioned including the image with textext() works. Not as
elegant, but it gets the job done.

Marco
___
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://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki : http://contextgarden.net
___

Re: [NTG-context] Scale image in MetaPost, maintaining aspect ratio

2018-07-07 Thread Hans Hagen

On 7/7/2018 8:58 PM, Marco Patzer wrote:

Hi!

How to scale an image in MetaPost, maintaining the aspect ratio
(without specifying the height explicitly)?

Example:

\setupexternalfigures [location=default]
\starttext
   \externalfigure [cow][width=5cm]

   \startMPcode
 draw externalfigure "cow" scaled 5cm;
   \stopMPcode
\stoptext

it's all in the metafun manual

xsized 5cm

-
  Hans Hagen | PRAGMA ADE
  Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
   tel: 038 477 53 69 | www.pragma-ade.nl | 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://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki : http://contextgarden.net
___

Re: [NTG-context] Scale image in MetaPost, maintaining aspect ratio

2018-07-07 Thread Alan Braslau
On Sat, 7 Jul 2018 20:58:40 +0200
Marco Patzer  wrote:

> Hi!
> 
> How to scale an image in MetaPost, maintaining the aspect ratio
> (without specifying the height explicitly)?
> 
> Example:
> 
> \setupexternalfigures [location=default]
> \starttext
>   \externalfigure [cow][width=5cm]
> 
>   \startMPcode
> draw externalfigure "cow" scaled 5cm;
>   \stopMPcode
> \stoptext

For "historic" reasons,
draw externalfigure "cow" scaled 5cm ;
normalizes the figure to a square. This will not be changed as it is a
very old feature of MetaFun.

The solution is
draw rawtextext("\externalfigure[cow]") xsized 5cm ;
where one can use xsized, ysized or xysized (taking a pair).

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://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki : http://contextgarden.net
___

[NTG-context] Scale image in MetaPost, maintaining aspect ratio

2018-07-07 Thread Marco Patzer
Hi!

How to scale an image in MetaPost, maintaining the aspect ratio
(without specifying the height explicitly)?

Example:

\setupexternalfigures [location=default]
\starttext
  \externalfigure [cow][width=5cm]

  \startMPcode
draw externalfigure "cow" scaled 5cm;
  \stopMPcode
\stoptext

Marco
___
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://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki : http://contextgarden.net
___

Re: [NTG-context] text in mathematics

2018-07-07 Thread Hans Ã…berg

> On 7 Jul 2018, at 16:04, Alan Braslau  wrote:

> Does it drive you crazy to see TeX users write $t = time$?
> (I see this all of the time by LaTeX users in Beamer presentations.)
> 
> One can do better writing $t = {\rm time}$ (maybe)
> or in ConTeXt $t = \mathrm{time}$.
> Sometimes, too, I might write $t = \text{time}$.

The last would be easiest to remember when using it less often. Strictly, it is 
different, because it could mean italics, as may be used in formulas. The 
upright letters are called normal here:
  https://en.wikipedia.org/wiki/Mathematical_Alphanumeric_Symbols

> We also have the commands \mathematics{} that can be used in place of
> the TeX shorthand $...$, and this also has the shortcut \m{...}.
> 
> I thought that it might be useful to have an equivalent escape, to be
> used as $t = \t{time}$. What do other users think?
> 
> OK, \m{t = \t{time}} might be a bit funky... 

If one is using italics for text in math formulas, that would be logical.


___
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://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki : http://contextgarden.net
___

[NTG-context] text in mathematics

2018-07-07 Thread Alan Braslau
Hello ConTeXt users,

Does it drive you crazy to see TeX users write $t = time$?
(I see this all of the time by LaTeX users in Beamer presentations.)

One can do better writing $t = {\rm time}$ (maybe)
or in ConTeXt $t = \mathrm{time}$.
Sometimes, too, I might write $t = \text{time}$.

We also have the commands \mathematics{} that can be used in place of
the TeX shorthand $...$, and this also has the shortcut \m{...}.

I thought that it might be useful to have an equivalent escape, to be
used as $t = \t{time}$. What do other users think?

OK, \m{t = \t{time}} might be a bit funky... 


Alan


P.S. I proposed doing this via
\let\t\mathrm
but Hans tells me that this is not good, as \mathrm{} does not give
proper font processing, so implementation of \t{} would be something
different...
___
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://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki : http://contextgarden.net
___