The perfect notebook

Over the years I have tried many systems to keep math notes: paper notebooks, offline WordPress installation, LaTeX files in folders, and random papers that get left on my desk for too long. None of these were ideal for all purposes. Here are the main drawbacks of each system:

  1. Paper notebooks are actually good for learning things. For reading material like books or papers in detail, paper notebooks are the best system for keeping myself on-track of going through every detail, line by line. However, the linear fashion of notebooks makes them hard to consult for main ideas. Additionally, they take up significant space.
  2. My offline WordPress installation consists of WordPress installed on Apache running on my laptop. I found it pretty terrible for notes. The blog format is good for presenting self-contained ideas over time but not so good for consulting old notes because it is not built for organising systematic knowledge. Note however, that I still use my offline WordPress installation to test-drive posts for this blog before they go live.
  3. Using LaTeX is the obvious solution to writing mathematical notes. And for large works, like complete books or papers, it is the best. However, for a general mathematical notebook, a bunch of random LaTeX documents are not easy to organize or search.
  4. Using random loose sheets of paper works for taking notes to help me learn. In this case, writing is just a tool for learning and not for storing information. After I just recycle them.

However, I’ve finally found system for taking notes that works.

It’s a wiki! That’s not really a surprise, as wiki software is designed to store articles on different topics. Because of the ability to link from one article to another, it is vastly superior to random LaTeX files in terms of navigation. Yet because of MathJax, it is still possible to use the most common features of LaTeX. As a bonus it has search.

For this system, I found Dokuwiki to be perfect. Unlike Wikipedia, Dokuwiki doesn’t use an SQL database, so it is very easy to backup and restore. Because it runs on a webserver, Dokuwiki is accessed through your browser.

Most importantly, Dokuwiki passed the acid test: I actually kept using it after I installed it and played around with it. Believe me, it works.

Installing Dokuwiki

If you want to install it on your own laptop, you need to install a webserver and PHP. The easiest way to do that is XAMPP. It’s a self-contained web server with PHP so you can run web applications right from your laptop. Just download it and follow the install instructions. I didn’t know about XAMPP when I started installing stuff, so I just used Apache/PHP/MySQL from my Linux package manager and locked it down for localhost-only access, but XAMPP is the easiest way to get started, especially if you’re on OS X or Windows. As a bonus, with XAMPP you can install all sorts of other cool web applications like WordPress or project management software, or even do web development yourself.

Once you’ve got XAMPP, download Dokuwiki and unzip it into the folder that Apache is configured from which to serve web pages, and run the install script as detailed in the Dokuwiki instructions.

An alternative is to install Dokuwiki on a public webserver, and password protect it so only you have access. The advantage here is that you can access it from any device. However, since I don’t have regular internet access, this option would be useless for me. And keep in mind that even if you password protect it, it is not nearly so impervious to prying eyes as locked-down Apache running on your own laptop with disk-wide encryption.

Math and dokuwiki

There is no default support for LaTeX in Dokuwiki. Obviously, you need LaTeX support or it won’t work as a math notebook. To get MathJax LaTeX support:

  1. Download MathJax, and unzip it somewhere on your webserver
  2. Navigate to the folder dokuwiki/lib/tpl/dokuwiki, where dokuwiki is the root folder of the Dokuwiki installation, and open the file “main.php”.
  3. Add the following lines of code in the head portion of this document:

    Note: the path /mathjax should be the folder where you unzipped MathJax on your webserver, so you might have to change this part if you called the folder something else.

That’s it! Now you can just surround math by single dollar signs for inline math, or double dollar signs for displayed equations. You can also use the \begin{equation} style environments. All the math will be displayed automatically!

But what’s that local/local.js stuff? Navigate to mathjax/config/local and open the file local.js. This is where you can put all your newcommand macros. Defining them works a little differently than in regular LaTeX. But let’s say you want \Z to produce \mathbb{Z}. Then in the file you would insert:

In case you want a head start, here is my complete list of MathJax macros: it provides bb, cal, and fraktur letters along with some commands for Hom, Ext, Tor, etc.

Leave a comment

Fields marked with * are required. LaTeX snippets may be entered by surrounding them with single dollar signs. Use double dollar signs for display equations.