[LON-CAPA-users] tex(maxima_expression)
Gerd Kortemeyer
korte at lite.msu.edu
Thu Feb 16 14:03:57 EST 2012
Hi,
You can also use the tex1()-command in MAXIMA,
$texformula=&cas('maxima',"tex1($formula)");
The output is in inline-format, and I don't like the way it renders fractions, so the coming lines fix that:
$texformula=~s/\\\\/\\/gs;
$texformula=~s/^\"//;
$texformula=~s/\"$//;
$texformula=~s/\{([^\{]+)\}\\over\{([^\}]+)\}/\\frac\{$1\}\{$2\}/gs;
and then
<m eval="on" display="mimetex">\[$texformula\]</m>
I might package that into a convenient function call later.
- Gerd.
On Feb 16, 2012, at 12:42 PM, Stefan Bisitz wrote:
> Hi,
>
> The <algebra> tag takes cares of pretting up the output of formulas using the preferred formular display style (see personal preferences and course settings):
> ----------------
> <problem>
>
> <script type="loncapa/perl">
> $c=1;
> $d=4;
> $f = &cas('maxima', "trigsimp(abs(f(x+$c)) + $d)");
> </script>
>
> <startouttext />
> <algebra>$f</algebra>
> <endouttext />
>
> </problem>
> ----------------
>
>
> Stefan Bisitz
>
> Am 16.02.2012 18:31 schrieb Seema Ali:
>> I get Maxima to pretty up an expression:
>> $fx = &cas('maxima', "trigsimp(abs(f(x+$c)) + $d)");
>>
>> Example: $fx = abs(f(x+1)) - 4
>>
>> And I'd like to display it like: |f(x+1)| - 4 instead of abs(f(x+1)) -
>> 4. Is that possible? In one of the manuals it said that tex(a,b) was not
>> implemented in LON CAPA.
>>
>> Thanks.
>>
>>
>>
>> _______________________________________________
>> LON-CAPA-users mailing list
>> LON-CAPA-users at mail.lon-capa.org
>> http://mail.lon-capa.org/mailman/listinfo/lon-capa-users
>
> _______________________________________________
> 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