A new LaTeX class for lecture notes

21 June 2017

A new doc­u­ment class for LaTeX built from the ground up for prepar­ing lec­ture notes, entire course notes and sup­port sheets for indi­vid­ual talks/​classes.

So far I have had a fairly good semes­ter teach­ing post­grad­u­ate physics. While prepar­ing to teach classes I went through a simple rou­tine: first, I decided what to cover based on the cur­ricu­lum, fol­lowed by how best to present it; then, I pre­pared a bunch of talk sheets for myself so that I could be sure of cov­er­ing every­thing I hoped to cover; finally, I pre­pared a bunch of lec­ture notes includ­ing, as far as pos­si­ble, detailed expo­si­tion of every­thing cov­ered in class.

The first step was nec­es­sary for me because I tend to devi­ate while dis­cussing ideas because I con­stantly get bom­barded with an expo­nen­tially increas­ing set of ideas with every indi­vid­ual seed of thought. The cur­ricu­lum pro­vided a foun­da­tion to build on and a flex­i­ble fence to build within. The second step was impor­tant for sim­i­lar rea­sons: to keep me in check during my lec­tures. (That said, I was always open to con­tin­u­ing dis­cus­sions after class hours.)

The third step, which some stu­dents and a sur­pris­ingly large number of out­siders ben­e­fited from (at least that is my impres­sion based on the emails I have been get­ting over the past months), was a fairly detailed com­pi­la­tion of ideas dis­cussed in class (but, unfor­tu­nately, not dis­cus­sions out­side of class) that was sup­posed to be min­i­mum read­ing mate­r­ial for stu­dents of the course. They were expected to build from there with other sources as, when, and if, they found the need.

A ded­i­cated LaTeX class

With apolo­gies to Plato, neces­sity breeds cre­ation and, between semes­ters, I decided to sim­plify my job of prepar­ing lec­ture notes and save time by writ­ing a new doc­u­ment class for LaTeX that would let me quickly enter impor­tant details as simply as pos­si­ble and focus entirely on the con­tent. I call this the lecture class and am quite pleased to say it is finally ready for real world use.

As far as I know, there was no class before this that was ded­i­cated specif­i­cally to lec­ture notes (but I could be wrong). Per­haps there is good reason for this too: no two people have the same require­ments, no two classes have the same needs, no two teach­ers have the same approach to a give topic. There is fair ground, I admit, to not pre­pare such a class at all. How­ever, I intended to write this for myself to sim­plify my own work­flow so making it avail­able for free pub­licly would not hurt.

Some time after I started work on this, I found out that sim­i­lar ideas had been put to paper a few years back by Ste­fano Mag­gi­olo except with scribes in mind rather than speak­ers. (As of now his work has been aban­doned.) Since I prefer to pen my own notes rather than allot that work to students/​scribes, I had a slightly dif­fer­ent approach in mind but, nonethe­less, based on sim­i­lar notions.

Having com­pleted about half of my code I was lucky enough to be able to accel­er­ate it when Ste­fano gra­ciously let me rework parts of his code into my class. I have finally com­pleted it and, as a little perk, since Stefano’s was orig­i­nally in Ital­ian, I retained the lan­guage in my class as a trans­la­tion. Hope­fully I can get equiv­a­lent trans­la­tions in other lan­guages as well down the road.

Adden­dum: I was a little late in pub­lish­ing this release arti­cle. As of now, v2.2 of this project is the latest stable release, and sup­port for french has already been added.

Github + MIT

The lecture class is released on Github with an MIT license, which means you can do absolutely any­thing you want with it so long as you pro­vide attri­bu­tion (a link back to this web­page will do just fine) and retain the license and copy­right notice with your dis­tri­b­u­tion.

LaTeX lec­ture class page on Github.

On Github, you will find instruc­tions on how to down­load and use the lecture class so I will not repeat it here. Suf­fice it to say that if you do it right, it should only be a matter of copy­ing and past­ing and invok­ing.

The pur­pose of the lecture class remains to offer a quick yet flex­i­ble way of enter­ing data common to all your lec­ture notes and ensur­ing your notes are for­mat­ted with some con­sis­tency through­out with no addi­tional effort from you. For exam­ple, con­sider the fol­low­ing code:

\title{Give a nice title}
\author{Your Name}
\email{[email protected]}

This pro­duces a beau­ti­ful title for your doc­u­ment and the author’s byline beneath it along with a foot­note that men­tions the author’s email at the bottom of the page. Take a look at the sample.pdf file that is avail­able on Github. (The sample.tex file that was used to gen­er­ate this pdf doc­u­ment is also included with the project .)

Care has been taken to ensure that the lecture class works with pdfTeX, which is the most com­monly used (prob­a­bly most basic) com­piler. What this means, of course, is that the class should work just fine with most other com­pil­ers, espe­cially if you choose to extend its func­tion­al­ity. I was not a fan of retain­ing pdfTeX sup­port but decided in its favour since it might as well be worth it for the lecture class to sup­port broader use cases if noth­ing else.

