[LON-CAPA-users] Algebra Expression Rendering in LON-CAPA

Harding, Gene L glhardin at purdue.edu
Tue Jan 17 21:26:40 EST 2017


Thanks Damien--that worked nicely! And thanks to everyone who responded with help. I should have posed these questions to the list earlier...would have saved me a lot of time!

Best regards,

Gene L. Harding, PE
Associate Professor of ECET
574-520-4190
Purdue University-South Bend


-----Original Message-----
From: lon-capa-users-bounces at mail.lon-capa.org [mailto:lon-capa-users-bounces at mail.lon-capa.org] On Behalf Of Damien Guillaume
Sent: Tuesday, January 17, 2017 3:57 PM
To: Discussion list for LON-CAPA users <lon-capa-users at mail.lon-capa.org>
Subject: Re: [LON-CAPA-users] Algebra Expression Rendering in LON-CAPA


> Thanks Damien! That is very helpful. Is there an easy way to display 
> the large numbers with commas (e.g., 32000 -> 32,000)? I tried a 
> couple of different format commands using ",0f", but neither worked. 
> Also, is there a good reference out there to help novices like me with 
> the syntax for these commands? I'm having a hard time keeping the xml, 
> perl, tex, etc. straight. (And have wasted a LOT of time trying to 
> figure it out.)

You are not the only one. Currently your best help for LON-CAPA specific syntax is the author manual at /adm/help/author.manual.pdf . For XML, Perl and TeX, you will have to look at other documentations on the web.

I found that &prettyprint (which is mentionned in the author manual) works for me to get commas, for instance:

<m eval="on" display="mathjax">$$ \frac{$numer}{$denom} \left[ \pi + \sum_{n=1}^{\infty} \frac{$sum_numer}{$sum_denom_n_coeff n - $sum_denom_const} \cdot \sin(&prettyprint($w,',0f') nt) \right] $$</m>

It also works when you call it within a Perl script, for instance:
<script type="loncapa/perl">
...
$pretty_w = &prettyprint($w,', 0f');
$function= "\\frac{$numer}{$denom} \\left[ \\pi + \\sum_{n=1}^{\\infty} \\frac{$sum_numer}{$sum_denom_n_coeff n - $sum_denom_const} \\cdot \\sin($pretty_w nt) \\right]"; </script>

<m eval="on" display="mathjax">$$ $function $$</m>

Damien

PS: I meant 'eval="on"' instead of 'eval="true"' in my previous email.
_______________________________________________
LON-CAPA-users mailing list
LON-CAPA-users at mail.lon-capa.org
http://mail.lon-capa.org/mailman/listinfo/lon-capa-users


More information about the LON-CAPA-users mailing list