ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
* Gnuplot and the dollar sign
@ 2012-01-28  8:16 Janne Junnila
  2012-01-28 10:23 ` Mojca Miklavec
  0 siblings, 1 reply; 3+ messages in thread
From: Janne Junnila @ 2012-01-28  8:16 UTC (permalink / raw)
  To: ntg-context

Hi!

I'm having trouble while trying to make the following work:

\usemodule[gnuplot]

\startGNUPLOTscript[distr_simple_1]

plot "2_simple_1.out" using
(0.01*floor($1/0.01)):(0.870456/100000/0.01) smooth frequency with
boxes, (cos(2*x)*sin(0.5*x) + 1)*exp(-0.4*x)
\stopGNUPLOTscript

\useGNUPLOTgraphic[distr_simple_1]

The problem seems to be that the single dollar sign gets interpreted
as the start of a math environment. I tried to look through the source
code to see how I could tell context to bypass checking for certain
characters, but I couldn't figure it out.

Thanks for any hints!
Janne Junnila
___________________________________________________________________________________
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] 3+ messages in thread

* Re: Gnuplot and the dollar sign
  2012-01-28  8:16 Gnuplot and the dollar sign Janne Junnila
@ 2012-01-28 10:23 ` Mojca Miklavec
  2012-01-28 11:27   ` Janne Junnila
  0 siblings, 1 reply; 3+ messages in thread
From: Mojca Miklavec @ 2012-01-28 10:23 UTC (permalink / raw)
  To: mailing list for ConTeXt users

On Sat, Jan 28, 2012 at 09:16, Janne Junnila wrote:
> Hi!
>
> I'm having trouble while trying to make the following work:
>
> \usemodule[gnuplot]
>
> \startGNUPLOTscript[distr_simple_1]
>
> plot "2_simple_1.out" using
> (0.01*floor($1/0.01)):(0.870456/100000/0.01) smooth frequency with
> boxes, (cos(2*x)*sin(0.5*x) + 1)*exp(-0.4*x)
> \stopGNUPLOTscript
>
> \useGNUPLOTgraphic[distr_simple_1]
>
> The problem seems to be that the single dollar sign gets interpreted
> as the start of a math environment.

On one hand that is the intended default behaviour. It is very handy
to be able to use

plot (cos(2*x)*sin(0.5*x) + 1)*exp(-0.4*x) title '$\left(\cos(2x)
\cdot \sin(0.5x)\right+1) e^{-0.4x}$'

to get nice result. On the other hand I'm not exactly sure how to
reliably print whatever gets passed to ConTeXt. The only option that
comes to my mind is some modification of
    \sometxt{\starttyping floor($1/0.01) \stoptyping}
where \starttyping would generate a single line. But one would need a
special option for that. (The command \type{...} would not be reliable
enough: in MKII it stops working at the second underscore and it is a
problem if one has curly braces in text.)

> I tried to look through the source
> code to see how I could tell context to bypass checking for certain
> characters, but I couldn't figure it out.

Currently the only option is to provide an explicit title. But if
there's a request to support literal output and if somebody can help
me figure out how exactly I should output the given text into
metapost, so that it will be reliably printed out literally.

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


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Gnuplot and the dollar sign
  2012-01-28 10:23 ` Mojca Miklavec
@ 2012-01-28 11:27   ` Janne Junnila
  0 siblings, 0 replies; 3+ messages in thread
From: Janne Junnila @ 2012-01-28 11:27 UTC (permalink / raw)
  To: mailing list for ConTeXt users

Thank you for your reply!

I was actually able to find a workaround for my problem at least in
this case. Digging through the gnuplot documentation revealed that
instead of using $n to refer to the column n in a data file one can
also use column(n). The ConTeXt parser accepts this of course.

Janne Junnila

On Sat, Jan 28, 2012 at 12:23 PM, Mojca Miklavec
<mojca.miklavec.lists@gmail.com> wrote:
> On Sat, Jan 28, 2012 at 09:16, Janne Junnila wrote:
>> Hi!
>>
>> I'm having trouble while trying to make the following work:
>>
>> \usemodule[gnuplot]
>>
>> \startGNUPLOTscript[distr_simple_1]
>>
>> plot "2_simple_1.out" using
>> (0.01*floor($1/0.01)):(0.870456/100000/0.01) smooth frequency with
>> boxes, (cos(2*x)*sin(0.5*x) + 1)*exp(-0.4*x)
>> \stopGNUPLOTscript
>>
>> \useGNUPLOTgraphic[distr_simple_1]
>>
>> The problem seems to be that the single dollar sign gets interpreted
>> as the start of a math environment.
>
> On one hand that is the intended default behaviour. It is very handy
> to be able to use
>
> plot (cos(2*x)*sin(0.5*x) + 1)*exp(-0.4*x) title '$\left(\cos(2x)
> \cdot \sin(0.5x)\right+1) e^{-0.4x}$'
>
> to get nice result. On the other hand I'm not exactly sure how to
> reliably print whatever gets passed to ConTeXt. The only option that
> comes to my mind is some modification of
>    \sometxt{\starttyping floor($1/0.01) \stoptyping}
> where \starttyping would generate a single line. But one would need a
> special option for that. (The command \type{...} would not be reliable
> enough: in MKII it stops working at the second underscore and it is a
> problem if one has curly braces in text.)
>
>> I tried to look through the source
>> code to see how I could tell context to bypass checking for certain
>> characters, but I couldn't figure it out.
>
> Currently the only option is to provide an explicit title. But if
> there's a request to support literal output and if somebody can help
> me figure out how exactly I should output the given text into
> metapost, so that it will be reliably printed out literally.
>
> 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  : 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] 3+ messages in thread

end of thread, other threads:[~2012-01-28 11:27 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-01-28  8:16 Gnuplot and the dollar sign Janne Junnila
2012-01-28 10:23 ` Mojca Miklavec
2012-01-28 11:27   ` Janne Junnila

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