How about a plugin adding a [[preprocessor_directive|preprocessordirective]] to render some given LaTeX and include it in the page? This could either render the LaTeX as a PNG via [[debpkg dvipng]] and include the resulting image in the page, or perhaps render via [HeVeA](http://pauillac.inria.fr/~maranget/hevea/index.html), [TeX2page](http://www.ccs.neu.edu/~dorai/tex2page/tex2page-doc.html), or similar. Useful for mathematics, as well as for stuff like the LaTeX version of the ikiwiki [[/logo]]. ---- ikiwiki could also support LaTeX as a document type, again rendering to HTML. ---- Conversely, how about adding a plugin to support exporting to LaTeX? >> I did some tests with using Markdown and a customized HTML::Latex and html2latex >> and it appears it will work for me now. (I hope to use ikiwiki for many >> to collaborate on a printed book that will be generated at least once per day in PDF format.) >> >> --JeremyReed >>> Have a look at [pandoc](http://code.google.com/p/pandoc/). It can make PDFs via pdflatex. --[[roktas]] ---- [here](http://ng.l4x.org/gitweb/gitweb.cgi?p=ikiwiki.git/.git;a=blob;f=IkiWiki/Plugin/latex.pm) is a first stab at a latex plugin. Examples [here](http://ng.l4x.org/latex/). Currently without image support for hevea. And the latex2html output has the wrong charset and no command line switch to change that. Dreamland. ---- Okay, now is the time for a mid term report i think. The LaTeX Plugin for ikiwiki is now usable, except for the security check. This means at the moment the latex code is not validated, but only added into a very basic latex template. and the image is generated via this path: latex -> dvips -> convert (.tex -> .dvi -> .ps -> .png). The resulting .png is moved into the imagefolder. The name of this image is the md5hash of the code the user wrote into the wiki. So on a second run there is no need to recreate this image, if it exists. This will fasten up all but the first generation of the page. The generation of the image is done in an temporary folder in /tmp created with tempdir from File::Temp. The tmp-folder name is something like: $md5sumdigest.XXXXXXXX. if there is an .tex file already in this dir it will be overwritten. So until now i finished the basic things, now the most important task is to make an good input validation. This is a bit eased since it is not possible to execute shell commands in perl. Furthermore adding additional packages won't work since the code comes from the user is inserted after \begin{document}. Therefore this will result in an error (and this will stop latex from working --> no image is created). So my task for the next weeks is to write an good input validation. I think this progress is okay, since I'll had to learn the last 5-6 weeks for my final exams in university therefore I can't do anything. From now on I have 3 months of freetime and I'll use them to work heavily on this plugin. So I think I'm inside my own timetable. :) ps: Since I found nothere the possibility to upload an file, here is an link to my page where you can have a look. Comments are very welcome ;-) https://www.der-winnie.de/~winnie/gsoc07/tex.pm You'll find an demo site here: https://www.der-winnie.de/wiki/opensource/gsoc2007/ I'll add some more complex formulas over the days. But this is basically only pure latex. ;-) -- Patrick Winnertz > Looks like you're very well on schedule. > I wonder, do you have any plans to work on the latex to html side of > things too? This page kinda combines both uses of latex; creating gifs > for formulas etc, and creating html. Dreamland already has a latex2html > using plugin submitted above, but it still needs some work, and > particularly, needs the same input validation stuff. > The main problem I see with the code is that you seem to unnecessarily create a dummy div tag > in preprocess, and then in format you call create(), which generates an img tag. So, why not > just create the img tag in preprocess? > Another problem: Looks like if latex fails to create the image, the user won't be shown any > of its error message, but just "failed to generate image from code". I suspect that in this > case being able to see the error message would be important. > The url handling could stand to be improved. Currently it uses $config{url}, so it depends on that being set. Some ikiwiki builds don't have an url set. The thing to do is to use urlto(), to generate a nice relative url from the page to the image. > Another (minor) problem with the url handling is that you put all the images in a "teximages" directory in the toplevel of the wiki. I think it would be better to put each image in the subdirectory for the page that created it. See how the `img` and `sparkline` plugins handle this. > It looks like if the tempdir already exists, tempdir() will croak(), thus crashing ikiwiki. It would be good to catch a failure there and fail more gracefully. > I'm not sure why you're sanitising the PATH before calling latex. This could be problimatic on systems where latex is not in /bin or /usr/bin. > --[[Joey]] ---- [[tag soc]]