4 ms·
This is fantastic! The best use case I can think of is to verify your python formulas are correct. It is much easier to read math notation than code.
by abnry 6y ago
This is fantastic! The best use case I can think of is to verify your python formulas are correct. It is much easier to read math notation than code.
- enriquto 6y ago> It is much easier to read math notation than code. I agree. And for writing, the difference is even bigger than for reading. Thus, what we need is the reverse tool, that translates our beautiful formulas into the damned code!
- ajuc 6y agoThe problem isn't translation, it's input. Keyboard is designed for serial 1-dimensional input, formulas are nested trees. The approaches I've seen are: - OCR a handwritten formula (unreliable but the most convenient) - make the user write serialized code and show it as formula (basically this submission, but also latex etc. - misses the point) - force the user to design the formula tree with some graphical editor and fill it with values and identifiers later (office suites do this and it's such a pain to constantly switch between keyboard and mouse)
- abdullahkhalids 6y agoWhen you write formulas by hand, don't you write them in serial format i.e. symbol by symbol? The advantage of hand is that you can often write the symbols in whatever order you want, while latex has pretty much a canonical order. Eg. by hand, you can write down the denominator of a fraction before the numerator. While latex require numerator before denominator.
- ajuc 6y agoYou filled the numerator and want to switch to denominator - how do you specify that with keyboard? You could use TAB or something, but that denominator could be nested in 10 levels of other stuff so you probably use mouse or jump for 5 seconds randomly until you get to the right place. The problem is that you have to jump which "by hand" is natural (start writing slightly lower) while with keyboard requires switching to mouse and back or remembering shortcuts and modeling the tree structure of your formula in your head to know where the shortcut will jump. Same with introducing new levels of nesting. That's why I prefer just writing code for formulas over graphical editors.
- enriquto 6y agothis is exactly the purpose of vim, dude
- ajuc 6y agoI haven't seen tree-edit mode in vim, I've seen it in emacs for clojure (it was called paredit or sth like that) and I've tried to learn it but couldn't get used to it in a few days. Maybe it would work better for formulas.
- enriquto 6y agoThere are a lot of "fancy" packages tailored to latex and formulas like vim-latexsuite, that set up place holders that you can navigate around and whatnot. But even without all that, a very basic thing that you can do is move around the matching pairs of braces (and brackets, and other paired things) using % If you do not want to move, but only see where the matching brace is, you can "set showmatch" and it will flash the matching brace when your cursor passes through the other one. This is really helpful for writing nested formulas (although a better strategy is to add a lot of newlines and whitespace so that the structure of your formulas is clear).
- ajuc 6y agoEven mcedit shows matching braces, that's not tree editing :) That would be editor showing a formula in graphic form and allowing you to jump around on it and add/move around nested parts of it with shortcuts.