How I'm able to take notes in mathematics lectures using LaTeX and Vim (2019)
castel.dev
castel.dev
I would have liked to have a tabled with a nicely working pen. But good old paper and pencil also did the job. Some professors even recommend not taking notes at all but rather preparing the lecture. Then, attending it by primarily listening and trying to understand and then working on the homework.
Some of my professors leveraged MOOCs (massive open online courses) and "inverted" their classes: they recorded a video of them giving the class, and asked the students to watch it before the class. During the class, the teachers would be here to answer questions and go deeper into the material.
I loved it, because I could watch the video at my speed (with as many interruptions as I wanted).
Or check on one of the gazillion resources you have in 2024.
The whole idea is that instead of having the teacher spend their time teaching the basics (which they can record once and let you watch together with all the resources you have), they spend time exclusively talking with the students.
In the end, the students have a lot more time to ask questions to the teacher, and they don't have to feel stupid asking them because they have actually studied before.
Bingo.
I commented the same thing and someone else even suggested solving exercises in latex. Wtf what's wrong with people here.
To this day I still don’t understand how it would be easier,l. But I also seen some people prefer doing “analysis” by printing out a plot. To me that’s very inefficient and using interactive plots are much better. I guess the situation is similar, that the ways we think are so different that we can’t imagine how people doing it otherwise would be simpler / better in any way.
(You could imagine carrying the next step in a derivation can be much simpler as you can just duplicate the line and modify from there. Also macros can help. With enough abstraction it could be easier in some way.)
The reason was that my handwriting was slow, messy and hard to read. Taking the effort to write a nice “submission” quality assignment would easily take two or three times as much as it would take me using Word.
Shoulda done it for my entire educational career. But I had other plans.
The key difference between him and me are the figures. It's worth looking at his notes here:
The figures are beautiful.
How?!?!?!?
(Footnote due to recent bad experiences to pre-empt stupid answers: "Inkscape" is not an answer. I use Inkscape, and I know how long these things would take me. It's definitely not something I could do anywhere close to real-time. I want to know what conceivable workflow in Inkscape would allow those sorts of figures in even a significant fraction of lecture speed, let alone real-time)
https://github.com/gillescastel/inkscape-shortcut-manager
https://castel.dev/post/lecture-notes-2/
I've also done LaTeX for notes (in EMACS), but was never happy with how things looked when doing everything quick. The sheer genius of the setup he made is eye-opening.
https://drive.google.com/file/d/1eLe0LdKqPyPdmXel_3DwP9AZcIQ...
I don't know about real-time, though; I'd never try to draw figures in real time.
It’s not just Inkscape, it’s well configured Inkscape.
It didn't worked for my learning. As years pas by I value more paper, pen and books. Physical books. I am not anti tech, I was raised with always evolving digital technology. I read 300 eBooks I had NO WAY to pay for.
Latex looks awesome, and you feel proud when you put your notes in this format. But you feel equally proud when you are able to make a page equally beautiful with your hand. I enjoy solving things manually.
The best teacher I had in uni gave us handwritten skeleton notes which you had to complete while following the class. Completions used to be examples or demos, or long development steps to reach a solution.
This same course I read in a book about learning that this kind of material is the best for cognition. I felt grateful for that man. Despite being great at his field, and be super busy and travel a lot he really was into teaching undergrads and trying to use the right learning tools.
The course was heavy, really hard, but it was very rewarding.
I am not trying to downsize this article, It inspired me to push my skills. Just giving my experience.
Here's a few points:
- The syntax is a lot lighter and easier to type fast. I was up and running in half hour after starting to use it. Once in a while I can look up some symbol name in the docs but that's about it. I can type math notes almost at the speed of writing by hand and my right pinky doesn't fall off because of all backslashes and curly braces.
- Empty document is a valid document. No preambles, no includes etc, it's all optional and the defaults are sensible. Just start typing.
- It's incremental. Live preview from neovim is in the browser and it's lightning fast, pretty much immediate. No pdf sync pain. No build files, makefiles and all that. Just start typing.
While it's not going to beat latex in terms of serious academic use, for personal use and notes it's close to perfect.
(And of course it's written in Rust...)
I've somewhat recently switched to it for my notes from LaTeX, and it's really a lot easier to type then TeX.
For the most part, Typst is sort of like Markdown, but more stuff.
I stumbled on this blog recently when researching the same topic (nvim +latex). I found this more recent blog (https://www.ejmastnak.com/tutorials/vim-latex/intro/), by another author, inspired by this original author useful as well.
I found this blog post to be very helpful and the author was obviously a very good writer and I am sure he will be missed. Condolences to his friends and family.
In my experience studying physics, most of the learning happens by yourself trying to solve problems, putting hypothesis to yourself, trying, failing, examining what failed.
Presumably when vim/LaTeX are mastered, they're as easy to use (and easier to read back) than pen/paper.
I will often generate ten pages of scribbled on paper to come up with one page of LaTeX homework. And the I joyfully crumple up the ten pages and recycle them.
Later, when I become a prof, I had a few students who were the same. Assignments done directly in latex. So I am by no means unique.
I don't understand why. Programming is supposed to help managing complexity by abstraction and I can't understand why it can't help solving math. My gut feeling is the lack of a good language (that's why I tried to wrote my own library). May be I should try out Typst as mentioned in other comments.
Regarding writing in LaTeX, I hate its syntax for the following reasons:
- global namespace: how can I make sure there's no collision and have sane naming convention? - lack of flexibility of characters to use: basically just \somethinglikethis rather than easier to read variables like something_like_that - macros are hard to reuse, "functions" are difficult to rewrite: code reuse is difficult. In deriving math (with big expressions), one often copy a lot of things while simplifying a portion of them. How to achieve writing the next line efficiently, when carrying from the previous lines? Defining repetitive terms and reuse in the next line is good, until I then need to further simplify in following lines. - bad default behaviors: \left ( ... \right ) is just so noisy to be read in plain text and undistracted. In order words, LaTeX is good at typesetting, which also makes it hard to type (and read) in plain text.
My own library is supposed to solve all these issues. But reusing is still a pain. In plain LaTeX, if you want to reuse an equation you typeset for another documentation, you could just copy and paste. But with a library, then you need to somehow manage the dependencies as well.
Recorded lectures probably makes this approach work well (since you could backtrack if required). I did uni in the days before recorded lectures, and if your scrawling pen/paper notes contained a typo in an equation there was no easy way to get the correction - you had to ask around or consult the lecturer during office hours. A PITA frankly. And that's if you noticed the equation might be wrong.
There's such an incredible joy in good note taking. I only learned vim in the last year, and it increased my joy in programming immeasurably (well, I'd guess it about doubled if I had to quantify it).
If I studied economics again, I'd 100% learn LaTeX so I could take math notes in the way the author has. They're beautiful and timeless (literally, if committed to source control).
As a summary, he uses a custom keyboard shortcut manager¹ which allows him to compos multiple keystrokes (and also saves commonly used styles):
> For example, when I press `s` and `f` simultaneously, my shortcut manager will apply a solid stroke and a grey fill to the current selection. When I want the stroke to be thick, I press `s+f+g` together, where `g` stands for thick (as the `t` key is hard to reach).
[1]: he makes it available on GitHub: https://github.com/gillescastel/inkscape-shortcut-manager
These went beyond consistent, global abbreviations, or even course-level abbreviations: both were easy (and I can remember a few I used, like \beq/\eeq and \bea/\eea for beginning and ending an equation or eqnarray, etc, and \lt and \rt for \left and \right), but I could also quickly add definitions while taking notes, so if frequent symbols, or even whole expressions, showed up in a lecture I could \def them when it became likely they'd be used again. I could sometimes outpace the lecturer, working through equations on a board, because I could see where they were going to repeat expressions and just use the abbreviation I had made previously.
The larger problem I had, as an undergraduate at a time when many students had laptops but I was often the only one who would use one in class, is that I would worry about the typing being annoyingly loud. My use of Dvorak today is largely as a result of my exploring ways of trying to make my typing quieter: comparing typing on the same keyboard and around the same speed, I do seem to be able to type with considerably less noise with Dvorak than with QWERTY.
It does not cover creating figures, though.
That said, by the end of my physics degree I'd probably used thousands of sheets of paper...
Most prognoses for depression look more like "can you cope with feeling like this for the rest of your life?" vs. "we will cure you". The latter is, of course, possible, though generally there is a problem. Many people have chronic depression, and it generally takes a long time and a lot of therapist effort to "cure depression" unless you are lucky, so there aren't really the resources to fix the problem for most people in the world. Usually at best we can learn to cope with it, especially if it has origins in early trauma.
RIP
To help/encourage depressed people finding quality help - so the worst outcome (suicide) doesn't happen.
(Absurdity check: we're both talking of suicide prevention, right?)
I really don't know how to best answer you - so I recruited some help:
"Catching the early signs of someone struggling—like pulling back from activities or expressing a sense of hopelessness—can be key. It’s about noticing changes and gently encouraging a conversation or professional help."
"Sometimes people just don’t know where to start with getting help. If we can proactively share resources, like info on good therapists or support groups with someone in need, it can be a nudge in the right direction."
Assuming you believe psychology/psychotherapy has scientific merit, that is.
I was excited to see what he did later in life. I don't like equating a person with their professional output, but this post shows a level of creativity and vigor that is extremely rare. I'm sure it was apparent in other aspects of his life. I imagine his friends and family cherished him.
https://www.newscientist.com/article/2414241-writing-things-...
https://stackoverflow.blog/2022/11/23/why-writing-by-hand-is...
This is obviously different from "typing things out on a computer".
It's great to put your notes in latex. But that's just final polishing. It's just a medium.
I am not a genius, in fact I am pretty dumb, but I studied with geniuses. The more geniuses they where, the less things they wrote in class.
One of them, the extreme case, completed the 5 years Math and Physics combined undergrad IN ONLY 3 YEARS.
He just wrote 4 or 6 sentences in a white sheet for class, except when doing calculations, but he didn't do that much in class. Some sentences were facts others were questions. He seemed uninterested but I think he was doing heavy lifting in his head relating what he saw with what he knew. When you asked something to him he used to say "Yes this is not new, it's just a variation, combination or example of this".
If I were to do college again I would spend a lot of time reading the texts (more than one for comparing important topics), then go to class to listen and solve doubts and spend time solving problems (interleaving topics) and making active recall with spaced repetition.
Only after the exam I will put effort to try to sum up what I learned In a well rounded Latex small book. For sharing and for revising it later on, in case of need.
Why is it 'obviously different'?
The OP's title is How I'm able to take notes in mathematics lectures using [a computer]
What OP has described is clearly a different behavior than either handwriting or typing.
That's one hypothesis. Another would be the device [or lack of] is indeed the meaningful difference:
"Handwriting likely facilitates learning and memorization because of the numerous one-of-a-kind physical cues it provides: the shapes of your letters, the tactile feel of the paper and pen, the location of your words on the page, and details like folded corners, ink color, and other marks on the page. Your brain absorbs all of these pieces of information, which can later serve as triggers so that you more precisely pull the information from your memory.
By comparison, when you enter information into a phone or tablet, your words have no fixed position and then disappear when you close the app, leaving substantially less tactile and spatial information for your mind to absorb."[0]
[0] https://www.fastcompany.com/90618464/ditch-the-digital-notes...
...just as we should not assume the OP's note-taking methodology using a device to be equivalent to that of taking notes using pen and paper, because the interaction is substantially different
People tend to get wrapped up in the idea that writing stuff down is better than typing stuff out in terms of memory retention. But this is not the full story.
The reason that studies repeatedly conclude that writing notes is more effective than typing notes is that writing is a conscious effort. You are usually falling behind when writing compared to what is being spoken and therefore as a subconscious product, your mind is actually summarizing and filtering information from the speaker as they speak. You can't write every word they say, so you have to actually listen to the speaker and determine what is worth writing. Then as you write, it takes a conscious stream of effort to write out the words and it is a slower process, which allows your brain to focus on and digest the information another handful of seconds before moving on. The feedback loop that writing naturally requires is what makes it more applicable to memory retention, not the physical act of writing itself.
By comparison, most people can type around the speed of a speaker talking at a moderate cadence. This allows you to often type exactly what a speaker is saying, essentially as a stream of words coming in the ears and transferring directly into your motor control that allows for typing. This skips a processing stage (or introduces a very vague one) and so typed notes often become just streams of data collection as opposed to writing which tends to require elaborate data processing. It is the data processing that makes memory retention effective, not the writing of letters itself.
What OP is doing is creating the same feedback loop, potentially to an even stronger degree than writing allows for, because you have to consume the information, figure out how to translate that to LaTeX and determine a method for displaying that information. LaTeX often requires an understanding of the full function when creating it. This requires more processing, and then a secondary process of consideration in developing a written or image function into a LaTeX format.
Therefore, you get the same effect that writing provides, which is the data processing and translation components. This is what makes writing effective, not the movement of pen on paper. I would argue that what OP does is at least as effective as writing (maybe more, but that is conjecture).
That may depend on whether they can touch type. I don't know what percentage of HN audience can touch type, but the prevalence is pretty low among general population. The generation senior to me has more touch typists due to their training on typewriters. But I'm the only touch typist in my circle among the current and the next generation.
The reason why touch typing is important is that non-touch typing is very distracting and takes more cognitive effort - diverting some of your attention away from what you're supposed to be doing. I know the difference because I learned touch typing recently. In fact, I think that cognitive effort in non-touch typing is one of the reasons why it's not easy to remember things you type, compared to writing.
Maybe that’s fine if OP really likes to study, and high quality notes make that better. I always had pretty poor study habits, and needed to lock away as much info as I could during class.
Typing this way is a very different experience from typing with two hands, especially for people who can otherwise touch type.
I'd like to see a similar study with people allowed to touch type.
This one compared 'a paper datebook and pen, a calendar app on a digital tablet and a stylus, or a calendar app on a large smartphone and a touch-screen keyboard':
"Study shows stronger brain activity after writing on paper than on tablet or smartphone" https://www.u-tokyo.ac.jp/focus/en/press/z0508_00168.html
If I were doing my math and Econ classes today I would absolutely use an ipad. Not only can you draw diagrams along with the notes, you can take a picture of the whiteboard or someone else’s notes and extract the text out it. Then later on you can type up the notes to reintegrate (hah!) what you were writing down. Then you could use LaTex or whatever other markup system you want while thinking about the subject matter.
Writing by hand is much slower, but it's similar. I only think about letters or even individual words when I screw up.
Plus, typing in class is annoying for others.
That was my first question as well: there shouldn't be a need to take notes because the class should be provided in a written form (a book, something). Such that the student can focus on understanding what's happening instead of just writing down what the teacher says.
If taking notes helps understanding, that's different. But I doubt that writing in LateX particularly helps, on the contrary...
If you are writing down everything the teacher says, you aren't taking notes, you are transcribing a lecture.
Taking notes should only be the highlights, key ideas, and things you didn't understand or misunderstood when you prepped for the lecture.
My speculation has always been that it is a ritual that we were taught, memorization is just correlated to note-taking by hand for ~20 years for many of us. So it would make sense for that to put our brain in a “let’s memorize” mode (after all, people in the past, before widespread writing, memorized things—presumably they had a different ritual). I assumed people raised on typing would memorize better that way. But the experiments seem to contradict my worldview. :(
As another article[0] puts it, "going old school works because your brain is old school".
'Handwriting likely facilitates learning and memorization because of the numerous one-of-a-kind physical cues it provides: the shapes of your letters, the tactile feel of the paper and pen, the location of your words on the page, and details like folded corners, ink color, and other marks on the page. Your brain absorbs all of these pieces of information, which can later serve as triggers so that you more precisely pull the information from your memory.
By comparison, when you enter information into a phone or tablet, your words have no fixed position and then disappear when you close the app, leaving substantially less tactile and spatial information for your mind to absorb'
[0] https://www.fastcompany.com/90618464/ditch-the-digital-notes... way-better-for-memorization-and-speed
Myself, my handwriting is awful. It’s slow, illegible, and writing more than a sentence or two physically hurts my hand. It’s been this way for as long as I can remember, and it’s not for lack of practice. I practiced handwriting for sometimes hours a day growing up (not begrudgingly, I was serious about wanting to improve my handwriting), and my parents tried teaching me with different curriculums, different scripts, different techniques, different tools, etc. It was always miserable and my handwriting did not improve. Meanwhile, I can type at 150+ WPM.
So, when taking notes, if I write by hand I can’t keep up with the speaker, miss details because I’m focused on writing, have to skip/abbreviate stuff, and end up with something illegible. If I type, I can properly digest what I’m hearing and write it out with nice Markdown/LaTex formatting, in a file that is legible, searchable, and doesn’t get wrinkled up in my backpack.
I’d love to have better handwriting. The convenience and feel of pencil and paper is great, I don’t like having a screen in front of me while listening to someone talk, and good penmanship is something I respect a lot in others. But I’ve more or less given up on it at this point. If I actually care about remembering something, or want to be able to read it later, typed notes it is.
The dotfiles powering the demo (particularly, the UltiSnips folder) are at my github: https://github.com/ykonstant1/dotfiles
I went back to university after my divoce, mainly to have somthing to occupy my mind at the time. I did most of my annotations in Markdown.
The graphs and other images I would snap a photo in my phone from the blackboard, grab them from onedrive and puting the reference in my document, and after classI would drawin the proper application or get for a text and internet and copy paste.
For fluxograms I would use Mermaid.
For the editor I would just use vscode. I use vscode for almost everything, even control my spotify playback...
Here is a example of some of my anotiations https://github.com/joetorres/Materiais01/blob/master/04.N%C3...
https://github.com/joetorres/Materiais01/blob/master/07.Estr...
"How I'm able to take notes in mathematics lectures using LaTeX and Vim" (2019) https://news.ycombinator.com/item?id=19448678
https://news.ycombinator.com/item?id=32420925 :
> Computational Notebook speedrun competition ideas:
How I'm able to take notes in mathematics lectures using LaTeX and Vim - https://news.ycombinator.com/item?id=19448678 - March 2019 (221 comments)
How I'm able to take notes in mathematics lectures using LaTeX and Vim - https://news.ycombinator.com/item?id=19440652 - March 2019 (6 comments)
Rest in peace, you won't be forgotten.
\int \pi \geq \forall x \underbar \overbar \prime \^2 \therefore \pm \psi \implies \sqrt \2/3 y \approx \Omega
produces
∫π ≥ θ ∀ x̱̅′² ∴ ±ψ ⟹ √⅔y ≈ Ω
I even made my own mod to shorten the aliases of the most commonly used symbols. I long ago gave up trying to memorize all my notes. I can type as fast as I can write and then everything is easy to read and easy to search and instantly synced to cloud without having to transcribe anything after the fact. I had several professors ask me to show them how to set it up.
Vim has digraph support built-in¹, so for your example the first few digraphs are In, p*, >=, h*. It is also how I typed the ellipsis on the first line of this comment(,.), and the superscript footnotes(1S and 2S).
A more complete Unicode solution for vim is available in Christian Brabandt's excellent plugin².
Edit: reading a bit further, it seems like Typst has the ability to do a lot of the snippets as-is ($->$ is \to, $in$ is \in, etc.), and since variables in Typst are usable by mere mortals, it's easier to hack in the language you already use. For example, I use `#let la = $lambda$` as a shortcut.
Typing and Text Editors? My favorite text editor is my most important application program, and nearly all of my work is typing into that editor. Soooo, I agree that typing and text editors are important tools, approaches.
And I'm a TeX user: For any important writing, in math or not, I use TeX. Never tried LaTeX.
The text editor I use is KEdit, and for it I have lots of macros and write more continually.
VIM looks more advanced than KEdit!
For drawing of simple figures, I use the old Microsoft PhotoDraw -- you seem to have something more recent and better. Good!
Thanks!
That said, I use a stylus and digital tablet to take handwritten notes, which allows for sooo much flexibility, editability, and creativity.
https://karthinks.com/software/latex-input-for-impatient-sch...
For example, this comment was written by asking it to guess: ths cn nw b accmplsh b vague descri da math to chatgpt (or ur llm o choice) in reltym, even if u dscrb porly. u ca eve tk urpringly bd shrthnad nts n cnvrt nto gd trnscrpts.
This is probably an equivalent in emacs. Interestingly, this is more or less unusable in neovim because of how slow neovim's python interop is.
Closest guide I’ve read and used.