diff --git a/.github/workflows/documentation.yaml b/.github/workflows/documentation.yaml index a6e7a266..4008b78b 100644 --- a/.github/workflows/documentation.yaml +++ b/.github/workflows/documentation.yaml @@ -36,3 +36,8 @@ jobs: - uses: julia-actions/julia-docdeploy@v1 env: DOCUMENTER_KEY: ${{ secrets.DOCUMENTER_KEY }} + - uses: actions/upload-artifact@v4 + with: + name: documentation-build + path: docs/build + retention-days: 90 diff --git a/docs/Project.toml b/docs/Project.toml index 4e9dd302..b624607f 100644 --- a/docs/Project.toml +++ b/docs/Project.toml @@ -9,6 +9,10 @@ Plots = "91a5bcdd-55d7-5caf-9e0b-520d859cae80" Unitful = "1986cc42-f94f-5a68-af5c-568840ba703d" tectonic_jll = "d7dd28d6-a5e6-559c-9131-7eb760cdacc5" +[sources] +Unitful = {path = ".."} + [compat] Documenter = "1" Latexify = "0.16.9" +Plots = "1" diff --git a/docs/make.jl b/docs/make.jl index 72827103..d33e94c8 100644 --- a/docs/make.jl +++ b/docs/make.jl @@ -25,7 +25,7 @@ makedocs( "Latexifying units" => "latexify.md" "Extending Unitful" => "extending.md" "Troubleshooting" => "trouble.md" - "Pre-defined units and constants" => "defaultunits.md" + "Pre-defined dimensions, units, and constants" => "defaultunits.md" "License" => "LICENSE.md" ] ) diff --git a/docs/src/defaultunits.md b/docs/src/defaultunits.md index 3ad35d7d..1316cc16 100644 --- a/docs/src/defaultunits.md +++ b/docs/src/defaultunits.md @@ -20,740 +20,280 @@ For prefixes, see [below](#Metric-(SI)-Prefixes). ### Amount -#### Mole - -``` +```@docs +Unitful.𝐍 +Unitful.Amount Unitful.mol ``` -The mole, the SI base unit for amount of substance. - ### Current -#### Ampere - -``` +```@docs +Unitful.𝐈 +Unitful.Current Unitful.A ``` -The ampere, the SI base unit of electric current. - ### Length -#### Angstrom - -``` +```@docs +Unitful.𝐋 +Unitful.Length Unitful.angstrom -Unitful.Å -``` - -The angstrom, a metric unit of length defined as 1/10 nm. - -#### Foot - -``` +Unitful.cm +Unitful.fm Unitful.ft -``` - -The foot, a US customary unit of length defined as 12 inch. - -#### Inch - -``` Unitful.inch -``` - -The inch, a US customary unit of length defined as 2.54 cm. - -#### Meter - -``` Unitful.m -``` - -The meter, the SI base unit of length. - -#### Mile - -``` Unitful.mi -``` - -The mile, a US customary unit of length defined as 1760 yd. - -#### Mil - -``` Unitful.mil -``` - -The mil, a US customary unit of length defined as 1/1000 inch. - -#### Yard - -``` +Unitful.nm Unitful.yd ``` -The yard, a US customary unit of length defined as 3 ft. - ### Luminosity -#### Candela - -``` +```@docs +Unitful.𝐉 +Unitful.Luminosity Unitful.cd +Unitful.lm ``` -The candela, the SI base unit of luminous intensity. - ### Mass -#### Dram - -``` +```@docs +Unitful.𝐌 +Unitful.Mass Unitful.dr -``` - -The dram, a US customary unit of mass defined as 1/16 oz. - -#### Gram - -``` Unitful.g -``` - -A prefixed unit, equal to 10^-3 kg. Note that `kg`, not `g`, is the base unit. - -#### Grain - -``` Unitful.gr -``` - -The grain, a US customary unit of mass defined as 1/7000 lb. - -#### Kilogram - -``` Unitful.kg -``` - -The kilogram, the SI base unit of mass. Note that `kg`, not `g`, is the base unit. - -#### Pound - -``` Unitful.lb -``` - -The pound-mass, a US customary unit of mass defined as exactly 0.453,592,37 kg. - -#### Ounce - -``` Unitful.oz -``` - -The ounce, a US customary unit of mass defined as 1/16 lb. - -#### Slug - -``` Unitful.slug -``` - -The slug, a US customary unit of mass defined as 1 lbf × s^2 / ft. - -#### UnifiedAtomicMassUnit - -``` Unitful.u ``` -The unified atomic mass unit, or dalton, a unit of mass defined as 1/12 the mass of an unbound neutral atom of carbon-12, equal to 1.660,539,066,60 × 10^-27 kg (the CODATA 2018 recommended value). - ### Temperature -#### Kelvin - -``` +```@docs +Unitful.𝚯 +Unitful.Temperature Unitful.K -``` - -The kelvin, the SI base unit of thermodynamic temperature. - -#### Rankine - -``` Unitful.Ra -``` - -The rankine, a US customary unit of temperature defined as 5/9 K. - -#### Degree Celcius - -``` Unitful.°C -``` - -The degree Celsius, an SI unit of temperature, defined such that 0 °C = 273.15 K. - -#### Degree Fahrenheit - -``` Unitful.°F ``` -The degree Fahrenheit, a US customary unit of temperature, defined such that 0 °F = 459.67 Ra. - ### Time -#### Day - -``` +```@docs +Unitful.𝐓 +Unitful.Time Unitful.d -``` - -The day, a unit of time defined as 24 hr. - -#### Hour - -``` Unitful.hr -``` - -The hour, a unit of time defined as 60 minutes. - -#### Minute - -``` Unitful.minute -``` - -The minute, a unit of time defined as 60 s. The full name `minute` is used instead of the symbol `min` to avoid confusion with the Julia function `min`. - -#### Second - -``` Unitful.s -``` - -The second, the SI base unit of time. - -#### Week - -``` Unitful.wk -``` - -The week, a unit of time, defined as 7 d. - -#### Year - -``` Unitful.yr ``` -The year, a unit of time, defined as 365.25 d. - ## Derived dimensions ### Acceleration -#### Gal - -``` +```@docs +Unitful.Acceleration Unitful.Gal -``` - -The gal, a CGS unit of acceleration, defined as 1 cm / s^2. - -#### EarthGravity - -``` Unitful.ge ``` -The nominal acceleration due to gravity in a vacuum near the surface of the earth, a unit of acceleration, defined by standard to be exactly 9.806,65 m / s^2. - -`Unitful.gn` is a quantity (with units `m/s^2`) whereas `Unitful.ge` is a unit equal to `gn`. - ### Area -#### Are - -``` +```@docs +Unitful.Area Unitful.a -``` - -The are, a metric unit of area, defined as 100 m^2. - -#### Acre - -``` Unitful.ac -``` - -The acre, a US customary unit of area defined as 4840 yd^2. - -#### Barn - -``` Unitful.b -``` - -The barn, a metric unit of area, defined as 100 fm^2. - -#### Hectare - -``` Unitful.ha ``` -The hectare, a metric unit of area, defined as 100 a. - ### BField -#### Gauss - -``` +```@docs +Unitful.BField Unitful.Gauss -``` - -The gauss, a CGS unit of magnetic B-field strength, defined as 1 Mx / cm^2. - -#### Tesla - -``` Unitful.T ``` -The tesla, an SI unit of magnetic B-field strength, defined as 1 kg / (A × s^2). - ### Capacitance -#### Farad - -``` +```@docs +Unitful.Capacitance Unitful.F ``` -The farad, an SI unit of electrical capacitance, defined as 1 s^4 × A^2 / (kg × m^2). - ### Charge -#### Coulomb - -``` +```@docs +Unitful.Charge Unitful.C ``` -The coulomb, an SI unit of electric charge, defined as 1 A × s. - ### DynamicViscosity -#### Poise - -``` +```@docs +Unitful.DynamicViscosity Unitful.P ``` -The poise, a CGS unit of dynamic viscosity, defined as 1 dyn × s / cm^2. - ### ElectricalConductance -#### Siemens - -``` +```@docs +Unitful.ElectricalConductance Unitful.S ``` -The siemens, an SI unit of electrical conductance, defined as 1 Ω^-1. - ### ElectricalResistance -#### Ohm - -``` +```@docs +Unitful.ElectricalResistance Unitful.Ω ``` -The ohm, an SI unit of electrical resistance, defined as 1 V / A. - ### Energy -#### BritishThermalUnit - -``` +```@docs +Unitful.Energy Unitful.btu -``` - -The British thermal unit, a US customary unit of heat defined by ISO 31-4 as exactly 1055.06 J. - -#### Calorie - -``` Unitful.cal -``` - -The calorie, a unit of energy defined as exactly 4.184 J. - -#### Erg - -``` Unitful.erg -``` - -The erg, a CGS unit of energy, defined as 1 dyn × cm. - -#### eV - -``` Unitful.eV -``` - -The electron-volt, a unit of energy, defined as q*V. - -#### Joule - -``` Unitful.J ``` -The joule, an SI unit of energy, defined as 1 N × m. - ### Force -#### Dyne - -``` +```@docs +Unitful.Force Unitful.dyn -``` - -The dyne, a CGS unit of force, defined as 1 g × cm / s^2. - -#### PoundsForce - -``` Unitful.lbf -``` - -The pound-force, a US customary unit of force defined as 1 lb × ge. - -#### Newton - -``` Unitful.N ``` -The newton, an SI unit of force, defined as 1 kg × m / s^2. - ### Frequency -#### Becquerel - -``` +```@docs +Unitful.Frequency Unitful.Bq -``` - -The becquerel, an SI unit of radioactivity, defined as 1 nuclear decay per s. - -#### Hertz - -``` Unitful.Hz -``` - -The hertz, an SI unit of frequency, defined as 1 s^-1. - -#### AngHertz - -``` Unitful.Hz2π -``` - -A unit for convenience in angular frequency, equal to 2π Hz. - -#### RevolutionsPerMinute - -``` Unitful.rpm -``` - -Revolutions per minute, a unit of rotational speed, defined as 2π rad / minute. - -#### RevolutionsPerSecond - -``` Unitful.rps ``` -Revolutions per second, a unit of rotational speed, defined as 2π rad / s. - ### HField -#### Oersted - -``` +```@docs +Unitful.HField Unitful.Oe ``` -The oersted, a CGS unit of magnetic H-field strength, defined as 1000 A / (4π × m). - ### Inductance -#### Henry - -``` +```@docs +Unitful.Inductance Unitful.H ``` -The henry, an SI unit of electrical inductance, defined as 1 J / A^2. - ### KinematicViscosity -#### Stokes - -``` +```@docs +Unitful.KinematicViscosity Unitful.St ``` -The stokes, a CGS unit of kinematic viscosity, defined as 1 cm^2 / s. - -### Luminous flux - -#### Lumen - -``` -Unitful.lm -``` - -The lumen, an SI unit of luminous flux, defined as 1 cd × sr. - ### MagneticFlux -#### Maxwell - -``` +```@docs +Unitful.MagneticFlux Unitful.Mx -``` - -The maxwell, a CGS unit of magnetic flux, defined as 1 Gauss × cm^2. - -#### Weber - -``` Unitful.Wb ``` -The weber, an SI unit of magnetic flux, defined as 1 kg × m^2 / (A × s^2). - ### MolarFlow -#### Katal - -``` +```@docs +Unitful.MolarFlow Unitful.kat ``` -The katal, an SI unit of catalytic activity, defined as 1 mol of catalyzed substrate per s. - ### Molarity -#### Molar - -``` +```@docs +Unitful.Molarity Unitful.M ``` -A unit for measuring molar concentration, equal to 1 mol/L. - ### Power -#### Watt - -``` +```@docs +Unitful.Power Unitful.W ``` -The watt, an SI unit of power, defined as 1 J / s. - ### Pressure -#### Atmosphere - -``` +```@docs +Unitful.Pressure Unitful.atm -``` - -The standard atmosphere, a unit of pressure, defined as 101,325 Pa. - -#### Barye - -``` Unitful.Ba -``` - -The barye, a CGS unit of pressure, defined as 1 dyn / cm^2. - -#### Bar - -``` Unitful.bar -``` - -The bar, a metric unit of pressure, defined as 100 kPa. - -#### Pascal - -``` +Unitful.kPa Unitful.Pa -``` - -The pascal, an SI unit of pressure, defined as 1 N / m^2. - -#### PoundsPerSquareInch - -``` Unitful.psi -``` - -Pounds per square inch, a US customary unit of pressure defined as 1 lbf / inch^2. - -#### Torr - -``` Unitful.Torr ``` -The torr, a unit of pressure, defined as 1/760 atm. - ### Velocity -#### SpeedOfLight - -``` +```@docs +Unitful.Velocity Unitful.c ``` -The speed of light in a vacuum, a unit of speed, defined as exactly 2.997,924,58 × 10^8 m/s. - -`Unitful.c0` is a quantity (with units `m/s`) whereas `Unitful.c` is a unit equal to `c0`. - ### Voltage -#### Volt - -``` +```@docs +Unitful.Voltage Unitful.V ``` -The volt, an SI unit of electric potential, defined as 1 W / A. - ### Volume -#### Liter - -``` +```@docs +Unitful.Volume Unitful.L -Unitful.l ``` -The liter, a metric unit of volume, defined as 1000 cm^3. - ## Dimensionless units -#### Percentmille - -``` +```@docs +Unitful.° Unitful.pcm -``` - -Percentmille, a unit meaning parts per hundred thousand. - -#### Percent - -``` Unitful.percent -``` - -Percent, a unit meaning parts per hundred. Printed as "%". - -#### Permille - -``` Unitful.permille -``` - -Permille, a unit meaning parts per thousand. Printed as "‰". - -#### Pertenthousand - -``` Unitful.pertenthousand -``` - -Permyriad, a unit meaning parts per ten thousand. Printed as "‱". - -#### Perbillion - -``` Unitful.ppb -``` - -Perbillion, a unit meaning parts per billion (in the short-scale sense), i.e., 10^-9. - -#### Permillion - -``` Unitful.ppm -``` - -Permillion, a unit meaning parts per million. - -#### Perquadrillion - -``` Unitful.ppq -``` - -Perquadrillion, a unit meaning parts per quadrillion (in the short-scale sense), i.e., 10^-15. - -#### Pertrillion - -``` Unitful.ppt -``` - -Pertrillion, a unit meaning parts per trillion (in the short-scale sense), i.e., 10^-12. - -#### Radian - -``` Unitful.rad -``` - -The radian, a unit of angle. There are 2π rad in a circle. - -#### Steradian - -``` Unitful.sr ``` -The steradian, a unit of spherical angle. There are 4π sr in a sphere. - -#### Degree - -``` -Unitful.° -Unitful.deg -``` - -The degree, a unit of angle. There are 360° in a circle. - -## Logarithmic units +## Logarithmic units | Unit | Name | |----------------|---------------------------------| @@ -774,165 +314,31 @@ The degree, a unit of angle. There are 360° in a circle. | `dBFS` | RootPowerRatio(1) | | `dBΩ` | 1Ω | | `dBS` | 1S | -## Physical constants - -#### G - -``` -Unitful.G -``` -A quantity representing the universal gravitational constant, equal to 6.674,30 × 10^-11 m^3 / (kg × s^2) (the CODATA 2018 recommended value). - -#### Na - -``` -Unitful.Na -``` - -A quantity representing Avogadro's constant, defined as exactly 6.022,140,76 × 10^23 / mol. - -#### R - -``` -Unitful.R -``` - -A quantity representing the molar gas constant, defined as Na × k. - -#### R∞ - -``` -Unitful.R∞ -``` - -A quantity representing the Rydberg constant, equal to 1.097,373,156,8160 × 10^-7 / m (the CODATA 2018 recommended value). - -#### Z0 - -``` -Unitful.Z0 -``` - -A quantity representing the impedance of free space, a constant defined as μ0 × c. - -#### c0 +## Physical constants -``` +```@docs Unitful.c0 -``` - -A quantity representing the speed of light in a vacuum, defined as exactly 2.997,924,58 × 10^8 m/s. - -`Unitful.c0` is a quantity (with units `m/s`) whereas `Unitful.c` is a unit equal to `c0`. - -#### gn - -``` +Unitful.G Unitful.gn -``` - -A quantity representing the nominal acceleration due to gravity in a vacuum near the surface of the earth, defined by standard to be exactly 9.806,65 m / s^2. - -`Unitful.gn` is a quantity (with units `m/s^2`) whereas `Unitful.ge` is a unit equal to `gn`. - -#### h - -``` Unitful.h -``` - -A quantity representing Planck's constant, defined as exactly 6.626,070,15 × 10^-34 J × s. - -#### k - -``` Unitful.k -``` - -A quantity representing the Boltzmann constant, defined as exactly 1.380,649 × 10^-23 J / K. - -#### me - -``` Unitful.me -``` - -A quantity representing the rest mass of an electron, equal to 9.109,383,7015 × 10^-31 kg (the CODATA 2018 recommended value). - -#### mn - -``` Unitful.mn -``` - -A quantity representing the rest mass of a neutron, equal to 1.674,927,498,04 × 10^-27 kg (the CODATA 2018 recommended value). - -#### mp - -``` Unitful.mp -``` - -A quantity representing the rest mass of a proton, equal to 1.672,621,923,69 × 10^-27 kg (the CODATA 2018 recommended value). - -#### q - -``` +Unitful.Na Unitful.q -``` - -A quantity equal to the elementary charge, the charge of a single electron, with a value of exactly 1.602,176,634 × 10^-19 C. The letter `q` is used instead of `e` to avoid confusion with Euler's number. - -#### ħ - -``` +Unitful.R +Unitful.R∞ +Unitful.Z0 Unitful.ħ -``` - -A quantity representing the reduced Planck constant, defined as h / 2π. - -#### Φ0 - -``` -Unitful.Φ0 -``` - -A quantity representing the superconducting magnetic flux quantum, defined as h / (2 × q). - -#### ε0, ϵ0 - -``` Unitful.ε0 -Unitful.ϵ0 -``` - -A quantity representing the vacuum permittivity constant, defined as 1 / (μ0 × c^2). - -#### μ0 - -``` Unitful.μ0 -``` - -A quantity representing the vacuum permeability constant, defined as 4π × 10^-7 H / m. - -#### μB - -``` Unitful.μB -``` - -A quantity representing the Bohr magneton, equal to q × ħ / (2 × me). - -#### σ - -``` Unitful.σ +Unitful.Φ0 ``` -A quantity representing the Stefan-Boltzmann constant, defined as π^2 × k^4 / (60 × ħ^3 × c^2). - ## Metric (SI) Prefixes | Prefix | Name | Power of Ten | diff --git a/docs/src/types.md b/docs/src/types.md index 2142a7f3..ce0e8819 100644 --- a/docs/src/types.md +++ b/docs/src/types.md @@ -37,6 +37,7 @@ some subset of `Unitful.Quantity` subtypes. ## API ### Quantities + ```@docs Unitful.AbstractQuantity Unitful.Quantity @@ -44,6 +45,7 @@ some subset of `Unitful.Quantity` subtypes. ``` ### Units and dimensions + ```@docs Unitful.Unitlike Unitful.Units @@ -53,4 +55,5 @@ some subset of `Unitful.Quantity` subtypes. Unitful.Dimensions Unitful.Unit Unitful.Dimension + Unitful.NoDims ```