-
Notifications
You must be signed in to change notification settings - Fork 26
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Code Golf: Text Expressions for easy Byte Count-based Golfing #737
base: main
Are you sure you want to change the base?
Conversation
I probably should add a page to the site (and a corresponding "Learn More" link) for this. |
Current status: All the functionality has essentially been implemented. Whenever you start a note expression with Another important note about auto-syncing is that it does not always occur--- if the expression below a note doesn't match its latex (and this isn't just because it's responding to an update), it will treat the expression below as a separate entity and create a new one to sync up. This is done to prevent cases where someone creates a graph with the plugin, hands it off to someone without the plugin who messes with the expressions directly, and then hands it off to a person with the plugin. I don't want their work getting overwritten by the plugin. |
Future plans: All I can really see myself doing now to get this feature production-ready is:
|
Bugs:
Also, an underlying issue of the pasting not working for stuff like Ideas for later PRs:
Two Pasting ApproachesThere's two ways to paste in expressions that give different results. Seems this plugin is always doing the first one:
If you paste in several lines, it's treated like there's a leading newline for all of them. People use both paste-approaches, and sometimes mix both paste approaches in the same hole. Aiden's skin solution, which uses leading newline for all the expressions except the first. In my Biohazard solution, I made an ad-hoc temporary meta where I added a byte for a newline whenever it needed approach 1. From a cursory scan of CGSE, the second approach tends to be more common since it removes the need for backslashes. As far as I know, the first approach is only needed for piecewises
Resolution 3 would be best if it seems to work reliably. I prefer Resolution 2 over resolution 1, especially if there's a Mathquill PR to make Mathquill handle |
Auto-syncing also stops if an action changes the value of the expression below. Expressions can be prevented from accidentally being Mathquill-edited by marking them as |
Yep, those are bugs, thx for catching them!
This was an intentional choice to avoid the two from accidentally being separated. Ideally I'd disable dragging from the very beginning, but I'm not totally sure how to do that yet.
Good idea. Given that I need to completely overhaul pasting anyway, I might just implement that in this PR.
I'll probably defer this for a later PR but agreed this'd be a good feature.
Best option imo is to stick with Resolution 4 unless I can find a way to make Resolution 3 reliable. I'll default to second approach and I'll add a |
Hmmm, to make it more concise I could probably instead switch to first-approach if there's more than one leading newline. |
Honestly, just to keep things simple, what I might do is delete all the golfed expressions and generate them from the ground up immediately afterwards, rather than changing the content in the expressions themselves. This will remove the custom colors and formatting and whatnot, but honestly I think that's an acceptable sacrifice considering how infrequently that's relevant to codegolfing. If I find I need that, I'll probably add it as some kind of syntax extension later. |
You've convinced me to prefer resolution 4, considering the idea for other
Then plain
Backslashes are unused in text mode. Maybe I should make it so latex, paste, and paste-with-newline are all parseable with text mode. |
I like your sync syntax proposal! I think I'll go with that. |
Adds in a feature where you can use text expressions/notes to specify the LaTeX of other expressions, enabling easy golfing based on byte count.