← All articlesApr 7, 2022 8 Min Read

My Mathematics PhD research workflow

Earlier this year I started a PhD in pure mathematics at KU Leuven in Belgium and in this blog post I discuss my research workflow. I talk about how I take daily notes, both handwritten ones and ones in LaTeX and how I handle references, featuring a way to instantly add clickable references to my notes.

Doing pure mathematics research is quite unlike other scientific research. I don’t run experiments, nor do I have data to crunch through. A computer is surprisingly often of little to no help. It’s just you and pencil and paper. Or in my case, me, my laptop and a Wacom tablet.

My research workflow is hybrid: it consists both of (digital) handwritten notes and typed LaTeX notes. I like having these two options. Handwritten notes allow me to think completely freely, while taking notes in LaTeX forces me more to write down things neatly, which sometimes results in finding mistakes in the handwritten notes.

LaTeX Notes

Doing a PhD in mathematics, it makes most sense to take notes in LaTeX, especially since I have a very efficient system set up already, as explained in my previous blog posts. My LaTeX notes look as follows:

This LaTeX document automatically concatenates the notes of the previous 14 days, adds the date of each note in the margin and adds a link to my handwritten notes of that day. The global directory structure looks as follows:

  • phd
    • scripts
    • teaching
    • papers
      • title - authors.pdf
      • ...
    • notes
      • master.tex
      • preamble.tex
      • references.tex
      • theorems.tex
      • symbols.tex
      • 2022-01-03
        • note.tex
        • note.xoj
      • 2022-01-04
      • 2022-01-05
      • ...

Since I have a note for every day I never have to think about where to write something down. I just press Alt + N to open today’s note.tex, and I’m set. To open the handwritten notes I can press Alt + X, which opens Xournal — more on that later. You can find the source code on Github.

Reference management

Doing research means dealing with a lot of references to papers and books. I wanted to have a minimalistic approach that is friction-free, having three goals in mind. First, when I am reading a pdf document, I want to be able to add a reference to the current page to my notes with a single keystroke. Secondly, when browsing the Arxiv, I’d like to add a paper to my library with a single click and lastly I want a way to instantly open papers I have in my library, which is really useful during meetings.

Instantly creating clickable references

Have a look back at my notes and notice the parts that are in bold, such as [definition, p. 29] or [Section 5. Infinitesimal deformations, p. 23]. These are links to papers, books, … and when I click them, my pdf viewer opens the file at the corresponding page. This makes it easy to get back in the flow reading old notes: I don’t lose time searching for certain definitions of concepts, I can just click the link and get back on track immediately.

I made it extremely easy to create these kind of references. When I have any document open in my pdf viewer and I press Alt+F, it copies some LaTeX code referring to the current page of the currently opened pdf. I just press p to paste this in Vim, and the link is created. This also works in Firefox, creating a reference to the currently opened tab.

An example of a reference to a web pages:

Referring to a web page

A references to a local pdf document:

Referring to a pdf document

In the video above, I generate a reference to page 61 of ‘Generalized Complex Geometry’, by Marco Gualtieri and I paste the generated code in Vim:

\pdfref{gcg}{61}{Gualtieri}

The first argument, gcg, is an identifier I’ve assigned to this document. When referring to a document for the first time, I get asked once to assign it an id, which is then used automatically thereafter. The second argument 61 is of course the page number, and the third one, Gualtieri, is the title of the pdf file. This is what gets printed when I compile the document. It is easy enough to quickly change using ci}, or I can change the default by changing the title of the pdf.

As shown in the video, clicking on the link opens the document on the referenced page. Having made referencing so low effort, I tend to do it way more often, which saves me much time later on.

If you’re interested in the technical side of things, click below to expand the section, otherwise skip to the next one. In any case you can find the code and setup instructions on Github.

Technical details: Custom protocol handlers and DBus/gvfs

