Note taking with LaTeX for learning

Summarizing a text book is easy in LaTeX, but sometimes I want to learn the summarized text. Reading the summary over and over again is not very efficient, so I came up with the typical solution, where you can hide the main part of the summary and can check your knowledge by asking yourself questions based on keywords in the margin. Here is an example, where I started summarizing the R package data.table:


Now I use hide the main text and can ask myself the questions:

  • Express the data.table in SQL-form?
  • How to create a data.table?

Add the following to your latex file (note that I load also the packages lstlisting and some other packages not mentioned here):

Some remarks:

  • I changed the vertical distance of the paragraphs, so it automatically skips a line (if you summarize with lots of text this is probably not a good thing, but if you summarize R commands like in the example, you don’t want to have to add linebreaks after every paragraph.
  • I removed the indent for new paragraphs for the same reason.
  • I added the package color so I can show the margin notes in the color red (using the renewcommand for the marginfont.

In the text you can now add a margin note by adding: