Skip to content

Cursor#506

Closed
daniel3735928559 wants to merge 5 commits intoKaTeX:masterfrom
daniel3735928559:cursor
Closed

Cursor#506
daniel3735928559 wants to merge 5 commits intoKaTeX:masterfrom
daniel3735928559:cursor

Conversation

@daniel3735928559
Copy link

Going back to #358, this adds a \cursor command with an optional shift argument, and an argument for height (the same arguments as the \rule command, but without width). I needed this for a WYSIWYG mathematics editor project guppy (see also demo).

The original idea was to try to mess with \kern and \rule and similar to get the desired result of a vertical line that is 1 pixel thick and doesn't affect the appearance/spacing/etc. of the surrounding equation wherever it is inserted. But part of the trouble seems to be that \rule gets a .mord class which may affect the spacing between elements if, for example, it is between a .mbin element and a .mord element. So I ended up creating a separate command for this purpose.

Since this is not a command from standard LaTeX, I am not sure what the policy is on actually including this, but I wanted to at least document how it could be done (and/or find out if there is a better way), in case anyone else also wants this. If there is appetite for including it, I am happy to go through the rest of the proper procedure (squashing commits, maybe adding tests, etc.) also.

If it is best not to have it in the actual repo, I would be interested in some mechanism by which this could be made into a plugin, (since as it is, I end up needing to constantly merge in updates to KaTeX to my repository, whereas if I could just pull in the latest version and have the separate plugin, this might be simplified).

@daniel3735928559 daniel3735928559 mentioned this pull request Jul 16, 2016
@k4b7
Copy link
Member

k4b7 commented Jul 29, 2016

@daniel3735928559 in general we try to avoid non-standard commands. That being said, being able to use KaTeX for editing would be immensely useful. I think having some sort of plugin system would be nice, but I think we'd want to work on defining a display agnostic layout data structure first. This change would break plugins if they were using the existing system. I'm going to leave this open for now as a reference how to do cursors and as a reminder that people will find a plugin system useful.

@k4b7 k4b7 added the on hold label Jul 29, 2016
@gagern
Copy link
Collaborator

gagern commented Aug 17, 2016

When devising a plugin system, please keep the render-to-canvas from #251 in mind as well as the #376 intermediate representation it motivated (and which you probably meant by “display agnostic layout data structure”). Do you want to open a ticket to discuss requirements for a plugin system, @kevinbarabash?

@k4b7
Copy link
Member

k4b7 commented Aug 22, 2017

Blocked on #762.

@k4b7 k4b7 added blocked and removed on hold labels Aug 22, 2017
@k4b7
Copy link
Member

k4b7 commented Jan 22, 2018

I think this could be done in a similar way to how #1074 implements \class in the contrib folder.

@k4b7
Copy link
Member

k4b7 commented Jan 22, 2018

@daniel3735928559 sorry for letting this sit in limbo for so long. If you're still interested in adding this feature, it's probably best to wait until #1074 lands before reworking things.

@daniel3735928559
Copy link
Author

I am indeed still interested! I haven't looked at that PR yet in depth; while a compile-time plugin system still requires me to retain a KaTeX source module (and could in principle lead to a bunch of out-of-date such modules in the wild, especially if a plugin is very widely used like \class might be), at least I wouldn't have to rebase these changes constantly so it's an improvement over the current state.

If this is the way forward then I can update this PR when it is ready.

@k4b7 k4b7 added the blocked label Feb 11, 2018
@k4b7
Copy link
Member

k4b7 commented May 28, 2018

I'm going to close this for now since #1074 has been closed. I think we'll probably start looking at how to support a plugin architecture after the 1.0 release.

@k4b7 k4b7 closed this May 28, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants