back
20 comments
I bet math textbooks would be great with "syntax highlighting" ... If it works for code, why not?
Richard Feynman had grapheme-color synesthesia, so he effectively saw all math with "syntax highlighting":

http://sdl.granthazard.com/exhibits/show/famous-synesthetes/...

I have some proposed a system with examples here:

https://nbeaver.github.io/equation-manager-description/

Thanks for the links, I didn't previously know that Feynman was a synesthete.

Grapheme synesthesia is the most frequent type of synesthesia. I'm also a grapheme synesthete which is no doubt the only talent I'd have in common with Feynman. What makes this form of synesthesia a feature and not a bug is illustrated by research showing grapheme synesthetes probably have above average visual learning ability.

I can say that the sensory phenomena do tend to dim with age, but for me it was quite vivid as a kid, numbers, letters and words were strongly "colored" automatically. That did help memorizing things that schoolwork required, but in my case not tremendously helpful for solving math problems.

I looked at the PDF. Feynman's description is rather like my experience, though I'd emphasize that individual numbers and letters had unique, stable "colorization". IOW it's not that all numerals were blue, but that 0 was cyan, 1 was black, 2 yellow, etc.

Likewise A or a was red, B appeared green, b looked yellow-green, and so on. Combinations of letters in words would take on a meaning communicated as particular blocks of colors, that is, certain key words or phrases were readily identified.

Kind of weird to write it out like that but I believe it did make it easier to get through the rote parts of schooling. When I got bored sometimes I'd toss things around in my head, colors flying everywhere. The teacher could never guess what I was thinking...

Each synesthete has an individual sensory pattern, and syntax highlighting schemes are probably quite a bit different from synesthetic perception. Nonetheless what you show is very likely a good idea. I sure appreciate using syntax highlighting for code editing, suggesting there are good reasons to think it's worth applying elsewhere.

I'd be happy if more physicists would just include a list that defines all variables. They are just generally introduced in the text as they are needed, so trying to pull a useful bit out of a 100+ page review article is a huge pain.
I'd enjoy an interactive version that could e.g. define variables when the mouse hovers above them. It's a shame that we're still bound so much by the rules of print.
Most of my statistics books actually had very useful summaries of variable symbols & names, as well as other useful referential information [1] in the front and back endpapers.

[1] For example, there was a non-parametric stats book that had a table with common conditions for each statistic covered.

Yea, many textbooks even a few journal articles do this very well.
College textbooks sure would be easier that way. Most of my note-taking process is defining things more formally, making things colourcoded and drawing out the relationships.
Does it really work in code?
Yes. The basic error checking provided by something as simple as different colours for reserved words, defined variables, strings, etc, is extremely useful.

More developed syntax highlighting which knows about methods or functions that are in scope vs out of scope, variabkes that sre not defined in this scope, etc, are another layer of utility.

I get used to "for" being a certain shade of blue. When it is not blue, there is something wrong. If it is green, I have an unclosed string somewhere. If it is red, I have an unclosed block interfering with scope. If it is underlined, I have put the "for" where the parser was expecting an identifier.

Color coding syntax makes code jump off the page for many of us. Does it for you?

Bracket and parenthesis highlighting alone is invaluable.

My style is Obsidian, with a dark background, yellow/orange quoted text, blue variables, grey comments, bold white operators, white block comments. Ported from VI to N++ for a unified experience.

I don't know. I do it too, like everyone else, but I'm not sure how much of a benefit I get from it.
Maybe you should try turning it off for a while? The benefit for me is highly proven - I'm 5 to 10 times more likely to make a bracket or parenthesis mistake without color coding. And I make about 10% more variable/comment errors too.
I tried turning off syntax highlighting for a while. I actually liked it better. But at the time I was programming in Clojure, where there isn't much syntax, and you just read your code as a tree of tokens mapped to abstract ideas. In Lisp my favorite use of syntax highlighting is honestly to decrease the opacity of parentheses.

That's kind of interesting, now that I think about it. I wonder if in other languages I'd prefer coding in one color but with all errors and open brackets in red. Does anyone know something like this for Vim?

I would argue that it does. It helps me spot stupid errors that I might have to hunt for later if it wasn't for seeing the pattern of colored syntax highlighting.
I find it helps in grasping the gross structure of a piece of code, which lets me know where to focus my attention. Also highlighting strings has saved my butt a few times.
I'd love markers to show who is speaking in more complex dialogue exchanges (eg LotR), I hate when I've read a few sentences and realise I should be doing a different voice.
Perhaps this article could have benefited from colored text?