-
Notifications
You must be signed in to change notification settings - Fork 12
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
Unable to escape dollar signs #8
Comments
Thanks @eugenefischer ! Could you try if the version 1.3.3-beta.1 from npm works well for you? The demo at https://aarkue.github.io/tiptap-math-extension/ is also updated. I will need to do some more tests in the future before releasing this. Let me know if you run into any issues with that version! |
Thanks for the quick beta! On initial testing, this seems to do what I need. I'll let you know if I run into any edge cases. |
Actually, I did just hit one thing. I have my interface set to use bracket delimiters (since sometimes question authors might not wish to use LaTeX markup for questions involving money), but just as a test I switched back to dollar delimiters to look at the behavior. I think, with your new regex, it isn't possible to use LaTeX markup on decimal values when using dollar delimiters. So, someone using the default delimiter couldn't do something like:
I think a better way to check for spurious dollar delimiters is to require that the closing delimiter be preceded by a non-space character that isn't |
Good catch, thanks for testing! Something like I released a second beta 1.3.3-beta.2 and updated the demo at https://aarkue.github.io/tiptap-math-extension/ again. Feel free to try out if it works well for you. I will do some more testing later and eventually create a new release. |
Sweet, thanks again for the fast turnaround. I'll keep testing the updated beta, and let you know if I turn up anything else. |
Okay, here's another case: with dollar delimiters, They both work with bracket delimiters, so I'm guessing the software is still trying to parse when dollar signs should be counted based on the character following the leading delimiter. It seems to me, though, that as long as I can have a legitimate math expression that begins with something that could also be an amount of money, that's going to cause problems. My intuition is still that ensuring that what precedes the trailing delimiter is a non-whitespace, non-open-grouping-symbol character will work better. |
Thanks, @eugenefischer, you are right! As I still expect that some edge cases escaped my (limited) tests, I will keep this issue open for now :) |
Here's another edge case that fails with dollar delimiters:
Currently, with dollar delimiters, the extension will try to parse |
Thanks again for your input. I also added a few more test cases to cover these scenarios. Version 1.3.3-beta.6 is released with these fixes and the demo is updated. You are welcome to test them as well! I plan to soon create a new non-beta release with these changes. |
This is starting to look good! None of my initial round of tests broke anything. It did break on quoted text, though:
So double (") quotes are probably worth checking for before a closing delimeter at least. I don't think double quotes are used in math expressions as commonly as in prose, so the default should probably be to assume they aren't math. You could still get them in KaTeX with Single quotes are more of a question. British English often uses single quotes where American English uses double quotes, but single quotes are also more likely than double quotes to be in a LaTeX string, where they are used for accents and primes. Again, there's a shorthand for the prime usage. Instead of I'm honestly not sure what the best way to handle single quotes is. |
I think a reasonable approach might be to only check that math expressions do not end in See https://regexr.com/843ub for some examples of how that would look. Of course, thorough handling of quotes would also be good, but I think for the majority of use cases this is sufficient. As you mentioned, single quotes are more common in LaTeX, thus I would argue to not handle them specially. |
Hi @aarkue which version should i install to get the latest changes mentioned in here |
Hi @aldrinjenson, |
Great. Thanks! |
Awesome, Thanks!
…On Sat, Jan 04, 2025 at 2:13 AM, Aaron < ***@***.*** > wrote:
Hi @ aldrinjenson ( https://github.com/aldrinjenson ) ,
the latest changes (i.e., from my comment mentioning 1.3.3-beta.6) should
be available from version 1.3.3 onwards.
If you still run into incorrect LaTeX detection, feel free to share the
input text and I will try to look into it :)
—
Reply to this email directly, view it on GitHub (
#8 (comment)
) , or unsubscribe (
https://github.com/notifications/unsubscribe-auth/AMXO5ONFQJ2C42KXGYE6NU32I3Y6FAVCNFSM6AAAAABK3NQQK6VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDKNRZG44TCMZUGQ
).
You are receiving this because you were mentioned. Message ID: <aarkue/tiptap-math-extension/issues/8/2569791344
@ github. com>
|
I really appreciate this extension. I was wondering if it was possible to support escaping dollar signs within LaTeX strings? Currently, neither the default nor the brackets delimiter options seem to support
\$
to render a dollar sign. I've been able to use\text{\textdollar}
as a workaround, but I'm trying to create an interface where relatively nontechnical people can author math problems, many of which will talk about amounts of money. Being able to simply escape dollar signs with\$
would be very helpful.The text was updated successfully, but these errors were encountered: