gtg922r / obsidian-numerals

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

Decimals not showing up #23

Closed Venturi365 closed 1 year ago

Venturi365 commented 1 year ago

I've just installed the plugin in my obsidian and works perfectly, however the decimals are not showing up for some reason.

imagen_2023-01-15_180614804

gtg922r commented 1 year ago

Very odd! Do you see the same issue if you use math-plain?

What theme are you using?

Would you mind sharing your current locale by opening up the console in obsidian (alt-ctrl/cmd-i), and typing navigator.language in the console?. You should see something like en-US or ru-RU, etc

RobertoHRO commented 1 year ago

I have the same issue. At the console I get: image

And the this is the output: image

I get for this input: image

gtg922r commented 1 year ago

Thanks, should help me debug the issue

On Mon, Jan 23, 2023 at 12:07 AM RobertoHRO @.***> wrote:

I have the same issue. At the console I get: [image: image] https://user-images.githubusercontent.com/25647024/213991243-45b994bb-7e6c-45d8-b952-bc147142ff6a.png

And the this is the output: [image: image] https://user-images.githubusercontent.com/25647024/213991481-67175bbc-7207-4623-9061-fffa4e9225ad.png

I get for this input: [image: image] https://user-images.githubusercontent.com/25647024/213991564-879de7fa-2ab0-40c4-b996-9b1e367c5421.png

— Reply to this email directly, view it on GitHub https://github.com/gtg922r/obsidian-numerals/issues/23#issuecomment-1399943012, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAJDZJUG35FQO43EMUT5VOTWTY323ANCNFSM6AAAAAAT3637BI . You are receiving this because you commented.Message ID: @.***>

gtg922r commented 1 year ago

Thanks for the bug reports.

I've located the issue. Numerals is attempting to format results in the users home locale. For math-tex and math-highlight, Numerals sends the results back to mathjs (the underlying math library) for formatting in TeX. Unfortunately, mathjs doesn't play well with non en-US type locale number formats (for example comma decimal separators).

I'm not sure I'll be able to solve this elegantly without substantial work adjusting for the underlying issue in mathjs

Which leaves me with a question for users in a locale with different decimal and thousands separators:

When in math-tex mode, would you rather see the result side commented in tex but with en-US style number formatting (eg ~$1,000.00), or would you rather see results in your locale standard, but without tex formatting?

RobertoHRO commented 1 year ago

I would choose the locale standard, but without tex formatting.

Input and output number formatting should be the same. - A conversion by the program will lead to confusion. Especially if the output (result) will be written back to the note. Identical number formatting together with writing results to the note, enables some kind of calculative conversation with the program.

Another solution could be to use in math-tex environment always en-US input interpretation and output generation?

And/Or display the current format in the upper right corner. - In tex it could always be en-US (I have no idea how hard this is to implement)

gtg922r commented 1 year ago

Fixed in the latest 1.2 release!

Please check it out and re-open if still having issues