* Value of Metapost variable as a label
@ 2009-03-21 20:39 Curiouslearn
2009-03-21 22:04 ` Aditya Mahajan
0 siblings, 1 reply; 8+ messages in thread
From: Curiouslearn @ 2009-03-21 20:39 UTC (permalink / raw)
To: ntg-context
[-- Attachment #1.1: Type: text/plain, Size: 1145 bytes --]
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.
[-- Attachment #1.2: Type: text/html, Size: 1249 bytes --]
[-- Attachment #2: Type: text/plain, Size: 487 bytes --]
___________________________________________________________________________________
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
___________________________________________________________________________________
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: Value of Metapost variable as a label
2009-03-21 20:39 Value of Metapost variable as a label Curiouslearn
@ 2009-03-21 22:04 ` Aditya Mahajan
2009-03-21 22:40 ` Curious Learn
0 siblings, 1 reply; 8+ messages in thread
From: Aditya Mahajan @ 2009-03-21 22:04 UTC (permalink / raw)
To: mailing list for ConTeXt users
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
___________________________________________________________________________________
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: Value of Metapost variable as a label
2009-03-21 22:04 ` Aditya Mahajan
@ 2009-03-21 22:40 ` Curious Learn
2009-03-22 2:53 ` Eythan Weg
0 siblings, 1 reply; 8+ messages in thread
From: Curious Learn @ 2009-03-21 22:40 UTC (permalink / raw)
To: ntg-context
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
___________________________________________________________________________________
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: Value of Metapost variable as a label
2009-03-21 22:40 ` Curious Learn
@ 2009-03-22 2:53 ` Eythan Weg
2009-03-23 0:36 ` Mojca Miklavec
0 siblings, 1 reply; 8+ messages in thread
From: Eythan Weg @ 2009-03-22 2:53 UTC (permalink / raw)
To: ntg-context; +Cc: curiouslearn
Curious Learn <curiouslearn@gmail.com>
Sat, 21 Mar 2009 22:40:46 +0000 (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
___________________________________________________________________________________
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: Value of Metapost variable as a label
2009-03-22 2:53 ` Eythan Weg
@ 2009-03-23 0:36 ` Mojca Miklavec
2009-03-23 2:24 ` Aditya Mahajan
0 siblings, 1 reply; 8+ messages in thread
From: Mojca Miklavec @ 2009-03-23 0:36 UTC (permalink / raw)
To: mailing list for ConTeXt users
> 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
___________________________________________________________________________________
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: Value of Metapost variable as a label
2009-03-23 0:36 ` Mojca Miklavec
@ 2009-03-23 2:24 ` Aditya Mahajan
2009-03-24 1:57 ` Eythan Weg
0 siblings, 1 reply; 8+ messages in thread
From: Aditya Mahajan @ 2009-03-23 2:24 UTC (permalink / raw)
To: mailing list for ConTeXt users
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
___________________________________________________________________________________
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: Value of Metapost variable as a label
2009-03-23 2:24 ` Aditya Mahajan
@ 2009-03-24 1:57 ` Eythan Weg
2009-03-24 4:16 ` Aditya Mahajan
0 siblings, 1 reply; 8+ messages in thread
From: Eythan Weg @ 2009-03-24 1:57 UTC (permalink / raw)
To: ntg-context
Aditya Mahajan <adityam@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
___________________________________________________________________________________
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: Value of Metapost variable as a label
2009-03-24 1:57 ` Eythan Weg
@ 2009-03-24 4:16 ` Aditya Mahajan
0 siblings, 0 replies; 8+ messages in thread
From: Aditya Mahajan @ 2009-03-24 4:16 UTC (permalink / raw)
To: mailing list for ConTeXt users
On Mon, 23 Mar 2009, Eythan Weg wrote:
>
> Aditya Mahajan <adityam@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
___________________________________________________________________________________
^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2009-03-24 4:16 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-03-21 20:39 Value of Metapost variable as a label Curiouslearn
2009-03-21 22:04 ` Aditya Mahajan
2009-03-21 22:40 ` Curious Learn
2009-03-22 2:53 ` Eythan Weg
2009-03-23 0:36 ` Mojca Miklavec
2009-03-23 2:24 ` Aditya Mahajan
2009-03-24 1:57 ` Eythan Weg
2009-03-24 4:16 ` 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).