While seemingly simple, this was surprisingly difficult to pull off. Creating a link in a pdf that opens a local file is not hard: instead of using the http://path, you can use run:path and this tries to open the file located at path. This is for example how the links to the handwritten notes work.

This works similarly for linking to pdf files, but there is not a standard way to open a file at a current page. Some pdf viewer support path#page=1, but not all of them, and mine doesn’t. The solution? Defining a custom protocol! I named it phd for lack of better imagination. Now I create a link to phd://open-paper?id=gcg&page=61. I configured a custom protocol handler for handling these kinds of links, which then runs pdf-viewer --page 1 path, opening the file at the correct page. Here, path the path of the document that corresponds to id.

For actually getting the path and page number of the currently opened pdf file, I used DBus for my preferred pdf viewer Zathura, and I managed to get it working via gvfs for Evince, the default pdf viewer on Gnome. Using gvfs for this is a bit of a hack, as this is a virtual file system for storing metadata on files, in this case for remembering the page you last looked at. But because Evince updates this whenever you scroll, this is actually the same as the current page. Why Evince does not support retrieving the current page through DBus is beyond me.

Instantly adding new papers

To add a new paper to my library, I added a userscript to my browser to add a button to the ArXiv labeled ‘Add to Library’. When I click on this, the pdf file gets downloaded to my papers directory and named Title - Authors.pdf. Also the metadata is set accordingly and the pdf opens in my pdf reader.

ArXiv add to library button

To open a paper in my library, I can press Alt+P and fuzzy search through the list:

Alt-P opens a fuzzy search

If the paper doesn’t exists, it searches for it on ArXiv.

Handwritten digital notes

While the LaTeX notes are great for referencing later on, I also take handwritten notes using Xournal. This is where I first go to if I have ideas, and only later I turn the (possibly) interesting ones into LaTeX.

I take my handwritten notes using a Wacom drawing tablet (One by Wacom Medium). I thought about buying a tablet like Remarkable or an Android tablet, but this setup gives me most flexibility, and it is also extremely cheap compared to other approaches (especially when you use the drawing tablet of your girlfriend).

Xournal is a minimalist note taking app that works well with Wacom tablets. Below you see me using it.

A video showing how I use Xournal

Digital notes have quite a few advantages. The page size is practically infinite, which really helps when dealing with some nasty expressions. You can assign a button on the pen to delete entire strokes at once, which makes it very easy to quickly redraw a letter or change up some symbols. These settings are not default, you can find my configuration on Github. I also disable pressure sensitivity as I find it distracts more than it does good.

Copy and paste is also something you obviously don’t get with pencil and paper. Having this feature makes me do smaller steps and less in my head, which decreases the amount of errors I make. I simply copy the previous expression, make a few small alterations and repeat. Not having to rewrite it increases my patience and decreases transcription errors.

Another useful feature is increasing or decreasing vertical space. I can simply drag and create more space to write something extra or remove space to condense everything a bit.

Conclusion

I’ve been using this system for about half a year now and I’m very happy with how things are going. Having everything organized and being able to manage references this easy makes it much more enjoyable to do research. I especially love how I can look back at notes of months ago and get back in the flow immediately by clicking on the references.

Short update on unrelated things

By request of many people, I published the source code of some of my lecture notes on Github, as well as the LaTeX code for my Master’s thesis containing a lot of nice pictures.

In the meanwhile, I’m working on a framework called Immersion for creating mathematical presentations. You can see some of the presentations I’ve made with it on my talks page. It features LaTeX support, a visual editor for animating formulae, an easy way to animate SVG figures, presenter notes, references, and I’ve been using it for all my presentations for the last two years. My goal is to make it public in the near future, but it still requires quite a lot of work to make it user friendly.

Liked this blog post? Consider buying me a coffee!

me
Written by Gilles Castel, who lives in Belgium, currently pursuing a PhD in pure mathematics at the university of Leuven.
© 2022 All rights reserved.