[LON-CAPA-users] Algebra Expression Rendering in LON-CAPA
Harding, Gene L
glhardin at purdue.edu
Fri Jan 13 23:41:10 EST 2017
Hi Damien,
Thanks for your reply. At least now I know that I was chasing the wind. I was able to get close by using Sigma in place of sum in the expression, but then only the "n" was subscripted, not the "=1" part, even though I used braces: _{n=1}...
I had initially tried to render the equation in the xml portion of the problem, but when I did that I had a lot of trouble properly displaying some of the variables using the <m>$...$</m> command. It worked in some places but not others.
This is as close as I have been able to get to a proper expression:
[cid:image001.png at 01D26DF0.DF719FF0]
In the xml portion I have been able to render it nicely:
[cid:image002.png at 01D26DF6.82F21010]
...but only if I hard-code the constants in the two fractions and inside the sine. Is there a way to display variable values from the perl script in place of the constants? I have tried a few things, but all were unsuccessful.
Thanks,
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: Friday, January 13, 2017 10:17 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
> This is the call from the xml to render it:
>
> <center> <algebra>$function</algebra></center>
The algebra element has its own syntax. I do not know if it is documented, but we can look at the code at
http://source.lon-capa.org/cgi-bin/cvsweb.cgi/loncom/xml/algebra/AlgParser.pm?rev=1.18
The regular expressions used to recognized functions are:
my $trigfname = '(?:(?:a(?:rc)?)?(?:sin|cos|tan|sec|csc|cot)h?)';
my $otherfunc =
'(?:exp|abs|logten|log|ln|sqrt|sgn|step|fact|int|lim|fun[a-zA-Z])';
There is no sum. To display a sum, you could use the TeX syntax as Gerd suggested, within <m>$ $</m>.
Damien
_______________________________________________
LON-CAPA-users mailing list
LON-CAPA-users at mail.lon-capa.org<mailto:LON-CAPA-users at mail.lon-capa.org>
http://mail.lon-capa.org/mailman/listinfo/lon-capa-users
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.lon-capa.org/pipermail/lon-capa-users/attachments/20170114/7ceb8f3f/attachment-0001.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: image001.png
Type: image/png
Size: 4952 bytes
Desc: image001.png
URL: <http://mail.lon-capa.org/pipermail/lon-capa-users/attachments/20170114/7ceb8f3f/attachment-0002.png>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: image002.png
Type: image/png
Size: 5810 bytes
Desc: image002.png
URL: <http://mail.lon-capa.org/pipermail/lon-capa-users/attachments/20170114/7ceb8f3f/attachment-0003.png>
More information about the LON-CAPA-users
mailing list