Skip to content

Conversation

@gustaphe
Copy link
Collaborator

Adds a post kwarg to @latexdefine, which gives you a bit more control of how the final rhs is formatted.

julia> @latexdefine x=3.75 post=x->round(x; sigdigits=2)
L"$x = 3.75 = 3.8$"

julia> @latexdefine x=1//2 post=float
L"$x = \frac{1}{2} = 0.5$"

julia> using Unitful, UnitfulLatexify; m = 5u"kg"; v = 10u"m/s";

julia> @latexdefine E = m*v^2/2 post=u"J"
L"$E = \frac{m \cdot v^{2}}{2} = 250.0\;\mathrm{J}$"

I'm mostly interested in this last one for physics material, but I think this is general enough it could be useful in different contexts as well.

@codecov
Copy link

codecov bot commented Apr 28, 2022

Codecov Report

Merging #220 (ffd834f) into master (1067732) will increase coverage by 0.60%.
The diff coverage is 100.00%.

@@            Coverage Diff             @@
##           master     #220      +/-   ##
==========================================
+ Coverage   63.24%   63.84%   +0.60%     
==========================================
  Files          23       23              
  Lines         827      838      +11     
==========================================
+ Hits          523      535      +12     
+ Misses        304      303       -1     
Impacted Files Coverage Δ
src/macros.jl 100.00% <100.00%> (+7.69%) ⬆️
src/latexoperation.jl 84.89% <0.00%> (+0.10%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 1067732...ffd834f. Read the comment docs.

@gustaphe gustaphe merged commit 8b860d3 into korsbo:master Apr 29, 2022
@gustaphe gustaphe deleted the post branch April 29, 2022 14:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants