A better way to print research papers
It's usually nice to read a printed copy of a paper. I've written some shell scripts to help do
this while also saving paper and possibly finding collaborators, in three ways:
- save paper by finding someone else's printed copy rather than printing a new one;
- save paper by intelligently cropping out large margins and printing 2-up;
- discover other people, possibly elsewhere in the Lab, who are reading the same papers as you.
To use them, add /usr/groups/netos/scripts to your PATH environment variable. To print a
paper, use the lpr-paper command rather than lpr or lpr.cl. It will
record the fact that you have printed a paper (in file
/usr/groups/netos/library/lpr-paper/$USER) or, if someone else printed it before you, will
tell you this and give you the option of cancelling. It will also detect whether your paper has
large margins, and if so, offer to print it in cropped 2-up form. At present, it supports PDF and
Postscript files, and understands the command-line options of lpr.cl, i.e. the Lab's own
lpr rather than the CUPS one.
Some caveats:
- As I mentioned, at present it understands only the CL-internal lpr command-line
syntax, and expects the system lpr to do the same. Moreover, only a subset of the options
are currently passed through to the real lpr, so you may have to edit
/usr/groups/netos/scripts/lpr-wrapper.cl if you want other options to work.
- You need xmessage, gs, convert (from ImageMagick), pdfnup
(from PDFjam), pdfcrop and pdftotext (from poppler-utils) available in your PATH.
Assuming you have some LaTeX distribution installed, the only things you'll likely need to install
yourself are PDFjam, possibly ImageMagick and possibly poppler-utils. If you're using a CL Fedora
machine, do cl-asuser yum install imagemagick pdfjam poppler-utils and that should be
that.
- There's a bit of a delay owing to margin detection. I've optimised this a bit but
could do better.
- Support for Postscript files is not very well tested at the moment.
- There are no doubt some bugs! I sneakily created a group-writable Mercurial repository in
/usr/groups/netos/scripts, so feel free to clone the repository, hack away and push your
changes back when satisfied.
Other notes:
- To record the fact that you've already printed a paper, say before you started using the
scripts, you can do LPR_PAPER_NO_PRINT=1 lpr-paper paper. I've already entered the
majority of my printed papers in this way, so you might conceivably strike it lucky from your very
first print! You can get a slightly different effect by using LPR_WRAPPER=/bin/true, which
additionally goes through the cropping process but again avoids physically printing anything.
- If you want to use an alternative lpr syntax, you can create new lpr-wrapper
and lpr-parseopts scripts and use those (by putting them ahead of the other ones in your
path). If you do, please drop them into /usr/groups/netos/scripts, appropriately named, so
that others can use them.
- Please e-mail me (srk31) with any comments, bug reports or suggestions. If it proves a success
within netos, I'll try to get it rolled out Lab-wide.
Stephen Kell
24th July 2008
Content updated at Fri 8 Aug 15:13:00 BST 2008.
validate this page