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

Option to Disable Automatic \mathbf Extension to Subsequent Characters #2208

Open
ichibha opened this issue Dec 11, 2023 · 4 comments
Open

Comments

@ichibha
Copy link

ichibha commented Dec 11, 2023

Description

In the current implementation, when typing characters immediately after a \mathbf{foo} expression, the typed characters (e.g., bar) automatically convert to \mathbf{bar}. This feature can sometimes be inconvenient, especially since \mathbf is commonly used for single characters, for example, matrices.

Expected Behavior

Is there a way to disable this automatic \mathbf extension so that subsequent characters are not automatically formatted without typing space key?

@arnog
Copy link
Owner

arnog commented Dec 11, 2023

As you mention, there is already a way to do this by pressing the SPACE key. Another way would be to use a custom onInlineShortcut hook. See https://cortexjs.io/mathlive/guides/shortcuts/#multicharacter-identifiers for more info.

@ichibha
Copy link
Author

ichibha commented Dec 11, 2023

@arnog, I appreciate your prompt response. I've encountered an issue where, despite having a non-empty mathModeSpace, using the SPACE key both inserts a space symbol and exits the typeface extension. It would be helpful if the executeCommand function could include an option to exit the typeface extension programmatically, for example, to assign a different keybinding.

@arnog
Copy link
Owner

arnog commented Dec 11, 2023

I'm sorry, I don't follow. The initial report was about a user typing in a mathfield, but now you're talking about using an API? You can change the style using the mf.applyStyle() function, but I'm really not sure what you're trying to do or whether there is an issue or not.

@ichibha
Copy link
Author

ichibha commented Dec 11, 2023

@arnog, I apologize for not providing enough details earlier. My aim is consistent with what I initially mentioned in my first comment about disabling the automatic \mathbf extension. To accomplish this, I considered repeatedly using an API similar to mf.executeCommand("change the style to default (italic)"). However, it appears that this might be possible using mf.applyStyle("italic"). I overlooked this API because I didn't anticipate that styles were handled by a function other than executeCommand. I will experiment with mf.applyStyle().

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

2 participants