If you find that the class throws errors please drop me an email (see link at the bottom of this web­site). Sup­port is not guar­an­teed for extremely spe­cific sce­nar­ios but if it is some­thing that may affect a con­sid­er­able number of users I will do my best to tackle it. In any case my reason for putting up my lecture class on Github is so that the com­mu­nity will be able to work on it. If you can sort things out your­self or if you have inter­est­ing ideas to expand the lecture class (see a fairly detailed list of fea­tures below), please fork the project and submit a pull request.

List of fea­tures (not exhaus­tive)

Three types of doc­u­ments may be con­structed using the lecture class. This has been detailed in the Github page as well, so I will keep it brief here: the talk style lets you make two-column, con­densed doc­u­ments to make highly selec­tive notes — this is what I would pre­pare to take to my lec­tures; the seminar style lets you make more reg­u­lar’ notes for lec­tures — this is the type of notes I would pre­pare after a lec­ture as read­ing mate­r­ial for stu­dents; the course style lets you com­bine sev­eral lec­tures into a single, con­sol­i­dated course or sec­tion of a course.

Com­puter Modern is boring, Palatino is quickly join­ing the ranks. The lecture class there­fore type­sets doc­u­ments in Kp-Fonts, which has noth­ing to do with Adobe’s Kepler, which would look rather awful in a sci­en­tific doc­u­ment in my opin­ion. The best part about this is that it works beau­ti­fully with textcomp and amsmath with the full option. (Hat tip to The Johannes Kepler project.)

Note, how­ever, that the lecture class does not use the lighter type­faces; this is some­thing I have given con­sid­er­able thought to and chose to keep the book weights for better com­pat­i­bil­ity with bad print­ers.

The microtype pack­age is being called as well. I prefer the way fontspec does things myself but, as stated above, we need good pdfTeX com­pat­i­bil­ity and all. (You may have noticed by now that the lecture class seems to want to sup­port almost every­thing with­out the pre­req­ui­site that it is a high-tech system.) Hope­fully we can build this into an option system that calls pack­ages regard­less of their sup­port for pdfTeX if the user so chooses.

Adden­dum: The idea for such a system of options has been added to the roadmap on Github. It should be easy enough to accom­plish and I would cer­tainly like to see it, although I doubt I have the time to ded­i­cate to it at this point.

The head of a doc­u­ment, whether a talk, a seminar or a course, con­tains the title, a sub­ti­tle, the speaker, the scribe, their e-mail addresses, a course code, two optional areas for any text you may wish to include, a start and end date (or just one date), a con­fer­ence hall loca­tion and the name of the insti­tu­tion where the tall was given. Almost all of these are optional but they exist should you ever need them.

All course type doc­u­ments also auto­mat­i­cally pro­duce a table of con­tents. Besides the options listed above you can also pro­vide an alter­nate short title that the lecture class will use to set your page head­ers, because lengthy head­ers can be both unat­trac­tive and dis­tract­ing.

The lecture class pro­vides head­ings three levels deep: \section{}, \subsection{} and \subsubsection{}. The table of con­tents updates itself with these accord­ingly. As with any use of a table of con­tents, you will need to com­pile twice to actu­ally pro­duce the table in your output file.

In lieu of foot­notes, the lecture class offers margin notes. There were two rea­sons why I chose to go in this direc­tion: one, foot­notes are hard to nav­i­gate to and from on screens whereas notes placed on the margin are right next to the text and can be asso­ci­ated with the main con­tent quite easily; two, using a promi­nent outer margin in the layout means doc­u­ments built with the lecture class offer ample space for read­ers to make their own notes, whether on screens or in print.

Usu­ally align type envi­ron­ments have insuf­fi­cient ver­ti­cal spac­ing between lines of equa­tions. This has been rec­ti­fied by default let­ting the writer focus on the con­tent rather than worry about for­mat­ting (which is why LaTeX exists in the first place). Also, the csquotes pack­age is included in the lecture class allow­ing you to exploit its won­der­ful quote styles to set apart brief sec­tions of your text. Finally, the reg­u­lar skip/​short skip spac­ing for all dis­play envi­ron­ments have been set care­fully and will work so long as you type your doc­u­ment prop­erly, i.e. no unnec­es­sary extra lines in your .tex file and so on (use % instead).

There are other pack­ages that the lecture class calls for better for­mat­ting and to achieve cer­tain other results (mar­gins, for exam­ple). All of these should be avail­able for free and should be easy to update and main­tain as part of your own TeX instal­la­tion. The (almost) full list of depen­den­cies can be found on the Github page.

Nearly all ques­tions you may have should be answered between this release arti­cle, the Github page of my lecture class, and the sample files included with the project. If you have more, get in touch via e-mail. If you wish to build on this, I hope you can fork the project on Github, if not, I would cer­tainly appre­ci­ate it if you dropped me a word via e-mail; if you wish to modify, add etc., fork the project and we can merge it later.

This class was orig­i­nally cre­ated for my own needs, as a result of which it likely focusses on what I need a lot more than what I think some­one else may need, but it is def­i­nitely some­thing worth build­ing for a larger audi­ence as we go regard­less of how dif­fer­ent our approaches may be. If you decide to use this doc­u­ment class for your own work, I would be hum­bled. I want to men­tion Ste­fano again for let­ting me use some of his code: you really sped things up. And thanks to those who helped test it out as well. Here’s to sci­ence.