Hacker News new | past | comments | ask | show | jobs | submit login
I draw figures for my mathematical lecture notes using Inkscape (castel.dev)
542 points by adamnemecek on April 27, 2019 | hide | past | favorite | 97 comments



I've also read previous article about how the author manage to take lecture note using Vim+Latex (also posted on HN), and that's amazing how author managed to do that. But I'm thinking for people who does not know how to use Vim (arguingly high learning curve) and Latex to take note, what options do they have to take note quickly (with Math symbols/layouts)?

You can try out Mathcha[1] which is built to help people without knowing of Latex can easily write down Note (with rich Mathematics symbols/layouts) and it also provide basic Drawing and basic Function Plotting (The Drawing Part no way compare to Inkscape, but hey! you can type Math on Drawing on Mathcha) in single Editor.

Please note that I don't want to tout and advertise Mathcha here, the point is to provide another option for people to try out (I will not say it will provide faster or more powerful than Vim+Latex)

[1] Mathcha website: https://www.mathcha.io/

Disclaimer: I'm creator of Mathcha.


> (arguingly high learning curve)

vimtutor (type it in the command line)

after that: edit a couple of documents, write down what you want shortcuts to and learn those. Target practice allows you to learn vim quite quick.


I tended to introduce LaTeX to new folks through LyX.

Haven't used it for several years though, so no idea if the WSYIWYG is still up and running.


This might come off as pedantic, but LyX is explicitly designed to be What You See Is What You Mean (WYSIWYM) rather than What You See Is What You Get (WYSIWYG). It gives you the gist of how things will end up without attempting to actually represent the final LaTeX output while you edit. It's an incredible piece of software, and I strongly prefer it over raw LaTeX despite the fact that I learned LaTeX first.


Pedantic, but precise. Thanks for the clarification.


I've just checked LyX, actually it's quite good and similar to Mathcha, but actually it serves different goals/features than Mathcha.

- LyX: full Latex compiled, and Mix between WYSIWYG and Latex Script. Mainly use to create Latex Document

- Mathcha: can export some parts to Latex (mostly Math mode) but does not guarantee to compile, a full WYSIWYG editor. The goal to just create Document without constraints to Latex format


I love Lyx but wish there were a less involved setup. Takes a very long time to install over LTE, and TeX distro feels 50/50 dice roll. If it’s slow on LTE in Silicon Valley, it’s slow in Africa. Hard to recommend.


> If it’s slow on LTE in Silicon Valley, it’s slow in Africa.

No, "Africa" is far too huge and varied to generalize about like that. Plenty of African countries have reasonable mobile infrastructure, and low enough costs.

  $ apt install lyx
  …
  Need to get 216 MB of archives.
(This is coming from nothing, LaTeX isn't installed.) At 5Mb/s, that's about 6 minutes. That's not unreasonable for a one-off installation, especially in a country where these speeds are normal. (And 5Mb/s is slow: https://www.speedtest.net/global-index .)


The more likely hurdle is that it doesn't run on low-end smartphones (or maybe it does?) I know a Chinese university student who writes homework reports using Microsoft Word for Android because she can't afford another computer in addition to her phone. The situation in most African countries is probably not much better.


Well, if bandwidth or transfer quota is a big issue, it is always possible to use a CDROM or DVD with the packages...?


A what now? What’s a cd/dvd???


Why, you know, it's like a tiny and shiny vinyl record!


TeXmacs is an awesome graphical editor with full math support, that uses the TeX engine for rendering. It does not use TeX or LaTeX as its primary document structure though. It has many shortcuts for entering math that are really easy to learn and I have sucessfully used it to takes notes during lectures. I also use it as my primary work pad when thinking about complicated proofs.


TeXmacs unfortunately is a bit buggy. You get random errors from time to time, though I've never had a corrupted file. Otherwise I love it!


> what options do they have to take note quickly (with Math symbols/layouts)?

My friend is a math professor, uses tablets with stylus.


Another option that I used to write my lecture notes in is DokuWiki. Simple syntax in general and you can embed LaTeX for formulas. I used a Lenovo x-series tablet, so I also had a stylus to quickly draw diagrams in Gimp, and the keyboard was nice too.

I'd use Emacs org-mode now unless the Wiki made was needed to work on with others.


Mathcha looks awesome! Thanks for creating it. What's on the roadmap? Are there other options to export besides latex and PDF? Hmmm, just noticed, there's no one-time payment license for the desktop version.


1. Export types:

- Export to Latex (Mostly for Math Mode, and does not guarantee compiled in complicated case)

- Tikz (for Diagram)

- MathMl (Math Mode only)

- SVG/PNG (Math Mode and Diagram only)

- Save as Html (.zip file)

- Save as PDF (currently supported on Desktop version), but you can use Browser Print and save as PDF

2. Sorry, I don't have clear Road map, mainly I'm working on to add more features specifically on Math (for example Z Specification)

3. Unfortunately there is no one-time payment license now.


I am messing with Replete 2.0 for EDN expressions, but I am a fast and articulate English typer so Markdown-like Notes are my first step.


I am a person with a predominantly symbolic/linguistic way of thinking, and I'm aware that I tend to be bad at anything resembling graphic design, drawing, understanding of diagrams, etc... but this puts into perspective how much I really suck at that.

Out of the example figures in this post, some of them I would outright not know how to draw. Others I would be able to draw, but I think each of them would take me at least about an hour, maybe more. And this is not out of lack of familiarity with the tool: Inkscape is my go-to tool for vector drawing and what I use most for scientific paper figures, presentation slides, posters, lecture slides, etc. so I have lots of hours of practice with it.

Who is more of an outlier, the author or I? Is it really within the reach of most people to be able to whip up figures like that in a few minutes?


The author strikes me as someone who is ridiculously talented. Look at most people's presentation slides - figures are generally terrible.

One thing that seems to be missing from these posts though is that this kind of uber-productivity with tools and shortcuts takes serious practice. Even ridiculously talented individuals still need to commit those shortcuts to memory such that they can recall them when needed.


This is so true. I've been using Inkscape for years and it took me a long time to get used to the keystrokes and tools it provides. I recently gave a git talk at work and ended up drawing many, many diagrams for it using Inkscape. Even though I was well-versed in the tool, it still took a long time. So, it's a combination of dedication in time to practice but also dedication in time to create the illustrations.

On top of that, there's the learning of aesthetics along the way: what colors to use, what proportions to use, how much margin to set for better-looking illustrations, and so on. This takes serious practice.


This is the thing that blocks me from, for example, emacs. I really want to use it, but I really don't want to spend a few weeks learning how to use it.


I'm uncertain whether it is the conceptual step of visualising the image, or the execution that you find challenging. From the context I'm assuming it's the former. I find drawing these types of images effortless.

But I ( native English speaker) struggle ( had to google to write the first sentence ) with which is which in _former_ and _later_. I always imagine the past stretching behind and the first thing mentioned is now further away from me, so it should be the 'later' and the second thing mentioned is now closer to me and should be the 'former'. I've had this conversation enough to know that some people agree and others respond by sharply downgrading their estimation of my intelligence. As a _predominantly symbolic/linguistic_ person I suspect former/later is something you would perceive as effortless.

Though I have hard time taking the visual/auditory/kinaesthetic learning styles seriously, and with no thought as to the contribution to the variation between individuals being learned or innate - symbolic/linguistic/visual seem to be different competencies.

And Gilles Castel seems near the top of the curve on all of them.


Yes, it's mainly the conceptual part that is problematic. Although when drawing Bézier curves, for example, I also have problems with the execution, but I think they are also due to lack of visual thinking (the relation between where I click/drag the mouse and the final curve is totally non-obvious to me).

Indeed, as you assume, "former" and "later" don't pose any problem for me because I don't imagine anything visual at all when I evoke those concepts, I just think about what they mean in a non-visual way. But I can see why you would struggle if you think visually.

I guess the analogous weakness in my case is the one that manifests when I have hung my coat and forgot to take out e.g. the keys. I know what pocket my keys are in (e.g. suppose they are in the left inner pocket) but I totally struggle to find it when I'm not wearing the coat. Visual thinking seems to really outperform symbolic thinking in that problem, and sometimes memorization of the solution provides a shortcut in similar issues, but there it doesn't work because the coat can be hung in two orientations! So it's usually faster for me to take the coat, put it on, take the keys, and then hang the coat again, and in fact that's exactly what I do, at least if no one outside of friends and family is looking... :)

