WeBWorK Main Forum

TeX symbol as label in graph

TeX symbol as label in graph

by Tim Alderson -
Number of replies: 1
Greetings,

I am a beginner to authoring problems, and have had much success learning from the existing problem bank(s).  However, I can not seem to find an example (nor modify an existing one) to display TeX symbols as labels in (dynamically generated) graphs.

For example, to label an angle with \theta, or more generally to label a curve by combining TeX symbols with scalars:  $a\theta^3  

For simple situations such as $ax^2 I have an inelegant way of doing it, but I think there is likely a better way.

Any help would be most appreciated..Thanks!  
In reply to Tim Alderson

Re: TeX symbol as label in graph

by Tim Alderson -
Please note that in my question, $a denotes a scalar (which varies with seed), it is not intended to initiate LaTeX "math mode".

I can display linear equations within the graph using

Context("Numeric");
$a = random(3,9,1);
$x="x";
$ftex = "$a$x+1";

And then within the graph, provide:

 $label4=  new Label(3.2 , 2 , $ftex,'black',('center','center'));
 $graph1 -> lb($label4);

(improvements welcome!)

But can not figure out how to get a formatted LaTeX expression to appear (specifically one involving symbols or letters such as \theta).

Thanks.