№ 12
A new LaTeX class for lecture notes
A new document class for LaTeX built from the ground up for preparing lecture notes, entire course notes and support sheets for individual talks/classes.
So far I have had a fairly good semester teaching postgraduate physics. While preparing to teach classes I went through a simple routine: first, I decided what to cover based on the curriculum, followed by how best to present it; then, I prepared a bunch of talk sheets for myself so that I could be sure of covering everything I hoped to cover; finally, I prepared a bunch of lecture notes including, as far as possible, detailed exposition of everything covered in class.
The first step was necessary for me because I tend to deviate while discussing ideas because I constantly get bombarded with an exponentially increasing set of ideas with every individual seed of thought. The curriculum provided a foundation to build on and a flexible fence to build within. The second step was important for similar reasons: to keep me in check during my lectures. (That said, I was always open to continuing discussions after class hours.)
The third step, which some students and a surprisingly large number of outsiders benefited from (at least that is my impression based on the emails I have been getting over the past months), was a fairly detailed compilation of ideas discussed in class (but, unfortunately, not discussions outside of class) that was supposed to be minimum reading material for students of the course. They were expected to build from there with other sources as, when, and if, they found the need.
Download the LaTeX lecture class on Github
A dedicated LaTeX class
With apologies to Plato, necessity breeds creation and, between semesters, I decided to simplify my job of preparing lecture notes and save time by writing a new document class for LaTeX that would let me quickly enter important details as simply as possible and focus entirely on the content. 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 dedicated specifically to lecture notes (but I could be wrong). Perhaps there is good reason for this too: no two people have the same requirements, no two classes have the same needs, no two teachers have the same approach to a give topic. There is fair ground, I admit, to not prepare such a class at all. However, I intended to write this for myself to simplify my own workflow so making it available for free publicly would not hurt.
Some time after I started work on this, I found out that similar ideas had been put to paper a few years back by Stefano Maggiolo except with scribes in mind rather than speakers. (As of now his work has been abandoned.) Since I prefer to pen my own notes rather than allot that work to students/scribes, I had a slightly different approach in mind but, nonetheless, based on similar notions.
Having completed about half of my code I was lucky enough to be able to accelerate it when Stefano graciously let me rework parts of his code into my class. I have finally completed it and, as a little perk, since Stefano’s was originally in Italian, I retained the language in my class as a translation. Hopefully I can get equivalent translations in other languages as well down the road.
Addendum I was a little late in publishing this release article. As of now, v2.2 of this project is the latest stable release, and support 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 anything you want with it so long as you provide attribution (a link back to this webpage will do just fine) and retain the license and copyright notice with your distribution.
On Github, you will find instructions on how to download and use the lecture
class so I will not repeat it here. Suffice it to say that if you do it right, it should only be a matter of copying and pasting and invoking.
The purpose of the lecture
class remains to offer a quick yet flexible way of entering data common to all your lecture notes and ensuring your notes are formatted with some consistency throughout with no additional effort from you. For example, consider the following code:
\title{Give a nice title}
\author{Your Name}
\email{your@email.tld}
This produces a beautiful title for your document and the author’s byline beneath it along with a footnote that mentions the author’s email at the bottom of the page. Take a look at the sample.pdf file that is available on Github. (The sample.tex file that was used to generate this pdf document is also included with the project .)
Care has been taken to ensure that the lecture
class works with pdfTeX, which is the most commonly used (probably most basic) compiler. What this means, of course, is that the class should work just fine with most other compilers, especially if you choose to extend its functionality. I was not a fan of retaining pdfTeX support but decided in its favour since it might as well be worth it for the lecture
class to support broader use cases if nothing else.
If you find that the class throws errors please drop me an email (see link at the bottom of this website). Support is not guaranteed for extremely specific scenarios but if it is something that may affect a considerable 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 community will be able to work on it. If you can sort things out yourself or if you have interesting ideas to expand the lecture
class (see a fairly detailed list of features below), please fork the project and submit a pull request.
List of features (not exhaustive)
Three types of documents may be constructed 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, condensed documents to make highly selective notes—this is what I would prepare to take to my lectures; the seminar
style lets you make more ‘regular’ notes for lectures—this is the type of notes I would prepare after a lecture as reading material for students; the course
style lets you combine several lectures into a single, consolidated course or section of a course.
Computer Modern is boring, Palatino is quickly joining the ranks. The lecture
class therefore typesets documents in Kp-Fonts, which has nothing to do with Adobe’s Kepler, which would look rather awful in a scientific document in my opinion. The best part about this is that it works beautifully with textcomp
and amsmath
with the full
option. (Hat tip to The Johannes Kepler project.)
Note, however, that the lecture
class does not use the lighter typefaces; this is something I have given considerable thought to and chose to keep the book weights for better compatibility with bad printers.
The microtype
package is being called as well. I prefer the way fontspec
does things myself but, as stated above, we need good pdfTeX compatibility and all. (You may have noticed by now that the lecture
class seems to want to support almost everything without the prerequisite that it is a high-tech system.) Hopefully we can build this into an option system that calls packages regardless of their support for pdfTeX if the user so chooses.
Addendum The idea for such a system of options has been added to the roadmap on Github. It should be easy enough to accomplish and I would certainly like to see it, although I doubt I have the time to dedicate to it at this point.
The head of a document, whether a talk
, a seminar
or a course
, contains the title, a subtitle, 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 conference hall location and the name of the institution where the tall was given. Almost all of these are optional but they exist should you ever need them.
All course
type documents also automatically produce a table of contents. Besides the options listed above you can also provide an alternate short title that the lecture
class will use to set your page headers, because lengthy headers can be both unattractive and distracting.
The lecture
class provides headings three levels deep: \section{}
, \subsection{}
and \subsubsection{}
. The table of contents updates itself with these accordingly. As with any use of a table of contents, you will need to compile twice to actually produce the table in your output file.
In lieu of footnotes, the lecture
class offers margin notes. There were two reasons why I chose to go in this direction: one, footnotes are hard to navigate to and from on screens whereas notes placed on the margin are right next to the text and can be associated with the main content quite easily; two, using a prominent outer margin in the layout means documents built with the lecture
class offer ample space for readers to make their own notes, whether on screens or in print.
Usually align
type environments have insufficient vertical spacing between lines of equations. This has been rectified by default letting the writer focus on the content rather than worry about formatting (which is why LaTeX exists in the first place). Also, the csquotes
package is included in the lecture
class allowing you to exploit its wonderful quote styles to set apart brief sections of your text. Finally, the regular skip/short skip spacing for all display environments have been set carefully and will work so long as you type your document properly, i.e. no unnecessary extra lines in your .tex file and so on (use %
instead).
There are other packages that the lecture
class calls for better formatting and to achieve certain other results (margins, for example). All of these should be available for free and should be easy to update and maintain as part of your own TeX installation. The (almost) full list of dependencies can be found on the Github page.
Nearly all questions you may have should be answered between this release article, 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 certainly appreciate 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 originally created for my own needs, as a result of which it likely focusses on what I need a lot more than what I think someone else may need, but it is definitely something worth building for a larger audience as we go regardless of how different our approaches may be. If you decide to use this document class for your own work, I would be humbled. I want to mention Stefano again for letting 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 science.
Examples
Although many emailed me about using my work, I did not originally keep track of use cases. I have done so more recently and Heidelberg University’s documents are some of my favourites (great content too)—see here, here and here. If you are using it too, I’d love to take a look; please feel free to e-mail me about it.