[LON-CAPA-users] Evaluation of variable in tex mode

H. K. Ng lon-capa-users@mail.lon-capa.org
Wed, 01 Oct 2003 08:49:43 -0400

When printing the script below, the symbol $x$ is replaced with the value 
of $x. So if $x = 4, it displays the following:

...along the 4$-axis from 0 to 4.

whereas it should be

...along the x-axis from 0 to 4.

(with the letter x slanted).
Question: How can I use the same "name" in the display and as a variable?

<script type="loncapa/perl">

<startouttext />
A particle moves along the <display>&tex('$x$','x')</display>-axis from 0 
to $x.
<endouttext />