I'm not sure about learning styles (if a teacher provided a visual schema of a lesson I just translated it to words, or focused more on the oral explanation and ignored the diagram, and still learned it fine, it wasn't such a big deal as some people make it look like), but thinking styles are definitely a thing. I'm not sure if the difference is learned or innate either. In my case, I have always loved reading and read a lot since infancy, so it might be learned.


The coat image is very amusing :)


By the way, it's "latter", not "later".


I always imagine the past stretching behind and the first thing mentioned is now further away from me, so it should be the 'later'

If the past is behind you, isn't further away earlier in time? The Romans are further back than yesterday, right? So nearer should be later in time?

I often have to stop when doing filesystem datetime comparisons, to work out if I want greater-than or less-than, and picture it as Unix Epoch in seconds, the later time is a greater number, nearer things are closer and bigger and more recent, distant things are smaller, farther and more ancient.

(btw, it's former/latter)


Who is more of an outlier, the author or I?

I'd say both.

Is it really within the reach of most people to be able to whip up figures like that in a few minutes?

I'd say no.

This is a question that goes directly to the core of my competence. In general we're living in a pioneers' era where demand trumps offer overwhelmingly.

The tools we have, we don't use them because they're the best possible tools, but because they're the only tools available.

We are in such a need of any tool that works somehow, that we're deceived to think that they're wonderful when they're just slightly better than the rest. The space for improvement is vast, including a tool that would make those diagrams easy for you.


He’s ridiculously skilled with the tool. It would take me an hour to draw most of those diagrams and I used the same basic method (no advanced tooling) for my thesis.

There’s no way I’d use it in a lecture.


I wonder how much time he's invested to getting to the point where he's this productive.


You are definitely not the outlier. As someone with a predominantly visual/spatial way of thinking, programming has been a really tough skill to develop because, like math, it's often taught in the symbolic/linguistic manner. Only very recently, since using illustrator to diagram ideas, I am finally making progress on my (not assigned) projects. This seems like such an easy thing to do for most others in this space, but since instruction hasn't offered me the most apt thought patterns to program, have had to come up with my own.


I use Ipe [0] for my work. The wiki page [1] gives you an idea of what it looks like.

It's also open source and you can compile LaTex directly in the editor to see what it looks like without switching windows.

[0] http://ipe.otfried.org/ [1] https://en.wikipedia.org/wiki/Ipe_(software)


Ipe is great not just for figures, but also presentations. It supports multi-page documents, incremental build-up of slides, presentation style-sheets, and so on. Showcase:

https://github.com/otfried/ipe-wiki/wiki/Showcase#presentati...


Yeah IPE is definitely the best tool for this job. For 3D diagrams I've also used blender, either with its line rendering plugin Freestyle or by tracing over the output in IPE.


Ipe is absolutely fantastic! It's my go-to for any figures, and I'll only switch to Inkscape or Illustrator if I need to make a slightly more-involved diagram.


Ipe is great, although it is a little idiosyncratic. I haven’t found anything better for making structured diagrams.


I initially started writing a response to this thinking the author was referring to preparing lecture notes for lectures they were giving, not taking notes at lectures they were attending. That is entirely different, and I do have to wonder whether it's actually more efficient than, say, using a tablet to draw them, except in cases where the figures involve only use of common, repeated motifs.

I do agree with the author that taking lecture notes for math-heavy classes in LaTeX is quite possible, though I haven't done it since I was an undergraduate. While the author makes use of snippets in a particular text editor setup, I instead relied on extensive use of \def. With sufficient experience and intuition as to when to \def something, I could take notes in many classes faster than everyone writing by hand, and often faster and more clearly than the professor could write: I could insert a common but complicated expression with a few keystrokes, rather than writing it out or using something like ~ to refer to it. I would also use a standard set of \def's to make standard LaTeX faster to type: \beq and \eeq for \begin{equation} and \end{equation}, and so on. This also had the advantage of working in any text editor.

The disadvantage over snippets (I'm not sure how developed they were at the time) was, of course, that my LaTeX was incomprehensible for anyone else reading it, and my style had to change significantly once I started collaborating on projects rather than just writing notes for myself.

I've long used Inkscape for paper and prepared note figures, however, and I've found that many of my colleagues now do as well, after Adobe's transition to a subscription model. In doing so, I am very wary of the pdf+latex export: it doesn't seem as though it can reliably place text exactly, leaving the risk that it looks awkward or has text move when the font; it also makes figures that are not easily reusable in other places (eg, presentations, typesetters making HTML versions of papers, etc). Additionally, the pdf export itself doesn't seem to preserve editing very well. As such, I usually store parallel svg and pdf versions, in the interest of avoiding very non-standard LaTeX packages. However, if I recall correctly, there are packages that allow direct use of Inkscape SVGs in LaTeX.


As far as Inksccape goes, the MacOS experience is one of the worst I have ever had to deal with. Luckily, I only use it to extract individual photos from EPS/PDF files.

Unfortunately, all the good editing apps like Sketch and Affinity Designer cost a fortune when you factor in the actual use case. Figma is alright, but the desktop app feels like I am working with a piece of origami.


Exactly. Does anyone know what are the difficulties to provide a pleasant experience for Inkscape on Mac? Gimp looks decent. With Inkscape I wouldn't need anything else, really. Both are amazing.


> Does anyone know what are the difficulties to provide a pleasant experience for Inkscape on Mac

GIMP doesn't use the XQuartz X11 compatibility layer that Inkscape uses. Work is ongoing according to the Inkscape GitLab [1].

[1] https://gitlab.com/inkscape/inkscape/issues/84


GIMP and Inkscape are very different. GIMP has nearly no vector graphics editing support, although you can open svg files with it. Inkscape on the other hand is a vector graphics editor.


Looks like that's why Inkscape is needed in macOS! :-)


don't loose sleep over inkscape

Just buy affinity designer.


You're right. I have been able to get away with Keynote/Figma for the longest time but might be the time to get something sturdier.


I recently discovered keynote for illustration and animation. I will still use it in certain scenarios, esp if animation is involved. It’s amazingly capable.


Yes, it is! Some of the most creative infographics I have done have been with Keynote.


Keynote just needs some rudimentary keyframe animation capability and it will be set!

Because if not keyframe, it would be something like After Effects for graphics based animation.


Boxy SVG [1] has a user interface which is heavly influenced by Inkscape. The Linux version was released just few days ago and it is currently available for free on the Snap Store [2]. The macOS, Windows and Chrome OS versions cost only 9 USD (one time payment).

[1] https://boxy-svg.com

[2] https://snapcraft.io/boxy-svg


Unfortunately it's an Electron app.


>Unfortunately, all the good editing apps like Sketch and Affinity Designer cost a fortune when you factor in the actual use case.

affinity designer is $30, one time purchase.

How is that a fortune? Compared to Adobe Illustrator it's essentially free.

Compared to Inkscape, the productivity gains are priceless.


I am sure it was $50. Nevertheless, you are right. I am being stingy and favoring costs over productivity gains.


Ahh yes $50 normal price. They’ve had several 20% off sales in the past 6 mos.

Still $50 is a bargain for a professional level vector illustration app.


I used up the trial earlier in the year, and it definitely has a nice workflow. And by the looks of it, it's also capable of industry-grade editing.


The MacOS version simply doesn't work. The UI is mangled and it crashes if you do so much as look at it.


When I was at school I used markdown and converted to latex using pandoc. However I always drew all figures on a piece of paper with a date and number on it and then matched it with my notes. I couldn't find the right tool for this and I didn't think I'd be fast enough with inscape, but i guess if you really try it's possible. That's awesome but I wish this article released 5 years ago :)

I wonder though, are there any alternatives to inscape in which you can draw graphs quickly?


> I wonder though, are there any alternatives to inscape in which you can draw graphs quickly?

yEd [0] might be one. There's also an online version with (currently) a tad reduced feature set [1].

[0] https://www.yworks.com/products/yed [1] https://www.yworks.com/products/yed-live

There are a number of other applications, though. I still like Graphviz for quickly creating a graph structure, but tweaking its layouts can be cumbersome (Note: yEd Live supports rudimentary Graphviz import as well). There's also dia, draw.io, Gliffy, LucidChart, OpenOffice Draw, Omnigraffle. And PowerPoint works to some extent as well.

(Disclaimer: I work for yWorks.)


yEd is very helpful. I occasionally use it since many years.


The scripted diagramming space is very weak. It's strange to me, because I think having an expressive scripting language bound to a UI that can show you the result and maybe help with selecting attachment points, could be a nice and fast way to crank out diagrams.


I have been really enjoying the blockdiag(3) diagramming packages. I use rackdiag to generate server rack diagrams. seqdiag for diagnosing issues or for flowcharting, and am working on an automated mapper that uses netdiag to generate network maps.

Those of you looking for programmatic diagram generation, I'd you aren't talking math heavy, try it out. I'd you want math diagram generation, I think that might generally be best done with r/octave/d3 inside an emacs org file or jupyter notebook.


Is there any way to use inkscape and have it seamlessly integrate with sharelatex? I'd be kind of concerned about using sharelatex with inkscape PDFs, and then forget about or lose the folder with the inkscape source files.


Very impressive that these figures are drawn at lecture pace. I used to write my maths notes up in LaTeX, but it was always after the fact from my handwriten notes. Even typesetting math takes time.


I could do math typesetting at lecture pace with my 90-100wpm.

But I can't imagine sketching my figures in inkscape.


Just curious, in the exams are you allowed to use Latex too? It is difficult to think that it wouldn't be a hinderance.


Exams were pen and paper only.


An older, similar program is xfig.


I use XFig - the learning curve is bad, but the results are great. And it integrates rather easy with LaTeX.


Native LaTeX equation editing for technical diagrams was probably the biggest itch I wanted to scratch with the diagramming application I wrote (https://vexlio.com). Unfortunately I haven't had much time to devote to development recently, but it's still out there and hopefully still useful to people.


I really like Tikz but I find drawing anything with it extremely time consuming. At some point you have to ask yourself whether it's worth it. Personally, I think I'm done with Tikz. Next time I'm gonna try something else. Inkscape in particular looks like it could be a good alternative.


It's pretty great! I used it to build my business's logo and really enjoyed working with such a comprehensive suite of tools, probably using a fraction of a percent of its capability and doing so in a brutish fashion.

However, my biggest challenge with it, and I've experienced this with other similar software, is how it handles text along a path.

After struggling with this for some time I just took a somewhat brute force approach and made hidden arcs that achieved the target text curvature, despite that arc not being part of the circle.


When I see stuff like this and the author's previous artile, it reminds me of the overwhelming potential of scriptable systems and customizable open source software. But at the same time, trying to pursue these things has always been a net negative for me in terms of productivity, for several reasons: there is often such a high learning curve, there are so many different choices of programs that people use (with the resulting community fragmentation), and there is so little investment in UX. So I get all caught up in learning the systems themselves instead of dealing with the limitations of the systems I know and getting to the actual work. So on one hand I know I'm stuck in local maxima, but on the other hand it remains such a long and risky investment to try to seek other more optimal solutions.


It's such a pity that LatexDraw is not developed more. It would be the ideal solution if it had a few more features. I currently use Dia for the same purpose as the author uses, but I have to admit that the graphics in this article look pretty good. I'll give Inkscape a try.


Yes I think serious practice is needed. There is something else that is a disadvantage: you need anyway to review your lecture notes; but since they are so beautiful you do not easily see mistakes; one way to avoid overly beautiful notes is to use a kind of draft font that deliberately looks a bit off. The drawings (with the keyholes ) are of path integrals with holomorphic functions (something I did around 1982)

But the whole idea and execution are phenomenal.

My feeling is that using emacs it could be possibly easier but I will not try to convert a vimmer


Is inkscape unique in using standard SVG as its native file format?


Note that while inkscape SVGs do conform to the standard, they do contain extra information in their separate namespace to preserve UI information across save/restore cycles.

One example would be layers. They are saved as standard complient groups of SVGs features. But not all grouped elements form their own layers. So the groups that should be shown as layers do have extra meta data on them. Any standard complient SVG reader while deal with that group correctly, but might not represent it as a layer in it's GUI.


> but might not represent it as a layer in it's GUI.

How would you visually represent a layer in a GUI? Layers are logical, not visual, groupings.

Edit: I wasn't considering the editor itself a GUI in this scenario, although it clearly is. I was thinking of the GUI (such as a web browser) where the SVG was being used.


In the editor, using the layers interface:

http://wiki.inkscape.org/wiki/index.php/Layer_Dialog

While obviously if you open the SVG in a web browser, layer information is ignored.


OK, you mean in the editor, not in the GUI that's displaying the SVG.

(I use the layers dialog in Inkscape on a weekly basis -- and used to in Illustrator as well).


Boxy SVG (https://boxy-svg.com) and macSVG (http://macsvg.org) use SVG as a native format as well.

Since Inkscape is a general purpose design app rather than just an SVG editor, it is adding a lot of metadata to the SVG code it generates in order to preserve editing capabilities.


Even Chris Olah uses Inkscape. (Personally, I prefer TikZ, do to the easiness to change styles in a more semantic way.)

Vide "Simple diagrams of convoluted neural networks" https://medium.com/inbrowserai/simple-diagrams-of-convoluted... with an overview of tools for drawing diagrams for deep learning.


This is awesome! Doing graphics in LaTeX has always had a pretty high barrier to entry (not to mention constant trial and error).


It's pretty much the same argument as web designers who choose to use a visual design tool versus those who choose to write HTML, CSS and JS to produce their design. Some things are easier when designed visually, others are easier when written in code. Doing LaTeX graphics is the same.


As a web developer who tried various visual design tools in the 1990s and finally eschewed them all and went back to using Vim or (later) Sublime Text for coding markup and CSS, I'm curious what things are easier when designed visually for you.


No. I started web design using Dreamweaver a long time ago. When I began, I used its visual design features quite a bit. Nowadays I just have an editor (usually Emacs) and a browser window side by side. I, do however, find visual design tools useful for prototyping.


I love Inkscape for being a great "learn once run anywhere/anytime" vector drawing tool. No searching/cracking/paying for the few time a year I need a tool like that.

Always there so the skill I developed with it can be put to use efficiently. I love open source so much for this.


I did most of the illustrations in my PhD thesis using PowerPoint (export via PDF and include in Latex), which I found more practical than Inkscape. Of course it’s not designed for scientific diagrams but you can actually produce some pretty decent looking illustrations with it.


Was this due to already knowing PowerPoint and not knowing Inkscape? I can think of exactly 0 ways in which PowerPoint is better :)

Can you link to your thesis?


Thesis is here: https://github.com/adewes/phd-thesis-physics

Inkscape was very difficult to use at the time (IMHO) and had lots of bugs, maybe this improved in the meantime as almost 10 years have passed.


If drawing some complicated geometry or high precision is not required, GNU Texmacs is also a good choice. You can do everything in the editor and see the immediate result, WYSIWYG style.


>> but once you’ve got the ba­sics down, it’s hard to get back to an ed­i­tor with­out Vim key­bind­ings.

Right..because it's hardly possible to quit fucking vim :(


This is exactly what i needed all these years i was typing in TiKz or using corel draw without latex support.



Trivial point: `Omit text in pdf and cre­ate LaTeX file’ Should be "emit text"!


No, if you look at what it's doing, I think "Omit" is the word they wanted to use. They're saying, "Omit the (Latex code) text in pdf and create (in addition to the pdf) a Latex file (that has references to placeholders where the Latex code was originally)".

I've not used this feature in Inkscape, but that's how it seems to work.


You are correct. I should have read more carefully and verified instead of assuming.


This looks really impressive, but I don't think that figure drawing should be required in lectures. It's a huge distraction, lecturers should prepare scripts instead, in this day and age. Redrawing the figure might help some understanding, if construction is proof, but often it only serves to depict labels on a graph, not to solve a geometric puzzle.


It looks more to me like this just happens to be the technique that the OP prefers to use to take notes. I imagine most students use paper or a tablet.




Consider applying for YC's W25 batch! Applications are open till Nov 12.

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: