Re: [NTG-context] Value of Metapost variable as a label

2009-03-23 Thread Eythan Weg

Aditya Mahajan adit...@umich.edu
Sun, 22 Mar 2009 22:24:17 -0400 (EDT)

   On Mon, 23 Mar 2009, Mojca Miklavec wrote:
   
This however fails:
k:=2;
label.bot(textext($1\over  decimal k  $), (10,0)) ;
   
Try with \frac instead.
   
   Or prevent expansion of \over
   
   label.bot(textext($1\noexpand\over  decimal k  $), (10,0)) ;

Why \atop or \choose do not need \noexpand?
What is special about \over?   
   
   Aditya


Thanks,

Eythan 

___
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
___


Re: [NTG-context] Value of Metapost variable as a label

2009-03-23 Thread Aditya Mahajan

On Mon, 23 Mar 2009, Eythan Weg wrote:



Aditya Mahajan adit...@umich.edu
Sun, 22 Mar 2009 22:24:17 -0400 (EDT)

  On Mon, 23 Mar 2009, Mojca Miklavec wrote:

   This however fails:
   k:=2;
   label.bot(textext($1\over  decimal k  $), (10,0)) ;
  
   Try with \frac instead.

  Or prevent expansion of \over

  label.bot(textext($1\noexpand\over  decimal k  $), (10,0)) ;

Why \atop or \choose do not need \noexpand?
What is special about \over?


It is redefined by ConTeXt to be a useful command in text mode.

\starttext

\section[sec:test] {Some section}

See \over[sec:test]

\stoptext

Hans, is it OK to change the definitions in core-def to

\ifnum\texengine=\luatexengine
\ifx\in   \undefined\else \let\normalmathin   \in 
\unexpanded\def\in   {\mathortext\normalmathin   \dospecialin   } \fi
\ifx\at   \undefined\else \let\normalmathat   \at 
\unexpanded\def\at   {\mathortext\normalmathat   \dospecialat   } \fi
\ifx\about\undefined\else \let\normalmathabout\about 
\unexpanded\def\about{\mathortext\normalmathabout\dospecialabout} \fi
\ifx\from \undefined\else \let\normalmathfrom \from 
\unexpanded\def\from {\mathortext\normalmathfrom \dospecialfrom } \fi
\ifx\over \undefined\else \let\normalmathover \over 
\unexpanded\def\over {\mathortext\normalmathover \dospecialabout} \fi

\fi


(added \unexpanded). This is certainly useful for \in and \over, maybe not 
so much for the other three.


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


Re: [NTG-context] Value of Metapost variable as a label

2009-03-22 Thread Eythan Weg

Curious Learn curiousle...@gmail.com
Sat, 21 Mar 2009 22:40:46 + (UTC)

   Aditya Mahajan adityam at umich.edu writes:
   

 For example, if I had to typeset (n_{1},n{2},...,n_{100}), how
 could I do that.

label.bot (textext($n_{  decimal i  }), ... ) ;

This however fails:
k:=2; 
label.bot(textext($1\over  decimal k  $), (10,0)) ; 

with this error:

6401a0e1a39f3ee04c60209dc5/formats/cont-en-metafun.mem
! Use of \dospecialabout doesn't match its definition.
l.1 \MPLIBsettext{415}{$1\dospecialabout 2
  $}
\processMPgraphic ...e \MPuserinclusions ;\!!es )}
  \global \settrue \METAFUNi...

___
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
___


Re: [NTG-context] Value of Metapost variable as a label

2009-03-22 Thread Mojca Miklavec
 This however fails:
 k:=2;
 label.bot(textext($1\over  decimal k  $), (10,0)) ;

Try with \frac instead.

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
___


Re: [NTG-context] Value of Metapost variable as a label

2009-03-22 Thread Aditya Mahajan

On Mon, 23 Mar 2009, Mojca Miklavec wrote:


This however fails:
k:=2;
label.bot(textext($1\over  decimal k  $), (10,0)) ;


Try with \frac instead.


Or prevent expansion of \over

label.bot(textext($1\noexpand\over  decimal k  $), (10,0)) ;


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


[NTG-context] Value of Metapost variable as a label

2009-03-21 Thread Curiouslearn
Hello,

First of all, Mojca thanks very much for the update about TikZ. (I could not
find an option to reply in Context Garden mailing list).

My new question is the following. I have the following code to generate the
labels for the tick marks:

for i = 0 step 5 until 45:
draw (i,0)*u -- (i,-0.2)*u;
label.bot(decimal(i) ,(i,-0.2)*u);
endfor;

As you can see I use decimal(i) to get the labels (0,5,10,... and so on).
But the font of these numbers is not the same as when I use the btex
label_text etex command, which I have set to palatino. How can I typeset
the value of Metapost variables (such as i in this case), using tex
commands. For example, if I had to typeset (n_{1},n{2},...,n_{100}), how
could I do that.

On page 63 of John Hobby's metapost manual, he talks about how this could be
achieved using TEX.mp. I tried typing \input TEX before \starttext, however,
I get the error I can't find file `TEX;' If I put it within the
\startuseMPgraphic  and \stopuseMPgraphic, it still does not work. Do I have
to download this from somewhere or does Context have another solution?

Thanks very much.
___
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
___


Re: [NTG-context] Value of Metapost variable as a label

2009-03-21 Thread Aditya Mahajan

On Sat, 21 Mar 2009, Curiouslearn wrote:


Hello,

First of all, Mojca thanks very much for the update about TikZ. (I could not
find an option to reply in Context Garden mailing list).

My new question is the following. I have the following code to generate the
labels for the tick marks:

for i = 0 step 5 until 45:
   draw (i,0)*u -- (i,-0.2)*u;
   label.bot(decimal(i) ,(i,-0.2)*u);
endfor;

As you can see I use decimal(i) to get the labels (0,5,10,... and so on).
But the font of these numbers is not the same as when I use the btex
label_text etex command, which I have set to palatino. How can I typeset
the value of Metapost variables (such as i in this case), using tex
commands.


label.bot (textext(decimal(i)), (...)) ;


For example, if I had to typeset (n_{1},n{2},...,n_{100}), how
could I do that.


label.bot (textext($n_{  decimal i  }), ... ) ;

etc.


On page 63 of John Hobby's metapost manual, he talks about how this could be
achieved using TEX.mp. I tried typing \input TEX before \starttext, however,
I get the error I can't find file `TEX;' If I put it within the
\startuseMPgraphic  and \stopuseMPgraphic, it still does not work. Do I have
to download this from somewhere or does Context have another solution?


Use textext.

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


Re: [NTG-context] Value of Metapost variable as a label

2009-03-21 Thread Curious Learn
Aditya Mahajan adityam at umich.edu writes:

 
  For example, if I had to typeset (n_{1},n{2},...,n_{100}), how
  could I do that.
 
 label.bot (textext($n_{  decimal i  }), ... ) ;


Thanks Aditya. That works great.


___
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
___