# 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:

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:

MathJax.Hub.Config({
tex2jax: {inlineMath: [["$","$"],["\$","\$"]]},
config: ["local/local.js"]
});



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 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:

TEX.Macro('Z','\\mathbb{Z}');


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.

TEX.Macro('A','\\mathbb{A}');
TEX.Macro('Acl','\\mathcal{A}');
TEX.Macro('Afr','\\mathfrak{A}');
TEX.Macro('B','\\mathbb{B}');
TEX.Macro('Bcl','\\mathcal{B}');
TEX.Macro('Bfr','\\mathfrak{B}');
TEX.Macro('C','\\mathbb{C}');
TEX.Macro('Ccl','\\mathcal{C}');
TEX.Macro('Cfr','\\mathfrak{C}');
TEX.Macro('D','\\mathbb{D}');
TEX.Macro('Dcl','\\mathcal{D}');
TEX.Macro('Dfr','\\mathfrak{D}');
TEX.Macro('E','\\mathbb{E}');
TEX.Macro('Ecl','\\mathcal{E}');
TEX.Macro('Efr','\\mathfrak{E}');
TEX.Macro('F','\\mathbb{F}');
TEX.Macro('Fcl','\\mathcal{F}');
TEX.Macro('Ffr','\\mathfrak{F}');
TEX.Macro('G','\\mathbb{G}');
TEX.Macro('Gcl','\\mathcal{G}');
TEX.Macro('Gfr','\\mathfrak{G}');
TEX.Macro('H','\\mathbb{H}');
TEX.Macro('Hcl','\\mathcal{H}');
TEX.Macro('Hfr','\\mathfrak{H}');
TEX.Macro('I','\\mathbb{I}');
TEX.Macro('Icl','\\mathcal{I}');
TEX.Macro('Ifr','\\mathfrak{I}');
TEX.Macro('J','\\mathbb{J}');
TEX.Macro('Jcl','\\mathcal{J}');
TEX.Macro('Jfr','\\mathfrak{J}');
TEX.Macro('K','\\mathbb{K}');
TEX.Macro('Kcl','\\mathcal{K}');
TEX.Macro('Kfr','\\mathfrak{K}');
TEX.Macro('L','\\mathbb{L}');
TEX.Macro('Lcl','\\mathcal{L}');
TEX.Macro('Lfr','\\mathfrak{L}');
TEX.Macro('M','\\mathbb{M}');
TEX.Macro('Mcl','\\mathcal{M}');
TEX.Macro('Mfr','\\mathfrak{M}');
TEX.Macro('N','\\mathbb{N}');
TEX.Macro('Ncl','\\mathcal{N}');
TEX.Macro('Nfr','\\mathfrak{N}');
TEX.Macro('O','\\mathbb{O}');
TEX.Macro('Ocl','\\mathcal{O}');
TEX.Macro('Ofr','\\mathfrak{O}');
TEX.Macro('P','\\mathbb{P}');
TEX.Macro('Pcl','\\mathcal{P}');
TEX.Macro('Pfr','\\mathfrak{P}');
TEX.Macro('Q','\\mathbb{Q}');
TEX.Macro('Qcl','\\mathcal{Q}');
TEX.Macro('Qfr','\\mathfrak{Q}');
TEX.Macro('R','\\mathbb{R}');
TEX.Macro('Rcl','\\mathcal{R}');
TEX.Macro('Rfr','\\mathfrak{R}');
TEX.Macro('S','\\mathbb{S}');
TEX.Macro('Scl','\\mathcal{S}');
TEX.Macro('Sfr','\\mathfrak{S}');
TEX.Macro('T','\\mathbb{T}');
TEX.Macro('Tcl','\\mathcal{T}');
TEX.Macro('Tfr','\\mathfrak{T}');
TEX.Macro('U','\\mathbb{U}');
TEX.Macro('Ucl','\\mathcal{U}');
TEX.Macro('Ufr','\\mathfrak{U}');
TEX.Macro('V','\\mathbb{V}');
TEX.Macro('Vcl','\\mathcal{V}');
TEX.Macro('Vfr','\\mathfrak{V}');
TEX.Macro('W','\\mathbb{W}');
TEX.Macro('Wcl','\\mathcal{W}');
TEX.Macro('Wfr','\\mathfrak{W}');
TEX.Macro('X','\\mathbb{X}');
TEX.Macro('Xcl','\\mathcal{X}');
TEX.Macro('Xfr','\\mathfrak{X}');
TEX.Macro('Y','\\mathbb{Y}');
TEX.Macro('Ycl','\\mathcal{Y}');
TEX.Macro('Yfr','\\mathfrak{Y}');
TEX.Macro('Z','\\mathbb{Z}');
TEX.Macro('Zcl','\\mathcal{Z}');
TEX.Macro('Zfr','\\mathfrak{Z}');
TEX.Macro('afr','\\mathfrak{a}');
TEX.Macro('bfr','\\mathfrak{b}');
TEX.Macro('cfr','\\mathfrak{c}');
TEX.Macro('dfr','\\mathfrak{d}');
TEX.Macro('efr','\\mathfrak{e}');
TEX.Macro('ffr','\\mathfrak{f}');
TEX.Macro('gfr','\\mathfrak{g}');
TEX.Macro('hfr','\\mathfrak{h}');
TEX.Macro('ifr','\\mathfrak{i}');
TEX.Macro('jfr','\\mathfrak{j}');
TEX.Macro('kfr','\\mathfrak{k}');
TEX.Macro('lfr','\\mathfrak{l}');
TEX.Macro('mfr','\\mathfrak{m}');
TEX.Macro('nfr','\\mathfrak{n}');
TEX.Macro('ofr','\\mathfrak{o}');
TEX.Macro('pfr','\\mathfrak{p}');
TEX.Macro('qfr','\\mathfrak{q}');
TEX.Macro('rfr','\\mathfrak{r}');
TEX.Macro('sfr','\\mathfrak{s}');
TEX.Macro('tfr','\\mathfrak{t}');
TEX.Macro('ufr','\\mathfrak{u}');
TEX.Macro('vfr','\\mathfrak{v}');
TEX.Macro('wfr','\\mathfrak{w}');
TEX.Macro('xfr','\\mathfrak{x}');
TEX.Macro('yfr','\\mathfrak{y}');
TEX.Macro('zfr','\\mathfrak{z}');
TEX.Macro('Hom','\\mathrm{Hom}');
TEX.Macro('Spec','\\mathrm{Spec}');
TEX.Macro('Ext','\\mathrm{Ext}');
TEX.Macro('Tor','\\mathrm{Tor}');
TEX.Macro('GL','\\mathrm{GL}');
TEX.Macro('End','\\mathrm{End}');
TEX.Macro('Aut','\\mathrm{Aut}');
TEX.Macro('Res','\\mathrm{Res}');