-
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
Changes from all commits
aad1161
8a9704e
87e95ea
d13a51e
329190d
fe8f81a
33d778c
dc8b71c
6d461a7
e8ea39c
cf8b7db
5458be2
dc754da
210cbee
0b7b03d
887800f
8944f77
35316ac
d5ad57c
a654560
da11483
c4939c9
4288e15
e80cbbb
443daf0
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -2,9 +2,13 @@ | |
| 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" | ||
| Plots = "91a5bcdd-55d7-5caf-9e0b-520d859cae80" | ||
|
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. Also, it'd be always good to have compat bounds at least for non-stdlibs non-jll packages. |
||
| 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" | ||
| 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")) |
Uh oh!
There was an error while loading. Please reload this page.