http://thornahawk.unitedti.org/equationeditor/equationeditor.php
Any input would be appreciate it, thanks
Thornahawk is probably using LatexRender and your Moodle is likely using mimeTeX (where, to be fair, the image quality isn't that great). There are some instructions on how to integrate LatexRender and Moodle here...
http://nte.unifr.ch/blog/2005/04/18/integrating_latexrender_in_moodle/
The article is a bit out of date but it should give you an idea of what you need to do.
Hope this makes sense.
Ian.
Here is the link: http://tracker.moodle.org/browse/MDL-19228
Yes, the main reason for poor output is usually Mimetex - almost any other distribution of latex could produce better quality images but I suppose you did not have the option to install or use other Latex.
It is possible to set latex to use png images instead of gif images, change dpi{dots-per-inch}, gammacorrection, fonts etc but in built-in Mimetex you can only set dpi from your tex filter settings or files of tex filter.
in Codecogs and the same with TeX filter here in moodle.org $$ f(x)=\int_{-\infty}^x e^{-t^2}dt $$
I'm just playing around with LaTeX rendering on one of our (Ubuntu) servers. I've got the TeX filter configured so that the paths to the latex, dvips and convert binaries are set up correctly. I think it should be using these binaries instead of mimeTeX but how do I tell?
Also, I've tried editing latex.php, filter.php and pix.php so that it creates PNGs instead of GIFs (following the instructions given here). The file extension is now PNG but the file itself is still a GIF . Any idea how I can force it to definitely create a PNG?
Thanks in advance,
Ian.
1) In file texed.php change:
$image = md5($texexp) . ".gif";
$filetype = 'image/gif';
to
$image = md5($texexp) . ".png";
$filetype = 'image/png';
2) In file pix.php change:
$md5 = str_replace('.gif','',$image);
to
$md5 = str_replace('.png','',$image);
3) in file latex.php two changes:
$gif = "{$this->temp_dir}/$filename.gif";
to
$gif = "{$this->temp_dir}/$filename.png";
and
unlink( "{$this->temp_dir}/$filename.gif" );
to
unlink( "{$this->temp_dir}/$filename.png" );
4) In file filter.php
$filename = $md5 . ".gif";
to
$filename = $md5 . ".png";
Note also that in 3) name of variable is $gif - not $png... but I think you may need 1) to get the correct file type.
You could test if your site if using Mimetex or the other distribution of LaTeX with some commands that do work in that other distribution but do not (both) work in Mimetex, try for example \diamondsuit\diamond\Diamond - Mimetex should not recognize the first one but for example TexLive gives 3 diamonds
(attached the same file as 300 dpi png file)
I've still got problems, though
Moodle is still insisting on using mimeTeX to render the notation. Strangely, if I try the "Show command execution..." option in texdebug.php then everything seems to work fine and the image is created properly (as a png) using ghostscript, &c.. But if I try to include math in the course then it is definitely using mimeTeX. If I move the mimeTeX binary then nothing gets rendered at all. I've tried playing around with permissions but to no avail.
Any idea what's going wrong? I've been trying to get this to work for hours and I'm beginning to get a bit depressed...
Ian.
After much fiddling around in the tex filter code I found the problem: for some reason the line that runs the command to convert the .ps file to a .png (in my case) had become wrapped - i.e. had a carriage return in the middle of it. We've no idea how that happened.
Thanks for all your help Mauno . Everything is now behaving as it should.
Cheers,
Ian.
This happens way too frequently, more often than not through the use of windows based editors (tell me you weren't editing the linux server files with an MS Windows editor - LOL) and unfortunately it is usually a matter of self-abuse.... If it makes you feel any better I often use a text editor on a system which opens files in insert overwrite mode and as a result I was blowing a way the first few characters of a file when I opening it and tried to page down. Of course this is disastrous for files used with a scripting language that requires initial characters.... and since I had no reason to inspect the first few characters, this drove me nuts until I figured out what I was doing to myself......
Obviously I'm glad that a problem that is likely due to my own incompetence hasn't been recorded in detail on a public, immensely popular, international forum...
Doh
Just a note - I was able to configure Latex correctly on my Ubuntu server.
Red Hat might have some security module (SeLinux?) on or you may need to change some permissions for executable binaries - my Debian Lenny had no problems with TeX Live but I have not been able to install it to Windows Vista so far - or basicly everything seems to be ok but "something" just does not work with Vista like in Debian.
Can I take it that you have reviewed the docs regarding the tex filter, including this URL, http://docs.moodle.org/en/TeX_filter, and having done so you used the debugging feature found here: http://docs.moodle.org/en/TeX_filter#Debugging_TeX_filter? Because had you done so I would have expected you to have provided the results of those efforts so that we could have some idea of what you have done and what you have not done.
I really have no idea what, "I tried changing the various php files given on moodle.org and the latex/mimetext still renders poorly." means, and of course I haven't a clue as to what you read or did. Moreover, if you place x^2 between doubledollars and it does not render as $$x^2$$ then it is not a matter of your text expressions, but a matter of your Tex configuration, which can be addressed via the materials identified above.....
Warning: is_file() [function.is-file]: open_basedir restriction in effect. File(/usr/bin/latex) is not within the allowed path(s): ('.:/proc/uptime:/tmp:/home:/usr/local/lib/php:/usr/home:/usr/local:/usr/local/bin') in /home/satma1/public_html/filter/tex/texdebug.php on line 189
Warning: is_file() [function.is-file]: open_basedir restriction in effect. File(/usr/bin/dvips) is not within the allowed path(s): ('.:/proc/uptime:/tmp:/home:/usr/local/lib/php:/usr/home:/usr/local:/usr/local/bin') in /home/satma1/public_html/filter/tex/texdebug.php on line 196
Warning: is_file() [function.is-file]: open_basedir restriction in effect. File(/usr/bin/convert) is not within the allowed path(s): ('.:/proc/uptime:/tmp:/home:/usr/local/lib/php:/usr/home:/usr/local:/usr/local/bin') in /home/satma1/public_html/filter/tex/texdebug.php on line 203
Fatal error: Call to undefined function tex_sanitize_formula() in /home/satma1/public_html/filter/tex/latex.php on line 49
Also, note that in my settings for tex notation, the paths all have red Xs, which the debug warning states.
open-basedir restrictions used to be much more common with some php apps in shared environments, but hopefully won't prevent you from resolving your problem. If you do a web search on "php.ini open_basedir" you will find lots of resources explaining how open_basedir can be turned off or adjusted via php.ini Check your php.ini and see if open_basedir is set. If it is then you can change it to add the full paths to your three binaries (and take the time to make sure that the binaries are in fact there!). If its not set and you are in a hosted situation then you may need to talk to your webhost about whether you can override it through a custom php.ini
You can also address the issue via apache. Here is a discussion that addresses changing open_basedir settings via your apache conf file:
http://www.mydigitallife.info/2007/03/15/php-scripts-open_basedir-restriction-in-effect-error/
Oddly, I do not have a php.ini file in my moodle site. But I do have it for our dummy site. Both sites were set up the same way. We never added a php.ini in our old (dummy) site, but our new one does not have this. The php.ini file is the file inside the public_html folder correct?
I also noticed that inside the php.ini, there is no mention of a open_basedir or paths. We tried talking to our webhost and they were of little help.
How can I override it through a custom php.ini?
In order to render latex not mimetex, do I need to download and install something onto my moodle or is it just a matter of changning the paths? If so, why doesn't moodle just allow the paths to render latex out of the box?
If I wanted to use apache or something, can I just go into cPanel? I saw something for apache in cPanel, but did not see anything about paths or open_basedir.
Sorry for my lack of knowledge. I appreciate your help so much.
2. In the interim, either install asciimathml or mathjax
3. If you install ascimathml, consider fallback to google chart API so as to avoid any other issues you may be having with mimetex
You can as well go for example to http://www.codecogs.com/components/equationeditor/equationeditor.php
- write your TeX - and click the rendered image to save it and upload to your moodledata.
Quality is much better that with TeX filter... this image is saved as 300 dpi png
Also, there is a blue box around the expression -- how do I get rid of it?
If you have some blue boxes around equations they are most likely image borders that might come from your editor or theme css - check if source come has some code like border: blue solid 1px near your equations.
Because those equation are normal images you can use for example vertical alignment in css (or latex itself) - but here in moodle.org the vertical-align style attribute is cut away...
Integral with tex filter in moodle.org is vertically aligned to middle: $$ f(x)=\displaystyle\int_{-\infty}^x e^{-t^2}dt $$
If all your images have blue box around them the problem might be in config.php (empty rows or white spaces after last ?> or some of the paths is not correct ) etc - some other reason why theme/css is not properly rendered and images have 1px solid blue border although they should have 0px border in moodle.
Try the normal standard theme - does it show blue boxes too?
I have tried numerous themes and get the same result. It must be somewhere in the configuration, but since I don't have administrator rights, I can't try to fix it.
Do you have any suggestions about where to look for a problem in the setting so I can pass it on to the moodle administrators? I know they won't take the time to search, but maybe if I can point them in the right direction they would be willing to try.
If you don't have administrator rights you can't do much for this. Most likely those blue borders around images are caused by broken css that can be caused for example by wrong dirroot or wwwroot in config.php, some misconfiguration of server, whitespaces in config.php, some custom code that breaks css (typical for hacked sites) or probably your standard theme is some modified version and not the original standard theme from the original package.
I should see your site to be able to say anything for sure.