artisticat1 / obsidian-latex-suite

Make typesetting LaTeX as fast as handwriting through snippets, text expansion, and editor enhancements
MIT License
1.43k stars 56 forks source link

Conceal all types of fractions, not just \frac #344

Closed llakala closed 3 weeks ago

llakala commented 3 weeks ago

Currently, the only fractions that are concealed are \frac. I prefer using \dfrac for everything, since it'll always display as large, even when doing inline math. However, doing this has made me lose out on concealed fractions.This PR aims to fix that. Now, the regex for finding fractions looks for all types of fractions.

Regex is absolutely not my strong suit, and I wouldn't be surprised if there's a better way to match for the string "frac" that may or may not be preceded by d, t, or g. Feel free to enlighten me on this!

artisticat1 commented 3 weeks ago

Thanks!

Regex is absolutely not my strong suit, and I wouldn't be surprised if there's a better way to match for the string "frac" that may or may not be preceded by d, t, or g. Feel free to enlighten me on this!

(d|t|g)?frac will work as you described :)

Your current solution also works well, so I'm happy to merge!