[LON-CAPA-users] Algebra Expression Rendering in LON-CAPA
Damien Guillaume
damieng at msu.edu
Tue Jan 17 15:57:11 EST 2017
> 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.
More information about the LON-CAPA-users
mailing list