How to take lecture notes with LaTeX

Written on December 27, 2008

Since it is a frequently asked question, I will explain here how I manage to take lecture notes with LaTeX. It’s not that hard, once you have the right tools.


  • a working laptop, possibly with 2+ hours of battery life (mine haven’t got anymore, sigh);
  • a clever and rich Unicode-based keyboard layout;
  • a font with extended Unicode support;
  • an editor with snippets;
  • some LaTeX macros (less important than you think);
  • optionally some utilities.

If someone doesn’t know it, Unicode is a powerful character encoding standard, designed to be universal: it codifies virtually all glyphs ever created by humans (except Klingon, maybe). In particular there are equivalents for many LaTeX macros — for example, \forall is Unicode character U2200. To find math glyphs, there’s a list here; alternatively there is the useful Gnome program Gucharmap [1].

Selected your favorite characters, you have to find a way to type them with some combination of keys, that is, a custom keyboard layout. Under Linux, the right way to do this is to create a symbol file for XKB. This procedure is neither easy nor well documented, so probably my solution is far from being correct. Anyway you should be able to download the layout, putting it at /usr/share/X11/xkb/symbols/ and enabling it with setxkbmap us_math. If you’re lucky, you could enable it also via Gnome keyboard properties [2]. This layout works for a Macbook and uses eight levels for every key, depending on Shift and the two Apple keys. In particular there are these letters.

Left ⌘ Right ⌘ Alphabet Typeface Case
      Latin Roman Lower-case
X     Latin Roman Upper-case
  X   Greek Roman Lower-case
X X   Greek Roman Upper-case
    X Latin Double-struck Upper-case
X   X Latin Calligraphic Upper-case
  X X Latin Fraktur Lower-case
X X X Latin Fraktur Upper-case

Up to now you can type strange mathematical Unicode characters, but maybe you can’t see them because the font you use does not have the corresponding glyphs. On a recent Gnome box, Pango (Gnome’s text rendering library) should let you see a glyph if at least one of the fonts installed defines it. Usually the most comprehensive font is DejaVu, the extension of the omnipresent Bitstream Vera.

The next step is to tell LaTeX that we want to write our document with Unicode characters and we want them translated to macros. To do this we had to use these lines.


LaTeX manages Unicode in a very simple way: it has a big table which defines how to translate Unicode characters to LaTeX macros. These table is stored in a bunch of files in the /usr/share/texmf-texlive/tex/latex/ucs/data/ directory (or an equivalent one), once you have installed the package latex-ucs. The bad thing is that, as far as I know, this package is unmaintained since 2004. I’ve inserted at least the characters used in the layout, and you can download the updated files here and put it in your local LaTeX tree.

Okay. We can write most LaTeX macros with a single characters. You only have to get used to the new keys, I hope they’re arranged in a rational way. In any case, there are some constructions not corresponding to characters. Fractions, matrices and environments are the most tedious; let’s get rid of them.

One way to do this is by snippets. Usually snippets work in this way: you type some key combinations and the editor converts the keys you typed to the construct you want, and adds some facilities to speed up the whole thing. For example, gedit with LaTeXPlugin allows you to press Alt+o to start an environment, and you have to type only once the environment title. Moreover, gedit let you write your own snippets. Another LaTeX-friendly editor is Emacs with AUCTeX.

As for fractions and matrices, I prefer using LaTeX macros instead of snippets. The most useful macros I use are the \[p][s][frac|mat]: fraction or matrices, with parenthesis if there is the “p”, small if there is the “s” (small means suitable for in-line math). Analysts may want to have macros for (partial) derivatives; and remember that to write differentials you have to write \mathrm{d}t, not simply dt! The macros file I use is here (use it with \usepackage{Commons}).

This is more or less what you need to write notes with LaTeX. In addition, I want to suggest some utilities. To write commutative diagrams, I use Commu. To manage the bibliographies, Referencer — but I don’t use it during lectures. Instead, I often want to see what I wrote, so I need an automated compilation utility. I used for a long time make with a custom makefile, but now there is Rubber, which does everything (and more) without the need for a makefile. For example, if you want to compile all documents in a directory, just type rubber --pdf *.tex.

To conclude, two words on the actual act of write notes, if you want to begin. Consider that writing on a keyboard is much more distracting than writing with a pen, in particular at the beginning. The latter is a natural act, the former is not, since you have to take care of additional structure, and you cannot “just copy the blackboard”. At the end of the hour, I have almost every time a compiling document, but there are many spelling errors and during the lessons I often leave equations in-lined, so after them I have to put on displaymath the long ones and split them up, if necessary. In the resulting document, the potential lack of structure (chapters, sections, definitions, and so on) is much more evident than for handwritten notes; anyway this usually depends on the style of the speaker and the tone of the lecture (an informal review tends to have less structure than a formal one).

To sum up, I list in a single place (here) the downloads linked throughout the article:

  • the keyboard layout for a Macbook;
  • the updated translation table for latex-ucs;
  • the file with the LaTeX macros.

See also

  1. LaTeX class for lecture notes
  2. Suboptimal LaTeX #1: intro
  3. Suboptimal LaTeX #2: spacing
  4. Suboptimal LaTeX #3: mathematical environments
  5. Suboptimal LaTeX #4: mathematics
  6. Suboptimal LaTeX #5: miscellanea
  1. At the bottom of the page you can find links to similar programs for Windows and Mac Os X. 

  2. To change Mac Os X layout there is Ukulele. I know there are similar softwares also for Windows. 

If you liked this post, please share it with your friends: