Skip to content
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

[Feature]: custom styling command that does not group or affect positioning #2552

Open
orelbn opened this issue Nov 26, 2024 · 0 comments
Open

Comments

@orelbn
Copy link

orelbn commented Nov 26, 2024

Description

There are already styling commands, such as /class, but I would like to see a similar command that does not affect the positioning or cause grouping (similar to mathit but with the ability to apply custom styles). The grouping caused by commands such as /class and /operatorname makes it so there are different behaviours to doing things, such as pressing the backward key based on whether the the cursor is in or outside the group that might not be wanted in all cases.

My Specific use case:

In my application, I have some custom logic for wrapping variables/functions/units in styling when the user types (so that I can identify variables even if the user types non-continuously).

The steps are as follows:

  • Parse the input to identify variables/functions/units.
  • Wrap the identified symbols in the input using the appropriate styling.
  • Grab the mathfield current position. (currPosition = mf.position)
  • Set the value of the math-field (setValue())
  • Reset the positioning of the math-field (mf.position = currPosition)

Because the /class styling command affects the position, it's difficult for me to figure out the logic for setting the position after wrapping the variables in all circumstances.

My current workaround:

  • I wrap things with styling commands that do not affect the positioning, such as 'mathbf' (even though semantically it's not ideal), then overwrite the styles already applied to it.

All the best,

Orel

@orelbn orelbn changed the title [Feature]: styling command that does not group or affect positioning [Feature]: custom styling command that does not group or affect positioning Nov 26, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant