-
-
Notifications
You must be signed in to change notification settings - Fork 59
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
Update latexoperation.jl #280
Conversation
When interpolating Unitful types under an exponent, the latexoperation function should wrap ex.args[2] in parenthesis to properly display equation.
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## master #280 +/- ##
=======================================
Coverage 82.38% 82.38%
=======================================
Files 21 21
Lines 829 829
=======================================
Hits 683 683
Misses 146 146 ☔ View full report in Codecov by Sentry. |
Hi, |
Hi! |
Actually, I can think of a couple of counterexamples. Arrays for one. Bra-kets is another (that we've used as an example of a latexifiable object before). I'm starting to think quantities are really the outliers in this respect - it would probably not be very good to have the bracketing per default. |
Are there any plans to include something like this in future versions of Latexify? I teach my students to use units in all their calculations, and this little issue trips them up a lot. I currently use Cole's fix in a |
This is now fixed, rejoice. |
That's great. Will take it out of dev mode and update package.
–
Dr Torsten Schenkel
Dr.-Ing. habil. CEng FIMechE
Associate Professor of Continuum Mechanics
Sheffield Hallam University
Department of Engineering and Mathematics
College of Business, Technology and Engineering
Room 4206, Sheaf Building
Sheffield, S1 1WB
UK
Tel +44 (0)114 225 6294
Profile: https://www.shu.ac.uk/about-us/our-people/staff-profiles/torsten-schenkel
EC2M3 Lab: https://blogs.shu.ac.uk/ecm<https://blogs.shu.ac.uk/ecm/>
Github: https://github.com/TS-CUBED
Github Pages: https://ts-cubed.github.io<https://ts-cubed.github.io/>
…________________________________
From: gustaphe ***@***.***>
Sent: 03 July 2024 09:02
To: korsbo/Latexify.jl ***@***.***>
Cc: Schenkel, Torsten ***@***.***>; Comment ***@***.***>
Subject: Re: [korsbo/Latexify.jl] Update latexoperation.jl (PR #280)
This is now fixed, rejoice.
—
Reply to this email directly, view it on GitHub<#280 (comment)>, or unsubscribe<https://github.com/notifications/unsubscribe-auth/AMOMX2HCJZRI7HPWAOD7DDDZKOV2NAVCNFSM6AAAAABDDUIMLGVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDEMBVGM2TGOBSGE>.
You are receiving this because you commented.Message ID: ***@***.***>
|
Thank you for the update! I have now updated my package for the changes as well! |
When interpolating Unitful types under an exponent, the latexoperation function should wrap ex.args[2] in parenthesis to properly display equation.
You can see from the image above that it should look more like: z = (2 inch)^2 + (2 inch)^2 = 8 inch^2
This pull request fixes that issue. It checks whether the ex.args[2] is Real or is a Symbol, and if it isn't one of those, it wraps the ex.args[2] in parenthesis. I realize this may be too broad of a criteria. I didn't want to add any dependencies, but hopefully this pull request opens discussion on how best to fix this. Thanks!