Marking pdf Assignments in Emacs
Most of the undergraduate student assignments I need to mark are numerical or analytical in nature. The assignments are for small classes, and are often written on paper, and even if submitted electronically they are relatively easy to mark up on a tablet, because the answer is either correct or it isn’t. But I recently had to mark a large number of assignments, for a course on the social context of engineering, where answers to questions are in paragraph form, and are fairly open-ended. This requires explanation on my part for why marks were not allocated and suggestions on what would have made the answers better.
First time I did this I used a tablet and pen, and although it worked, it was very time consuming and messy to add comments. Using Adobe Acrobat under Windows was not better, as I find the comment interface unwieldy when I have to use it a lot. The most tedious aspect of this was that many of the comments were the same for large numbers of students, requiring you to type the same thing over and over again: this year I had around 75 students, with 6 pages and on average around 6 individual comments per page – a total of 2700 comments! Many of the mistakes were common to several students in the class.
In an attempt to improve the experience of marking these assignments, I looked at doing the marking in emacs, using two very simple tools: the pdf-tools package maintained by Andreas Politz, and the built-in registers of the editor. If you do much marking up of pdfs, this may be of interest to you.
If you use emacs, and don’t currently use pdf-tools, you should. It’s an easy install from the melpa archive, and it is a lot faster than the default pdf viewer DocView. Most importantly, it has commands that are useful for marking up and annotating pdf files. I have added the following commands to my init.el file to allow single-key commands in pdf-tools such as ‘h’ for highlight text, ‘s’ for strikeout and ‘t’ for text comment, as well as ‘d’ to delete existing comments. I also have changed the default strikeout line from red to green, because red is so judgemental…
When this is loaded, opening the pdf file provides a view just like that of a normal pdf-viewer, scaled to fit in the emacs window. If I select text and hit ‘h’ I highlight that text in the pdf and get to edit a comment on the highlighted text in the minibuffer. Pressing C-c C-c exits from the minibuffer and the comment can be seen when the cursor rolls over the highlighted text in the pdf. Pressing ‘t’ does the same, but produces an icon in the pdf instead of the highlighted text.
Once mastered, this is a very quick way of adding comments or deleting text is very fast, as only a few keystrokes are required to add annotations, which are automatically timestamped and user stamped. Note that I changed my user designation to anonymous here, as sometimes (eg if using for annotating review papers) it’s not desirable to identify. By default it’s your username.
As I hinted previously, what makes this even more useful is the effectiveness in combination with emacs’ registers. I had not really used these much previously, as I had no idea what one was supposed to do with them, but populating many pdfs with identical comments is one example of where they can be useful.
While editing a comment in the minibuffer, you can select it and type C-x-r-s-1 and it will save that text to register 1. Then the next time you want to insert that text in a comment, you type C-x-r-i-1 and it will insert the text. The box below gives the general idea.
The process can then be repeated as many times as necessary when needed in a comment. The usual C-x C-s will save the pdf for you. Another handy command is C-c C-a l, which lists the annotations.
This procedure is not flawless: there is a bug that comes up every so often (but not always) when editing existing annotations with pdf-tools, where the link to the animation is lost and the updated animation cannot be edited. If this happens, kill the annotation minibuffer and make and delete another comment, then try again. This works for me. The only other thing I’d like to see from the excellent pdf-tools package for marking up documents is a carat symbol for insertion of text. But I can use it perfectly well in its current form.
You can find out more about registers at https://www.emacswiki.org/emacs/Registers.
The source for pdf-tools is currently at https://github.com/politza/pdf-tools.