Code

Software I develop and maintain:







LaTeX: Cleveref package

19 June 2017 The Cleveref package (also available from CTAN) does clever things with cross-references:

  • automatic formatting of cross-references based on the type of object referred to (chapter, section, equation, theorem, etc.);
  • full control and customisation of the reference format;
  • cross-references and page references to multiple items;
  • automatic (optional) sorting and compression of multiple cross-references or page references;
  • optional output of a sed script that can strip out Cleveref commands and replace them with standard LaTeX, allowing Cleveref to be used e.g. in articles sent to journals or collaborators that don't (yet!) support Cleveref.

LaTeX: Quantum package

2 October 2012 The Quantum package defines a number of commands and short-hands useful when writing about quantum mechanics, and quantum information theory in particular.

There is no separate documentation; read the package source to find out what commands it provides.

  • Quantum package

LaTeX: Authord package

27 July 2012 Gives a complete solution to the problem of precedence in scientific pubication, in a way that Don Knuth would surely approve of.

  • Authord package
  • Authord documentation

Emacs: Auto-Overlays package

The Auto-Overlays package allows you to define overlays that are created (and updated and destroyed) automatically when text in a buffer matches a regular expression.

Various classes of automatic overlay are provided, to make it easy to define matches for different text regions: words, lines, regions enclosed by start and end tags, or regions enclosed by delimiters. You can also define your own custom classes.

The overlays are updated just before any buffer modification. The built in overlay classes only update as much as is necessary to ensure that overlays covering the point are consistent

Emacs: Completion User Interface package

The Completion User Interface package is a library that implements user-interfaces for in-buffer completion.

Typically, in packages providing some kind of text completion, a large amount of code deals with providing the user interface rather than finding good completions. The goal of Completion-UI is to be the swiss-army knife of in-buffer completion user-interfaces; a library which any completion package can use to provide an in-buffer completion user-interface, thereby freeing completion package writers to concentrate on the task of finding the completions in the first place.

In fact, Comp

Emacs: data structure packages

These packages provide basic (and not so basic) data structures. They are all relatively stable, though bug-fixes and new features are added occasionally. (Latest update: February 2013).

In recent versions of Emacs (>=24.1), you can install all the non-obsolete packages from within Emacs itself, via GNU ELPA. Use M-x list-packages and take it from there. This is the preferred installation method. (Occasionally, the ELPA version might lag slightly behind the latest version available here.)

  • Git repository: http://www.dr-qubit.org/git/predictive.git
  • heap.el (version 0.4)
  • queue.el (version 0.1.1)

Emacs: miscelaneous packages

These packages provide miscelaneous features I needed at some point. So I coded them. Currently, they're all to do with displaying useful information in the mode line.

show-point-mode displays the current value of the point in the mode line. I primarily find it useful when debugging Elisp code that uses overlays and markers.

wc-mode displays output similar to the Unix wc command in the mode line, i.e. the character count, word count and line count for the current buffer. (I primarily find this Useful when writing grant applications with character or word limits. Though I'm sure it's us

Matlab code

I've collected here various functions, routines, and other bits of Matlab, Octave and Mathematica code organized by topic, that might save someone, somewhere, from re-inventing the wheel. Some of them are so simple it would probably be quicker to re-code them than find this page, but since you're here anyway…

Comments within the code should be enough to figure out what they do and how to use them (try help <function> from within Matlab or Octave). No guarantee they work as advertised, but I use them myself so I do correct bugs when I come across them. The Matlab code should run under bo

Emacs: Predictive Completion package

The Emacs Predictive Completion package adds a new minor-mode to the GNU Emacs editor. When enabled, predictive mode exploits the redundancy inherent in languages in order to complete words you are typing before you've finished typing them (somewhat like the IntelliSense feature in some IDEs). It is highly customisable, and works happily alongside other Emacs major modes. See the documentation for more details.

Predictive mode only works under GNU Emacs, not under XEmacs. It may be possible to get it to work under XEmacs with a modicum of work. (At the very least, the overlay compatibility pa

Emacs: Undo Tree package

Emacs has a powerful undo system. Unlike the standard undo/redo system in most software, it allows you to recover any past state of a buffer (whereas the standard undo/redo system can lose past states as soon as you redo). However, this power comes at a price: many people find Emacs' undo system confusing and difficult to use, spawning a number of packages that replace it with the less powerful but more intuitive undo/redo system. (See the Emacs Wiki.)

Both the loss of data with standard undo/redo, and the confusion of Emacs' undo, stem from trying to treat undo history as a linear sequence of