[Register]
Powered by Elgg

Plugins :: Blog :: Latex plugin: latex rendering

March 01, 2007

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 

Keywords: latex, plugin, problem

Posted by Rolando Espinoza La Fuente @ Plugins


Comments

Page: 1 2
  1. Could you show this Gif file?

    I think you want type [tex]\LaTeX[/tex] (wich shows this) instead of [tex]\latex[/tex]. 

    user iconTom on Thursday, 01 March 2007, 19:11 UTC # |

  2. just a thought, but could you define a class for latex in the css and/or include an element in the blogpost display file that controls the size and span (similar to how it's done for video or other images?)

    user icondaveinboston on Thursday, 01 March 2007, 21:02 UTC # |

  3. Hey, how did you set it up? I even posted a question two days ago. It didn't work on mine, and nobody answered! The world is so unfair :crying:

    user iconBill Dexter on Thursday, 01 March 2007, 21:10 UTC # |

  4. #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. 

    user iconRolando Espinoza La Fuente on Thursday, 01 March 2007, 21:33 UTC # |

  5. If you read my post, you can see that I've followed the exact instructions; nothing comes up, and nothing is showing in TinyMCE either. Honestly, I'm totally lost :(

    user iconBill Dexter on Friday, 02 March 2007, 00:01 UTC # |

  6. Maybe you can try revert the installation and start again, without the tinymce part.

    user iconRolando Espinoza La Fuente on Friday, 02 March 2007, 01:36 UTC # |

  7. You got the plugin from http://pccepa3.if.usp.br/trac/demi/browser/trunk/elgg/mod/latex/, right?

    user iconBill Dexter on Friday, 02 March 2007, 03:42 UTC # |

  8. BTW, i have problems rendering formulas like:

    f(x) =
    \begin{cases}
    1 & -1 \le x < 0 \\
    \frac{1}{2} & x = 0 \\
     1 - x^2 & 0 < x\le 1

     Example from http://meta.wikimedia.org/wiki/Help:Formula

    user iconRolando Espinoza La Fuente on Friday, 02 March 2007, 15:41 UTC # |

  9. But did you get your plugin from that page or somewhere else? Because mine is still not working no matter what I do with it.

    user iconBill Dexter on Friday, 02 March 2007, 20:42 UTC # |

  10. #9 from svn repo elgg-plugins

    user iconRolando Espinoza La Fuente on Friday, 02 March 2007, 21:37 UTC # |

  11. So, you click on the Latex Tarball link [http://www.alia.org.uk/~sven/elgg/WebSVN/listing.php?repname=E Plugins SVN repository&path=%2Flatex%2F&rev=0&sc=0], download it and copy it to your server? That's it?

    user iconBill Dexter on Saturday, 03 March 2007, 00:36 UTC # |

  12. 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. 

    user iconEwout ter Haar on Saturday, 03 March 2007, 00:54 UTC # |

  13. 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.

    user iconEwout ter Haar on Saturday, 03 March 2007, 00:56 UTC # |

  14. 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?

    user iconBill Dexter on Saturday, 03 March 2007, 04:58 UTC # |

  15. 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.

    user iconBill Dexter on Saturday, 03 March 2007, 05:14 UTC # |

  16. /home/my_user_name/elggdata not should be /home/.orwell/my_user_name/elggdata ? 

    user iconRolando Espinoza La Fuente on Saturday, 03 March 2007, 16:43 UTC # |

  17. Yeah, it's just how DreamHost [my webhost] sets it all up. I don't know what this .orwell thing is.

    user iconBill Dexter on Saturday, 03 March 2007, 22:21 UTC # |

  18. 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.

    user iconRenato on Monday, 05 March 2007, 06:48 UTC # |

  19. 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... 

    user iconRenato on Monday, 05 March 2007, 07:30 UTC # |

  20. 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('&nbsp;', ' ', $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]

    user iconRolando Espinoza La Fuente on Monday, 05 March 2007, 20:38 UTC # |

Page: 1 2

You must be logged in to post a comment.

Site supported by Curverider Ltd - powered by the awesome Elgg