Skip to main content

Using Wave to collaborate on Latex documents

This blog post is a copy of a much nicer PDF version.

I found that Wave could be used as collaborative editor on Latex documents by using a modified export bot and a simple shell script. The exporty2 bot (living at exporty2@appspot.com) allows you to access a wave using access tokens instead of cookie based logins making it easier to fetch those waves using curl. Also the exporty2 bot allows you to export only the text of a Wave using the ``raw'' template.

The raw URL given by the exporty2 bot is pasted into the shell script below. It serves as master wave as it is the document that is latex-ed. Additionally it also lists other resources using the special %FETCHURL tag. These resources are pairs of local name and URL. Curl fetchs these resources and stores it under their local name before the shell scripts runs the usual combination of latex/bibtex/latex. I usually put those %FETCHURL tags below \documentclass.

#!/bin/sh

TITLE="wave-collaboration"
TOKEN=c64e13d340009da7
WAVEID="googlewave.com!w%252BlRomqcgHA"
URL="http://exporty2.appspot.com/export?waveId=$WAVEID&accesstoken=$TOKEN&template=raw"
curl -o $TITLE.tex $URL

DELIMITER="DELIMITER"
FETCHURL=$(grep %FETCHURL $TITLE.tex | sed -e "s/ /$DELIMITER/g")
for i in $FETCHURL
do
  URL=$(echo $i | awk -F$DELIMITER '{ print $3 }')
  FILENAME=$(echo $i | awk -F$DELIMITER '{ print $2 }')
  curl -z $FILENAME -o $FILENAME $URL
done
latex $TITLE.tex
bibtex $TITLE
latex $TITLE.tex
dvipdf $TITLE.dvi
The nice thing about the exporty bot is that it ignores any blips except the root blip. Thereby you could add replies to the latex document and have inline discussions that are automatically filtered from the export. Also the exporty bot ignores the first line of the wave, so you can name the Wave properly.

The PDF version of this blog post contains examples how to use external graphics and bibliography waves. You can also get the latex source of the PDF.

Comments

vlk said…
Sometimes, for some odd reason, exporty2 stops picking up changes to the wave. Any idea why this happens? I've cleared cache, even restarted the browser and everything, but no go.
It's most likely an issue with appengine or the Wave gateway losing some request. I have seen that before but it usually goes away on its own (not 100% stable technology)

Try to resubmit the blip - just add some space and remove them again and hit Ctrl-Enter in Wave. Then wait 5 seconds and the changes should be in exporty.
vlk said…
I tried all that, but to no avail. Strangely, if I add exporty2 to a newly created wave, it no longer creates the extra blip with the link to the raw text, so I suspect that something is wrong with the exporty server.
You are right. I just found on my private waves that exporty2 stopped working. Also the original exporty bot, it is derived from, stopped working (exporty@appspot.com).

Google announced robot API changes.
http://code.google.com/apis/wave/extensions/robots/events.html
Not sure whether this is related. Let's see if I can port exporty2 to the new robot API.
exporty2 works again. It seems like Google fixed their wave gateway problems.