gtg922r / obsidian-numerals

An obsidian plugin which turns a math code block into a full featured calculator
Other
391 stars 8 forks source link

awesome plugin! please add fraction support #2

Closed KraXen72 closed 1 year ago

KraXen72 commented 1 year ago

i would love if i could do calculations with fractions. currently i have to use latex and latex2sympy2, which is nonideal as writing latex is somewhat cumbersome

gtg922r commented 1 year ago

Fractions are supported via the fraction function.

fraction(1/3) + fraction(1/4) → 7/12

For further information on functions that support fractions, see math.js | Fractions

Is there additional support you'd like to see here?

claremacrae commented 1 year ago

Think I would suggest closing this now, since its documented now on the README how to use fractions.

gtg922r commented 1 year ago

Closing as fractions function exists and is now documented (thanks @claremacrae). Feel free to re-open if there is a specific feature you want to see supported.

Likely numerals will not support symbolic math by default (hence the fraction function) as its primary use is as a numeric calculator. You might want to consider Obsidian Mathpad if you are looking for symbolic math as I believe that may support it natively.

Additionally if you just want to see fractions rendered as fractions, then keep an eye on #7 , which will render them in the input as fractions

gtg922r commented 1 year ago

Note that with release 0.0.12, TeX rendering of inputs and results has been implemented either by setting the default render style in settings, or by using math-tex. This will render fractions in a more "fraction-like" format - though you will still need to use fraction() if you want to force the calculation to not result to a number.

Screenshot 2022-11-13 at 1 47 28 AM

KraXen72 commented 1 year ago

very nice! maybe it could be useful to hide the fraction() text from the rendered result? it's already pretty useful. (as an option/default ig) you could differentiate the 2 styles by using \tfrac for the number resulting ones and \dfrac (tall) for fraction()