darkness

Monday, 05 December 2005

PmWiki is pretty cool

darkness @ 23:00:34

I tried MediaWiki to run a Wiki at school, but honestly I found I didn’t like it. I went back to PmWiki, which I used to dislike, but have come to like immensely. Furthermore, it seems to have added many cool and/or useful features, and seems to have quite a collection of plug-ins available. As usual, I’ll be explaining my setup of PmWiki on a Red Hat-related Linux distribution. This time, it’s CentOS 4.

PmWiki requires no database. Installation is pretty simple. If I recall correctly, I extracted the archive to my DocumentRoot directory, made a symbolic link from wiki to pmwiki-2.1.beta9. I cleaned up my URLs by following the directions on the CleanUrls page. Note that I did not use the Options +FollowSymLinks documented there.

Variables you’ll probably want to change: $WikiTitle, $ScriptUrl, $PubDirUrl (these last two might be necessary for me because of weird host name setups, plus the fact that I use SSL?), $EnablePathInfo (see CleanUrls (above) first), $DefaultPasswords['admin'], $EnableGUIButtons (GUI buttons in editing; I think they work very well). I think I left $LinkWikiWords off, which presumably means BumpyCaseWords won’t automatically make a link to the Wiki page of the same name. This is a first for me; we (my teammate and I) made the decision after deciding that automatic linking was more of a nuisance than a benefit, and also deciding that it was unintuitive for people completely unfamiliar with Wikis. Explicit links are just fine.

If you want to enable uploads, try something like this:

##  If you want uploads enabled on your system, set $EnableUpload=1.
##  You'll also need to set a default upload password, or else set
##  passwords on individual groups and pages.  For more information
##  see PmWiki.UploadsAdmin.
$EnableUpload = 1;
# $DefaultPasswords['upload'] = crypt('secret');
$DefaultPasswords['upload'] = '';
$UploadDir = '/srv/www/the.wiki.host/root/pmwiki/uploads';
$UploadUrlFmt = 'https://the.wiki.host/wiki/uploads';
$UploadMaxSize = 5000000;

Note that PmWiki will try and create the uploads directory for you as soon as you try and upload something (Attach:foo in PmWiki, or maybe click the “Attach” link at the top right). This does require some judicious use of chmod, of course. Also note that I’ve removed the need for an upload password. This is especially fine in my case, since this Wiki is behind HTTP basic authentication. If you want to make $UploadMaxSize big like I did, you may need to change upload_max_filesize in /etc/php.ini. On my CentOS 4 install, upload_max_filesize was set to 2MB by default, which is smaller than the 5MB I wanted.

We also needed to put some mathematical equations on the Wiki. For this I found WikiPublisher. As it turns out, WikiPublisher is actually meant to help you turn a Wiki into a PDF. This is a very, very neat idea, of course, and it looks like it’s generally agreed that WikiPublisher does a very nice job of it. Of course, WikiPublisher needs a server where it sends the Wiki document(s) as XML, and a PDF pops out. By default WikiPublisher sends this to (I think) a server running at WikiPublisher’s own site. Not that I don’t trust WikiPublisher, but the people that will be using this Wiki might not like the idea that their research, et al will be sent out over the clear to a third party they don’t know or explicitly trust. I appreciate the service they offer to provide, especially seeing as I suspect the generation of PDF is a CPU intensive task and they’re apparently doing this for free; but nonetheless I opted to disable the “make a PDF” buttons that WikiPublisher puts on every page.

WikiPublisher draws upon the LatexRender PHP class to call into LaTeX and get an image out. You can see examples of LatexRender on WikiPublisher’s site. (It’s unfortunate that you can’t see the PmWiki source; this Wiki has editing password protected, at least for that page.)

To install WikiPublisher and get LaTeX equations working:

  1. Make sure you have the ImageMagick, tetex-latex, tetex-dvips, and ghostscript packages installed. (It seems that the LatexRender documentation neglects to tell you that Ghostscript is necessary.)
  2. Follow the installation directions for PublishPDF.
  3. Follow the installation directions for LatexRender, located at pub/latexrender/readme.txt within the WikiPublisher distribution. Scroll down to the specific part where it discusses the instructions for installing it in PmWiki.

That should be about it. Now you can {$ 1+1=2 $} to test it.

For reference, the top of my local/config.php file from PmWiki where I set up the WikiPublisher/LaTeX equations stuff:

##  WikiPublisher
include_once("$FarmD/cookbook/wikipublisher/extensions.php");
# Disable the PDF buttons
$PageTypesetFmt = '';
##  LatexRender for math equations
include_once("pub/latexrender/latex.php");

Works for me.

No Comments »

No comments yet.

RSS feed for comments on this post. TrackBack URL

Leave a comment

Powered by WordPress