Hi, i'm testing latex plugin. Works ok, except when i put [tex]\latex[/tex] it's render a big 1020x1320px Gif file.
Anyone have the same problem, or it's my installation?
Im testing on ubuntu edgy with imagemagick and tetex-base installed
Hi, i'm testing latex plugin. Works ok, except when i put [tex]\latex[/tex] it's render a big 1020x1320px Gif file.
Anyone have the same problem, or it's my installation?
Im testing on ubuntu edgy with imagemagick and tetex-base installed
Posted by Rolando Espinoza La Fuente @ Plugins
You must be logged in to post a comment.
Site supported by Curverider Ltd - powered by the awesome Elgg
Comments
Could you show this Gif file?
I think you want type [tex]\LaTeX[/tex] (wich shows this) instead of [tex]\latex[/tex].
#1 thanks, \LaTeX works ok. But \latex render to a big 1020x1320px blank gif.
#3 I just follow the instructions, in first stage doesn't show anything. So, on ubuntu, i need to install the next packages: imagemagick, tetex-bin, tetex-extra, gs
Then works right.
BTW, i have problems rendering formulas like:
Example from http://meta.wikimedia.org/wiki/Help:Formula
Bill, in your original post you mentioned that you were on shared hosting. Are you sure that they have a latex distribution installed? The plugin does not do the actual conversion from latex to image, it relies on utilities from the operating system for that. Do you have shell acess? can you try the command latex, or convert, or identify or dvips on the command line? Are they there?
Don' t worry about the tinymce button, that it not necessary to make it work. Just test with a simple latex expression, like this: [tex]e^{i\pi} + 1 =0[/tex]
Check your directory $CFG->dataroot/latex, $CFG->dataroot/latex/pictures, etc to see if the gif files are being generated.
Rolando,
We also get the big gif as a result of an empty [tex][/tex] tag. Its a bug, not yet solved. If you find anything before us, let us know.
Do you have shell acess? Can you try the command latex, or convert, or identify or dvips on the command line? Are they there?
- I do have the shell access; I typed latex, it gave me This is e-TeX, Version 3.14159-2.1 (Web2C 7.4.5). No idea what this is. Typed convert - Version: ImageMagick 6.2.4 09/16/06. identify - the same. dvips - This is dvips(k) 5.92b Copyright 2002 Radical Eye Software (www.radicaleye.com). Missing DVI file argument (or -f).
Check your directory $CFG->dataroot/latex, $CFG->dataroot/latex/pictures, etc to see if the gif files are being generated.
- I've created them manually, and they're all 777.
Don' t worry about the tinymce button, that it not necessary to make it work.
- Yeah, I understand; however, I want the students to be able to easily post their problems/solutions/suggestions.
-UPDATE: Holy @#$%! It worked! Thanks for that magic link! But how could I get the button to show anyway?
Ok, it works partially: it renders some equations [actually all of them], and gives out this message at the top of the page:
unlink(/home/my_user_name/elggdata/latex/tmp/d2d3a946c48ab5d49dcce8643af16d37.gif)[function.unlink]. No such file or directory in /home/.orwell/my_user_name/my_website/mod/latex/class.latexrender.php on line 293. It's supposed to be an image, but...no.
/home/my_user_name/elggdata not should be /home/.orwell/my_user_name/elggdata ?
Well, I did a little workaround. Don't know exactly why the 1x1 image is seen by the browser as a big image, but now it simply is not showed (you have to clean up the cache in dataroot/latex/pictures to get away with the old ones).
I also changed the behavior when the code is unparseable (and also in that case of empty image) - now it shows all the code, along with the [tex] tags.
You can get the code at http://pccepa3.if.usp.br/trac/demi/browser/trunk/elgg/mod/latex or http://www.alia.org.uk/~sven/elgg/WebSVN/dl.php?repname=Elgg%2
(they are synchronized).
The tinymce button is nice, but it doesn't work in IE6 (don't know about 7), just firefox. If anyone knows a solution, please do tell me.
A big unresolved problem is: html tags are not stripped. For example, the formula that Rolando posted above works if he write everything in one line and close \end{cases}. The <p>s mess with the tex code, but what if I'm talking about the mean value of p? How to tell the html <p>s from the tex ones? Maybe the user will have to use the code mode or write in a single line.
Weird that it took so long for this show up...
This code seems to works ok:
[code]
for ($i=0; $i < count($tex_matches[0]); $i++) {$pos = strpos($text, $tex_matches[0][$i]);
// get formula and replace blank spaces
$latex_formula = str_replace(' ', ' ', $tex_matches[1][$i]);
// decode html entities
$latex_formula = html_entity_decode($latex_formula);
// convert to new-line <p> and <br>
$latex_formula = preg_replace('#<p\\s*?/??>#i', '', $latex_formula);
$latex_formula = preg_replace('#</p\\s*?/??>#i', "\n", $latex_formula);
$latex_formula = preg_replace('#<br\\s*?/??>#i', "\n", $latex_formula);
// strip tags
//$latex_formula = strip_tags($latex_formula);
$url = $latex->getFormulaURL($latex_formula);
[/code]