-
Notifications
You must be signed in to change notification settings - Fork 122
Move UnitfulLatexify into Unitful extension #795
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
Merged
Merged
Changes from 22 commits
Commits
Show all changes
25 commits
Select commit
Hold shift + click to select a range
aad1161
Move UnitfulLatexify into extension, along with tests, following #668
Ickaser 8a9704e
Add UnitfulLatexify docs
Ickaser 87e95ea
Remove actual plotting command from docs
Ickaser d13a51e
Remove ranges from docs
Ickaser 329190d
Swap range example for list example in docs
Ickaser fe8f81a
Add extension to README
Ickaser 33d778c
Merge branch 'PainterQubits:master' into latexify-ext
Ickaser dc8b71c
Move UnitfulLatexify into extension, along with tests, following #668
Ickaser 6d461a7
Add UnitfulLatexify docs
Ickaser e8ea39c
Remove actual plotting command from docs
Ickaser cf8b7db
Remove ranges from docs
Ickaser 5458be2
Swap range example for list example in docs
Ickaser dc754da
Add extension to README
Ickaser 210cbee
Try letting runner generate the example images for docs
Ickaser 0b7b03d
Merge branch 'latexify-ext' of https://github.com/Ickaser/Unitful.jl …
Ickaser 887800f
Try out Latexify.render
Ickaser 8944f77
Use Latexify.render with new command line options to render images
Ickaser 35316ac
Merge branch 'master' into latexify-ext
Ickaser d5ad57c
Try to improve LaTeX behavior on GitHub runner
Ickaser a654560
try again on fonts for allunits.png
Ickaser da11483
Redo headers and go back to FreeFont
Ickaser c4939c9
Remove latex-generated images from checkin
Ickaser 4288e15
Improve docs output
Ickaser e80cbbb
Match spacing in docs to current code status
Ickaser 443daf0
Note the default permode
Ickaser File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -2,9 +2,12 @@ | |
| Dates = "ade2ca70-3891-5945-98fb-dc099432e06a" | ||
| Documenter = "e30172f5-a6a5-5a46-863b-614d45cd2de4" | ||
| InverseFunctions = "3587e190-3f89-42d0-90ee-14403ec27112" | ||
| LaTeXStrings = "b964fa9f-0449-5b57-a5c2-d3ea65f4040f" | ||
| Latexify = "23fbe1c1-3f47-55db-b15f-69d7ec21a316" | ||
| Markdown = "d6f4376e-aef5-505a-96c1-9c027394607a" | ||
| Unitful = "1986cc42-f94f-5a68-af5c-568840ba703d" | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Valid. Rookie mistake on my part, I wasn't sure how to do this in a more robust way--thanks for pointing to an example. |
||
| tectonic_jll = "d7dd28d6-a5e6-559c-9131-7eb760cdacc5" | ||
|
|
||
| [compat] | ||
| Documenter = "1" | ||
| Latexify = "0.16" | ||
| Latexify = "0.16.9" | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,147 @@ | ||
| using LaTeXStrings, Unitful, Latexify, tectonic_jll | ||
|
|
||
| commands = [ | ||
| :(latexify(612.2u"nm")), | ||
| :(latexify(u"kg*m/s^2")), | ||
| :(latexify(612.2u"nm"; fmt=SiunitxNumberFormatter())), | ||
| :(latexify(u"kg*m/s^2"; fmt=SiunitxNumberFormatter())), | ||
| :(latexify(612.2u"nm"; fmt=SiunitxNumberFormatter(; simple=true))), | ||
| :(latexify(u"kg*m/s^2"; fmt=SiunitxNumberFormatter(; simple=true))), | ||
| :(latexify((1, 2, 4) .* u"m"; fmt=SiunitxNumberFormatter())), | ||
| ] | ||
| tab1 = map(commands) do command | ||
| LaTeXString.([ | ||
| "\\verb+$(string(command))+", | ||
| "\\verb+$(eval(command))+", | ||
| "$(eval(command)) ", | ||
| ]) | ||
| end | ||
| ltab1 = latextabular(tab1, adjustment=:l, transpose=true, latex=false, booktabs=true, | ||
| head=["julia", "\\LaTeX", "Result"]) | ||
| # Setting an explicit white background color results in transparent PDF, so go offwhite. | ||
| ltab1 = LaTeXString("\\definecolor{offwhite}{rgb}{0.999,0.999,0.999}\n\\pagecolor{offwhite}\n\\color{black}\n" * ltab1) | ||
|
|
||
| render(ltab1, MIME("image/png"); use_tectonic=true, | ||
| name=(@__DIR__)*"/src/assets/latex-examples", | ||
| packages=["booktabs", "color", "siunitx"], | ||
| documentclass=("standalone")) | ||
|
|
||
| functions = [ | ||
| x -> "\\verb+$(string(x))+", | ||
| x -> latexify(x), | ||
| x -> latexify(x; fmt=SiunitxNumberFormatter()), | ||
| x -> latexify(x; fmt=SiunitxNumberFormatter(; simple=true)), | ||
| ] | ||
| allunits = begin | ||
| uparse.([ | ||
| "nH*m/Hz", | ||
| "m", | ||
| "s", | ||
| "A", | ||
| "K", | ||
| "cd", | ||
| "g", | ||
| "mol", | ||
| "sr", | ||
| "rad", | ||
| "°", | ||
| "Hz", | ||
| "N", | ||
| "Pa", | ||
| "J", | ||
| "W", | ||
| "C", | ||
| "V", | ||
| "S", | ||
| "F", | ||
| "H", | ||
| "T", | ||
| "Wb", | ||
| "lm", | ||
| "lx", | ||
| "Bq", | ||
| "Gy", | ||
| "Sv", | ||
| "kat", | ||
| #"percent", # Messes with comments | ||
| # "permille", # Undefined in all formats | ||
| # "pertenthousand", # Undefined in all formats (butchered) | ||
| "°C", | ||
| "°F", # No longer in siunitx | ||
| "minute", | ||
| "hr", | ||
| "d", | ||
| "wk", # Undefined in siunitx | ||
| "yr", # Undefined in siunitx | ||
| "rps", # Undefined in siunitx | ||
| "rpm", # Undefined in siunitx | ||
| "a", # Undefined in siunitx | ||
| "b", | ||
| "L", | ||
| "M", # Undefined in siunitx | ||
| "eV", | ||
| "Hz2π", # Butchered by encoding | ||
| "bar", | ||
| "atm", # Undefined in siunitx | ||
| "Torr", # Undefined in siunitx | ||
| "c", # Undefined in siunitx | ||
| "u", # Undefined in siunitx | ||
| "ge", # Undefined in siunitx | ||
| "Gal", # Undefined in siunitx | ||
| "dyn", # Undefined in siunitx | ||
| "erg", # Undefined in siunitx | ||
| "Ba", # Undefined in siunitx | ||
| "P", # Undefined in siunitx | ||
| "St", # Undefined in siunitx | ||
| #"Gauss", # errors in testing, maybe from Unitful.jl's dev branch? | ||
| #"Oe", # errors in testing, maybe from Unitful.jl's dev branch? | ||
| #"Mx", # errors in testing, maybe from Unitful.jl's dev branch? | ||
| "inch", # Undefined in siunitx | ||
| "mil", # Undefined in siunitx | ||
| "ft", # Undefined in siunitx | ||
| "yd", # Undefined in siunitx | ||
| "mi", # Undefined in siunitx | ||
| "angstrom", # Undefined in mathrm,siunitxsimple | ||
| "ac", # Undefined in siunitx | ||
| "Ra", # Undefined in siunitx | ||
| "lb", # Undefined in siunitx | ||
| "oz", # Undefined in siunitx | ||
| "slug", # Undefined in siunitx | ||
| "dr", # Undefined in siunitx | ||
| "gr", # Undefined in siunitx | ||
| "lbf", # Undefined in siunitx | ||
| "cal", # Undefined in siunitx | ||
| "btu", # Undefined in siunitx | ||
| "psi", # Undefined in siunitx | ||
| #"dBHz", # Cannot *yet* be latexified. | ||
| #"dBm", # Cannot *yet* be latexified. | ||
| #"dBV", # Cannot *yet* be latexified. | ||
| #"dBu", # Cannot *yet* be latexified. | ||
| #"dBμV", # Cannot *yet* be latexified. | ||
| #"dBSPL", # Cannot *yet* be latexified. | ||
| #"dBFS", # Cannot *yet* be latexified. | ||
| #"dBΩ", # Cannot *yet* be latexified. | ||
| #"dBS", # Cannot *yet* be latexified. | ||
| ]) | ||
| end | ||
|
|
||
| tab2 = map(allunits) do unit | ||
| [LaTeXString(f(unit)) for f in functions] | ||
| end | ||
| ltab2 = latextabular(tab2, adjustment=:l, transpose=true, latex=false, booktabs=true, | ||
| head=["Name", "Default number formatter", "\\verb+SiunitxNumberFormatter()+", "\\verb+SiunitxNumberFormatter(;simple=true)+"]) | ||
| # Set background to not-quite-white so it doesn't get treated as transparent | ||
| ltab2 = LaTeXString( | ||
| """ | ||
| \\setmainfont{FreeSerif} | ||
| \\setmonofont{FreeMono} | ||
| \\definecolor{offwhite}{rgb}{0.999,0.999,0.999} | ||
| \\pagecolor{offwhite} | ||
| \\color{black} | ||
| """ * ltab2) | ||
|
|
||
| render(ltab2, MIME("image/png"); use_tectonic=true, | ||
| tectonic_flags=`-Z continue-on-errors`, | ||
| name=(@__DIR__)*"/src/assets/latex-allunits", | ||
| packages=["booktabs", "color", "siunitx", "fontspec"], | ||
| documentclass=("standalone")) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.