From 031b4a33674a2492b944af5cb633f3853d234605 Mon Sep 17 00:00:00 2001 From: Ben Elkin <8xe8n-cm@online.de> Date: Tue, 24 Jun 2025 22:42:27 +0200 Subject: [PATCH 1/7] add dimensions docs to default units docs chapter --- docs/make.jl | 2 +- docs/src/defaultunits.md | 277 +++++++++++++++++++++++++++++++-------- 2 files changed, 226 insertions(+), 53 deletions(-) diff --git a/docs/make.jl b/docs/make.jl index f9695384d..ad1aa9e5b 100644 --- a/docs/make.jl +++ b/docs/make.jl @@ -21,7 +21,7 @@ makedocs( "Interoperability with `Dates`" => "dates.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 6ce91e3f7..69a6575c0 100644 --- a/docs/src/defaultunits.md +++ b/docs/src/defaultunits.md @@ -20,6 +20,12 @@ For prefixes, see [below](#Metric-(SI)-Prefixes). ### Amount +``` +Unitful.Amount +``` + +Supertype for quantities and levels of dimension `Unitful.𝐍` + #### Mole ``` @@ -30,6 +36,12 @@ The mole, the SI base unit for amount of substance. ### Current +``` +Unitful.Current +``` + +Supertype for quantities and levels of dimension `Unitful.𝐈` + #### Ampere ``` @@ -40,6 +52,12 @@ The ampere, the SI base unit of electric current. ### Length +``` +Unitful.Length +``` + +Supertype for quantities and levels of dimension `Unitful.𝐋` + #### Angstrom ``` @@ -99,6 +117,12 @@ The yard, a US customary unit of length defined as 3 ft. ### Luminosity +``` +Unitful.Luminosity +``` + +Supertype for quantities and levels of dimension `Unitful.𝐉` + #### Candela ``` @@ -107,8 +131,22 @@ Unitful.cd The candela, the SI base unit of luminous intensity. +#### Lumen + +``` +Unitful.lm +``` + +The lumen, an SI unit of luminous flux, defined as 1 cd × sr. + ### Mass +``` +Unitful.Mass +``` + +Supertype for quantities and levels of dimension `Unitful.𝐌` + #### Dram ``` @@ -175,6 +213,12 @@ The unified atomic mass unit, or dalton, a unit of mass defined as 1/12 the mass ### Temperature +``` +Unitful.Temperature +``` + +Supertype for quantities and levels of dimension `Unitful.𝚯` + #### Kelvin ``` @@ -209,6 +253,12 @@ The degree Fahrenheit, a US customary unit of temperature, defined such that 0 ### Time +``` +Unitful.Time +``` + +Supertype for quantities and levels of dimension `Unitful.𝐓` + #### Day ``` @@ -261,6 +311,12 @@ The year, a unit of time, defined as 365.25 d. ### Acceleration +``` +Unitful.Acceleration +``` + +Supertype for quantities and levels of dimension `𝐋 / 𝐓 ^ 2` + #### Gal ``` @@ -281,6 +337,12 @@ The nominal acceleration due to gravity in a vacuum near the surface of the eart ### Area +``` +Unitful.Area +``` + +Supertype for quantities and levels of dimension `𝐋 ^ 2` + #### Are ``` @@ -315,6 +377,12 @@ The hectare, a metric unit of area, defined as 100 a. ### BField +``` +Unitful.BField +``` + +Supertype for quantities and levels of dimension `𝐈 ^ -1 * 𝐌 * 𝐓 ^ -2` + #### Gauss ``` @@ -333,6 +401,12 @@ The tesla, an SI unit of magnetic B-field strength, defined as 1 kg / (A × s^2) ### Capacitance +``` +Unitful.Capacitance +``` + +Supertype for quantities and levels of dimension `𝐈 ^ 2 * 𝐋 ^ -2 * 𝐌 ^ -1 * 𝐓 ^ 4` + #### Farad ``` @@ -343,6 +417,12 @@ The farad, an SI unit of electrical capacitance, defined as 1 s^4 × A^2 / (kg ### Charge +``` +Unitful.Charge +``` + +Supertype for quantities and levels of dimension `𝐈 * 𝐓` + #### Coulomb ``` @@ -353,6 +433,12 @@ The coulomb, an SI unit of electric charge, defined as 1 A × s. ### DynamicViscosity +``` +Unitful.DynamicViscosity +``` + +Supertype for quantities and levels of dimension `𝐌 * 𝐋 ^ -1 * 𝐓 ^ -1` + #### Poise ``` @@ -363,6 +449,12 @@ The poise, a CGS unit of dynamic viscosity, defined as 1 dyn × s / cm^2. ### ElectricalConductance +``` +Unitful.ElectricalConductance +``` + +Supertype for quantities and levels of dimension `𝐈 ^ 2 * 𝐋 ^ -2 * 𝐌 ^ -1 * 𝐓 ^ 3` + #### Siemens ``` @@ -373,6 +465,12 @@ The siemens, an SI unit of electrical conductance, defined as 1 Ω^-1. ### ElectricalResistance +``` +Unitful.ElectricalResistance +``` + +Supertype for quantities and levels of dimension `𝐈 ^ -2 * 𝐋 ^ 2 * 𝐌 * 𝐓 ^ -3` + #### Ohm ``` @@ -383,6 +481,12 @@ The ohm, an SI unit of electrical resistance, defined as 1 V / A. ### Energy +``` +Unitful.Energy +``` + +Supertype for quantities and levels of dimension `(𝐌 * 𝐋 ^ 2) / 𝐓 ^ 2` + #### BritishThermalUnit ``` @@ -425,6 +529,12 @@ The joule, an SI unit of energy, defined as 1 N × m. ### Force +``` +Unitful.Force +``` + +Supertype for quantities and levels of dimension `(𝐌 * 𝐋) / 𝐓 ^ 2` + #### Dyne ``` @@ -451,6 +561,12 @@ The newton, an SI unit of force, defined as 1 kg × m / s^2. ### Frequency +``` +Unitful.Frequency +``` + +Supertype for quantities and levels of dimension `inv(𝐓)` + #### Becquerel ``` @@ -493,6 +609,12 @@ Revolutions per second, a unit of rotational speed, defined as 2π rad / s. ### HField +``` +Unitful.HField +``` + +Supertype for quantities and levels of dimension `𝐈 / 𝐋` + #### Oersted ``` @@ -503,6 +625,12 @@ The oersted, a CGS unit of magnetic H-field strength, defined as 1000 A / (4π ### Inductance +``` +Unitful.Inductance +``` + +Supertype for quantities and levels of dimension `𝐈 ^ -2 * 𝐋 ^ 2 * 𝐌 * 𝐓 ^ -2` + #### Henry ``` @@ -513,6 +641,12 @@ The henry, an SI unit of electrical inductance, defined as 1 J / A^2. ### KinematicViscosity +``` +Unitful.KinematicViscosity +``` + +Supertype for quantities and levels of dimension `𝐋 ^ 2 * 𝐓 ^ -1` + #### Stokes ``` @@ -521,17 +655,13 @@ Unitful.St The stokes, a CGS unit of kinematic viscosity, defined as 1 cm^2 / s. -### Luminous flux - -#### Lumen +### MagneticFlux ``` -Unitful.lm +Unitful.MagneticFlux ``` -The lumen, an SI unit of luminous flux, defined as 1 cd × sr. - -### MagneticFlux +Supertype for quantities and levels of dimension `𝐈 ^ -1 * 𝐋 ^ 2 * 𝐌 * 𝐓 ^ -2` #### Maxwell @@ -551,6 +681,12 @@ The weber, an SI unit of magnetic flux, defined as 1 kg × m^2 / (A × s^2). ### MolarFlow +``` +Unitful.MolarFlow +``` + +Supertype for quantities and levels of dimension `𝐍 / 𝐓` + #### Katal ``` @@ -561,6 +697,12 @@ The katal, an SI unit of catalytic activity, defined as 1 mol of catalyzed subst ### Molarity +``` +Unitful.Molarity +``` + +Supertype for quantities and levels of dimension `𝐍 / 𝐋 ^ 3` + #### Molar ``` @@ -571,6 +713,12 @@ A unit for measuring molar concentration, equal to 1 mol/L. ### Power +``` +Unitful.Power +``` + +Supertype for quantities and levels of dimension `𝐋 ^ 2 * 𝐌 * 𝐓 ^ -3` + #### Watt ``` @@ -581,6 +729,12 @@ The watt, an SI unit of power, defined as 1 J / s. ### Pressure +``` +Unitful.Pressure +``` + +Supertype for quantities and levels of dimension `𝐌 * 𝐋 ^ -1 * 𝐓 ^ -2` + #### Atmosphere ``` @@ -631,6 +785,12 @@ The torr, a unit of pressure, defined as 1/760 atm. ### Velocity +``` +Unitful.Velocity +``` + +Supertype for quantities and levels of dimension `𝐋 / 𝐓` + #### SpeedOfLight ``` @@ -643,6 +803,12 @@ The speed of light in a vacuum, a unit of speed, defined as exactly 2.997,924,58 ### Voltage +``` +Unitful.Voltage +``` + +Supertype for quantities and levels of dimension `𝐈 ^ -1 * 𝐋 ^ 2 * 𝐌 * 𝐓 ^ -3` + #### Volt ``` @@ -653,6 +819,12 @@ The volt, an SI unit of electric potential, defined as 1 W / A. ### Volume +``` +Unitful.Volume +``` + +Supertype for quantities and levels of dimension `𝐋 ^ 3` + #### Liter ``` @@ -773,57 +945,26 @@ 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. +## Physical constants -#### R∞ +#### c0 ``` -Unitful.R∞ +Unitful.c0 ``` -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 speed of light in a vacuum, defined as exactly 2.997,924,58 × 10^8 m/s. -A quantity representing the impedance of free space, a constant defined as μ0 × c. +`Unitful.c0` is a quantity (with units `m/s`) whereas `Unitful.c` is a unit equal to `c0`. -#### c0 +#### G ``` -Unitful.c0 +Unitful.G ``` -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`. +A quantity representing the universal gravitational constant, equal to 6.674,30 × 10^-11 m^3 / (kg × s^2) (the CODATA 2018 recommended value). #### gn @@ -875,6 +1016,14 @@ 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). +#### Na + +``` +Unitful.Na +``` + +A quantity representing Avogadro's constant, defined as exactly 6.022,140,76 × 10^23 / mol. + #### q ``` @@ -883,21 +1032,37 @@ 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. -#### ħ +#### R ``` -Unitful.ħ +Unitful.R ``` -A quantity representing the reduced Planck constant, defined as h / 2π. +A quantity representing the molar gas constant, defined as Na × k. -#### Φ0 +#### R∞ ``` -Unitful.Φ0 +Unitful.R∞ ``` -A quantity representing the superconducting magnetic flux quantum, defined as h / (2 × q). +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. + +#### ħ + +``` +Unitful.ħ +``` + +A quantity representing the reduced Planck constant, defined as h / 2π. #### ε0, ϵ0 @@ -932,6 +1097,14 @@ Unitful.σ A quantity representing the Stefan-Boltzmann constant, defined as π^2 × k^4 / (60 × ħ^3 × c^2). +#### Φ0 + +``` +Unitful.Φ0 +``` + +A quantity representing the superconducting magnetic flux quantum, defined as h / (2 × q). + ## Metric (SI) Prefixes | Prefix | Name | Power of Ten | From 49f033af280175c26875815de677a801ad56dec0 Mon Sep 17 00:00:00 2001 From: Ben Elkin <8xe8n-cm@online.de> Date: Mon, 1 Sep 2025 20:26:12 +0200 Subject: [PATCH 2/7] replace actual docstring text by @docs --- docs/src/defaultunits.md | 219 +++++++++++++-------------------------- 1 file changed, 74 insertions(+), 145 deletions(-) diff --git a/docs/src/defaultunits.md b/docs/src/defaultunits.md index abe5fd38d..850327258 100644 --- a/docs/src/defaultunits.md +++ b/docs/src/defaultunits.md @@ -20,12 +20,10 @@ For prefixes, see [below](#Metric-(SI)-Prefixes). ### Amount +```@docs +Unitful.Amount +Unitful.𝐍 ``` -Unitful.Amount -``` - -Supertype for quantities and levels of dimension `Unitful.𝐍` - #### Mole ``` @@ -36,12 +34,10 @@ The mole, the SI base unit for amount of substance. ### Current +```@docs +Unitful.Current +Unitful.𝐈 ``` -Unitful.Current -``` - -Supertype for quantities and levels of dimension `Unitful.𝐈` - #### Ampere ``` @@ -52,12 +48,10 @@ The ampere, the SI base unit of electric current. ### Length +```@docs +Unitful.Length +Unitful.𝐋 ``` -Unitful.Length -``` - -Supertype for quantities and levels of dimension `Unitful.𝐋` - #### Angstrom ``` @@ -117,12 +111,10 @@ The yard, a US customary unit of length defined as 3 ft. ### Luminosity +```@docs +Unitful.Luminosity +Unitful.𝐉 ``` -Unitful.Luminosity -``` - -Supertype for quantities and levels of dimension `Unitful.𝐉` - #### Candela ``` @@ -141,12 +133,10 @@ The lumen, an SI unit of luminous flux, defined as 1 cd × sr. ### Mass +```@docs +Unitful.Mass +Unitful.𝐌 ``` -Unitful.Mass -``` - -Supertype for quantities and levels of dimension `Unitful.𝐌` - #### Dram ``` @@ -213,12 +203,10 @@ The unified atomic mass unit, or dalton, a unit of mass defined as 1/12 the mass ### Temperature +```@docs +Unitful.Temperature +Unitful.𝚯 ``` -Unitful.Temperature -``` - -Supertype for quantities and levels of dimension `Unitful.𝚯` - #### Kelvin ``` @@ -253,12 +241,10 @@ The degree Fahrenheit, a US customary unit of temperature, defined such that 0 ### Time +```@docs +Unitful.Time +Unitful.𝐓 ``` -Unitful.Time -``` - -Supertype for quantities and levels of dimension `Unitful.𝐓` - #### Day ``` @@ -311,12 +297,9 @@ The year, a unit of time, defined as 365.25 d. ### Acceleration +```@docs +Unitful.Acceleration ``` -Unitful.Acceleration -``` - -Supertype for quantities and levels of dimension `𝐋 / 𝐓 ^ 2` - #### Gal ``` @@ -337,12 +320,9 @@ The nominal acceleration due to gravity in a vacuum near the surface of the eart ### Area +```@docs +Unitful.Area ``` -Unitful.Area -``` - -Supertype for quantities and levels of dimension `𝐋 ^ 2` - #### Are ``` @@ -377,12 +357,9 @@ The hectare, a metric unit of area, defined as 100 a. ### BField +```@docs +Unitful.BField ``` -Unitful.BField -``` - -Supertype for quantities and levels of dimension `𝐈 ^ -1 * 𝐌 * 𝐓 ^ -2` - #### Gauss ``` @@ -401,12 +378,9 @@ The tesla, an SI unit of magnetic B-field strength, defined as 1 kg / (A × s^2) ### Capacitance +```@docs +Unitful.Capacitance ``` -Unitful.Capacitance -``` - -Supertype for quantities and levels of dimension `𝐈 ^ 2 * 𝐋 ^ -2 * 𝐌 ^ -1 * 𝐓 ^ 4` - #### Farad ``` @@ -417,12 +391,9 @@ The farad, an SI unit of electrical capacitance, defined as 1 s^4 × A^2 / (kg ### Charge +```@docs +Unitful.Charge ``` -Unitful.Charge -``` - -Supertype for quantities and levels of dimension `𝐈 * 𝐓` - #### Coulomb ``` @@ -433,12 +404,9 @@ The coulomb, an SI unit of electric charge, defined as 1 A × s. ### DynamicViscosity +```@docs +Unitful.DynamicViscosity ``` -Unitful.DynamicViscosity -``` - -Supertype for quantities and levels of dimension `𝐌 * 𝐋 ^ -1 * 𝐓 ^ -1` - #### Poise ``` @@ -449,12 +417,9 @@ The poise, a CGS unit of dynamic viscosity, defined as 1 dyn × s / cm^2. ### ElectricalConductance +```@docs +Unitful.ElectricalConductance ``` -Unitful.ElectricalConductance -``` - -Supertype for quantities and levels of dimension `𝐈 ^ 2 * 𝐋 ^ -2 * 𝐌 ^ -1 * 𝐓 ^ 3` - #### Siemens ``` @@ -465,12 +430,9 @@ The siemens, an SI unit of electrical conductance, defined as 1 Ω^-1. ### ElectricalResistance +```@docs +Unitful.ElectricalResistance ``` -Unitful.ElectricalResistance -``` - -Supertype for quantities and levels of dimension `𝐈 ^ -2 * 𝐋 ^ 2 * 𝐌 * 𝐓 ^ -3` - #### Ohm ``` @@ -481,12 +443,9 @@ The ohm, an SI unit of electrical resistance, defined as 1 V / A. ### Energy +```@docs +Unitful.Energy ``` -Unitful.Energy -``` - -Supertype for quantities and levels of dimension `(𝐌 * 𝐋 ^ 2) / 𝐓 ^ 2` - #### BritishThermalUnit ``` @@ -529,12 +488,9 @@ The joule, an SI unit of energy, defined as 1 N × m. ### Force +```@docs +Unitful.Force ``` -Unitful.Force -``` - -Supertype for quantities and levels of dimension `(𝐌 * 𝐋) / 𝐓 ^ 2` - #### Dyne ``` @@ -561,12 +517,9 @@ The newton, an SI unit of force, defined as 1 kg × m / s^2. ### Frequency +```@docs +Unitful.Frequency ``` -Unitful.Frequency -``` - -Supertype for quantities and levels of dimension `inv(𝐓)` - #### Becquerel ``` @@ -609,12 +562,9 @@ Revolutions per second, a unit of rotational speed, defined as 2π rad / s. ### HField +```@docs +Unitful.HField ``` -Unitful.HField -``` - -Supertype for quantities and levels of dimension `𝐈 / 𝐋` - #### Oersted ``` @@ -625,12 +575,9 @@ The oersted, a CGS unit of magnetic H-field strength, defined as 1000 A / (4π ### Inductance +```@docs +Unitful.Inductance ``` -Unitful.Inductance -``` - -Supertype for quantities and levels of dimension `𝐈 ^ -2 * 𝐋 ^ 2 * 𝐌 * 𝐓 ^ -2` - #### Henry ``` @@ -641,12 +588,9 @@ The henry, an SI unit of electrical inductance, defined as 1 J / A^2. ### KinematicViscosity +```@docs +Unitful.KinematicViscosity ``` -Unitful.KinematicViscosity -``` - -Supertype for quantities and levels of dimension `𝐋 ^ 2 * 𝐓 ^ -1` - #### Stokes ``` @@ -657,12 +601,9 @@ The stokes, a CGS unit of kinematic viscosity, defined as 1 cm^2 / s. ### MagneticFlux +```@docs +Unitful.MagneticFlux ``` -Unitful.MagneticFlux -``` - -Supertype for quantities and levels of dimension `𝐈 ^ -1 * 𝐋 ^ 2 * 𝐌 * 𝐓 ^ -2` - #### Maxwell ``` @@ -681,12 +622,9 @@ The weber, an SI unit of magnetic flux, defined as 1 kg × m^2 / (A × s^2). ### MolarFlow +```@docs +Unitful.MolarFlow ``` -Unitful.MolarFlow -``` - -Supertype for quantities and levels of dimension `𝐍 / 𝐓` - #### Katal ``` @@ -697,12 +635,9 @@ The katal, an SI unit of catalytic activity, defined as 1 mol of catalyzed subst ### Molarity +```@docs +Unitful.Molarity ``` -Unitful.Molarity -``` - -Supertype for quantities and levels of dimension `𝐍 / 𝐋 ^ 3` - #### Molar ``` @@ -713,12 +648,9 @@ A unit for measuring molar concentration, equal to 1 mol/L. ### Power +```@docs +Unitful.Power ``` -Unitful.Power -``` - -Supertype for quantities and levels of dimension `𝐋 ^ 2 * 𝐌 * 𝐓 ^ -3` - #### Watt ``` @@ -729,12 +661,9 @@ The watt, an SI unit of power, defined as 1 J / s. ### Pressure +```@docs +Unitful.Pressure ``` -Unitful.Pressure -``` - -Supertype for quantities and levels of dimension `𝐌 * 𝐋 ^ -1 * 𝐓 ^ -2` - #### Atmosphere ``` @@ -785,12 +714,9 @@ The torr, a unit of pressure, defined as 1/760 atm. ### Velocity +```@docs +Unitful.Velocity ``` -Unitful.Velocity -``` - -Supertype for quantities and levels of dimension `𝐋 / 𝐓` - #### SpeedOfLight ``` @@ -803,12 +729,9 @@ The speed of light in a vacuum, a unit of speed, defined as exactly 2.997,924,58 ### Voltage +```@docs +Unitful.Voltage ``` -Unitful.Voltage -``` - -Supertype for quantities and levels of dimension `𝐈 ^ -1 * 𝐋 ^ 2 * 𝐌 * 𝐓 ^ -3` - #### Volt ``` @@ -819,12 +742,9 @@ The volt, an SI unit of electric potential, defined as 1 W / A. ### Volume +```@docs +Unitful.Volume ``` -Unitful.Volume -``` - -Supertype for quantities and levels of dimension `𝐋 ^ 3` - #### Liter ``` @@ -836,6 +756,15 @@ The liter, a metric unit of volume, defined as 1000 cm^3. ## Dimensionless units +#### Degree + +``` +Unitful.° +Unitful.deg +``` + +The degree, a unit of angle. There are 360° in a circle. + #### Percentmille ``` From c99af5fd2d47b803e3db3fcb81811fdb2905247a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mos=C3=A8=20Giordano?= Date: Mon, 1 Sep 2025 22:33:05 +0100 Subject: [PATCH 3/7] Delete hundreds of useless lines in `docs/src/defaultunits.md` --- docs/src/defaultunits.md | 780 +++------------------------------------ docs/src/types.md | 3 + 2 files changed, 46 insertions(+), 737 deletions(-) diff --git a/docs/src/defaultunits.md b/docs/src/defaultunits.md index 850327258..9267427cd 100644 --- a/docs/src/defaultunits.md +++ b/docs/src/defaultunits.md @@ -21,840 +21,279 @@ For prefixes, see [below](#Metric-(SI)-Prefixes). ### Amount ```@docs -Unitful.Amount -Unitful.𝐍 -``` -#### Mole - -``` +Unitful.Amount +Unitful.𝐍 Unitful.mol ``` -The mole, the SI base unit for amount of substance. - ### Current ```@docs -Unitful.Current -Unitful.𝐈 -``` -#### Ampere - -``` +Unitful.Current +Unitful.𝐈 Unitful.A ``` -The ampere, the SI base unit of electric current. - ### Length ```@docs -Unitful.Length -Unitful.𝐋 -``` -#### Angstrom - -``` +Unitful.Length +Unitful.𝐋 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 ```@docs -Unitful.Luminosity -Unitful.𝐉 -``` -#### Candela - -``` +Unitful.Luminosity +Unitful.𝐉 Unitful.cd -``` - -The candela, the SI base unit of luminous intensity. - -#### Lumen - -``` Unitful.lm ``` -The lumen, an SI unit of luminous flux, defined as 1 cd × sr. - ### Mass ```@docs -Unitful.Mass -Unitful.𝐌 -``` -#### Dram - -``` +Unitful.Mass +Unitful.𝐌 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 ```@docs -Unitful.Temperature -Unitful.𝚯 -``` -#### Kelvin - -``` +Unitful.Temperature +Unitful.𝚯 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 ```@docs -Unitful.Time -Unitful.𝐓 -``` -#### Day - -``` +Unitful.Time +Unitful.𝐓 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 ```@docs -Unitful.Acceleration -``` -#### Gal - -``` +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 ```@docs -Unitful.Area -``` -#### Are - -``` +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 ```@docs -Unitful.BField -``` -#### Gauss - -``` +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 ```@docs -Unitful.Capacitance -``` -#### Farad - -``` +Unitful.Capacitance Unitful.F ``` -The farad, an SI unit of electrical capacitance, defined as 1 s^4 × A^2 / (kg × m^2). - ### Charge ```@docs -Unitful.Charge -``` -#### Coulomb - -``` +Unitful.Charge Unitful.C ``` -The coulomb, an SI unit of electric charge, defined as 1 A × s. - ### DynamicViscosity ```@docs -Unitful.DynamicViscosity -``` -#### Poise - -``` +Unitful.DynamicViscosity Unitful.P ``` -The poise, a CGS unit of dynamic viscosity, defined as 1 dyn × s / cm^2. - ### ElectricalConductance ```@docs -Unitful.ElectricalConductance -``` -#### Siemens - -``` +Unitful.ElectricalConductance Unitful.S ``` -The siemens, an SI unit of electrical conductance, defined as 1 Ω^-1. - ### ElectricalResistance ```@docs -Unitful.ElectricalResistance -``` -#### Ohm - -``` +Unitful.ElectricalResistance Unitful.Ω ``` -The ohm, an SI unit of electrical resistance, defined as 1 V / A. - ### Energy ```@docs -Unitful.Energy -``` -#### BritishThermalUnit - -``` +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 ```@docs -Unitful.Force -``` -#### Dyne - -``` +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 ```@docs -Unitful.Frequency -``` -#### Becquerel - -``` +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 ```@docs -Unitful.HField -``` -#### Oersted - -``` +Unitful.HField Unitful.Oe ``` -The oersted, a CGS unit of magnetic H-field strength, defined as 1000 A / (4π × m). - ### Inductance ```@docs -Unitful.Inductance -``` -#### Henry - -``` +Unitful.Inductance Unitful.H ``` -The henry, an SI unit of electrical inductance, defined as 1 J / A^2. - ### KinematicViscosity ```@docs -Unitful.KinematicViscosity -``` -#### Stokes - -``` +Unitful.KinematicViscosity Unitful.St ``` -The stokes, a CGS unit of kinematic viscosity, defined as 1 cm^2 / s. - ### MagneticFlux ```@docs -Unitful.MagneticFlux -``` -#### Maxwell - -``` +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 ```@docs -Unitful.MolarFlow -``` -#### Katal - -``` +Unitful.MolarFlow Unitful.kat ``` -The katal, an SI unit of catalytic activity, defined as 1 mol of catalyzed substrate per s. - ### Molarity ```@docs -Unitful.Molarity -``` -#### Molar - -``` +Unitful.Molarity Unitful.M ``` -A unit for measuring molar concentration, equal to 1 mol/L. - ### Power ```@docs -Unitful.Power -``` -#### Watt - -``` +Unitful.Power Unitful.W ``` -The watt, an SI unit of power, defined as 1 J / s. - ### Pressure ```@docs -Unitful.Pressure -``` -#### Atmosphere - -``` +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 ```@docs -Unitful.Velocity -``` -#### SpeedOfLight - -``` +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 ```@docs -Unitful.Voltage -``` -#### Volt - -``` +Unitful.Voltage Unitful.V ``` -The volt, an SI unit of electric potential, defined as 1 W / A. - ### Volume ```@docs -Unitful.Volume -``` -#### Liter - -``` +Unitful.Volume Unitful.L -Unitful.l ``` -The liter, a metric unit of volume, defined as 1000 cm^3. - ## Dimensionless units -#### Degree - -``` +```@docs Unitful.° -Unitful.deg -``` - -The degree, a unit of angle. There are 360° in a circle. - -#### Percentmille - -``` 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 | |----------------|---------------------------------| @@ -880,161 +319,28 @@ The degree, a unit of angle. There are 360° in a circle. #### c0 -``` +```@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`. - -#### 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). - -#### gn - -``` 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). - -#### Na - -``` Unitful.Na -``` - -A quantity representing Avogadro's constant, defined as exactly 6.022,140,76 × 10^23 / mol. - -#### q - -``` 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. - -#### 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. - -#### ħ - -``` Unitful.ħ -``` - -A quantity representing the reduced Planck constant, defined as h / 2π. - -#### ε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.σ -``` - -A quantity representing the Stefan-Boltzmann constant, defined as π^2 × k^4 / (60 × ħ^3 × c^2). - -#### Φ0 - -``` Unitful.Φ0 ``` -A quantity representing the superconducting magnetic flux quantum, defined as h / (2 × q). - ## Metric (SI) Prefixes | Prefix | Name | Power of Ten | diff --git a/docs/src/types.md b/docs/src/types.md index 2142a7f33..ce0e88193 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 ``` From 7682716afa6cadd1b31b74e9f5b4c0d7aa541c11 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mos=C3=A8=20Giordano?= Date: Mon, 1 Sep 2025 22:33:31 +0100 Subject: [PATCH 4/7] Add `Unitful` to `docs` environment using `sources` --- docs/Project.toml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/docs/Project.toml b/docs/Project.toml index 418f2c7ba..c5aa735c1 100644 --- a/docs/Project.toml +++ b/docs/Project.toml @@ -4,6 +4,10 @@ Documenter = "e30172f5-a6a5-5a46-863b-614d45cd2de4" InverseFunctions = "3587e190-3f89-42d0-90ee-14403ec27112" Latexify = "23fbe1c1-3f47-55db-b15f-69d7ec21a316" Markdown = "d6f4376e-aef5-505a-96c1-9c027394607a" +Unitful = "1986cc42-f94f-5a68-af5c-568840ba703d" + +[sources] +Unitful = {path = ".."} [compat] Documenter = "1" From e78ffc488822ad18a53acdef45c06fa762a13e23 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mos=C3=A8=20Giordano?= Date: Mon, 1 Sep 2025 22:51:34 +0100 Subject: [PATCH 5/7] [CI] Upload docs build as artifact --- .github/workflows/documentation.yaml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/.github/workflows/documentation.yaml b/.github/workflows/documentation.yaml index 9a8c70865..f48cf20bd 100644 --- a/.github/workflows/documentation.yaml +++ b/.github/workflows/documentation.yaml @@ -35,3 +35,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 From 30347447dfacf2796a337905c1806a77c92f9fe2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mos=C3=A8=20Giordano?= Date: Wed, 3 Sep 2025 14:31:49 +0100 Subject: [PATCH 6/7] Switch order of dimension and quantities --- docs/src/defaultunits.md | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/docs/src/defaultunits.md b/docs/src/defaultunits.md index 9267427cd..fe73139c0 100644 --- a/docs/src/defaultunits.md +++ b/docs/src/defaultunits.md @@ -21,24 +21,24 @@ For prefixes, see [below](#Metric-(SI)-Prefixes). ### Amount ```@docs -Unitful.Amount Unitful.𝐍 +Unitful.Amount Unitful.mol ``` ### Current ```@docs -Unitful.Current Unitful.𝐈 +Unitful.Current Unitful.A ``` ### Length ```@docs -Unitful.Length Unitful.𝐋 +Unitful.Length Unitful.angstrom Unitful.cm Unitful.fm @@ -54,8 +54,8 @@ Unitful.yd ### Luminosity ```@docs -Unitful.Luminosity Unitful.𝐉 +Unitful.Luminosity Unitful.cd Unitful.lm ``` @@ -63,8 +63,8 @@ Unitful.lm ### Mass ```@docs -Unitful.Mass Unitful.𝐌 +Unitful.Mass Unitful.dr Unitful.g Unitful.gr @@ -78,8 +78,8 @@ Unitful.u ### Temperature ```@docs -Unitful.Temperature Unitful.𝚯 +Unitful.Temperature Unitful.K Unitful.Ra Unitful.°C @@ -89,8 +89,8 @@ Unitful.°F ### Time ```@docs -Unitful.Time Unitful.𝐓 +Unitful.Time Unitful.d Unitful.hr Unitful.minute From d45ce2b49236eacaffc9e45ad75b55682485118e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mos=C3=A8=20Giordano?= Date: Wed, 3 Sep 2025 14:33:12 +0100 Subject: [PATCH 7/7] Remove leftover section header Suggested-by: Sebastian Stock <42280794+sostock@users.noreply.github.com> --- docs/src/defaultunits.md | 2 -- 1 file changed, 2 deletions(-) diff --git a/docs/src/defaultunits.md b/docs/src/defaultunits.md index fe73139c0..1316cc165 100644 --- a/docs/src/defaultunits.md +++ b/docs/src/defaultunits.md @@ -317,8 +317,6 @@ Unitful.sr ## Physical constants -#### c0 - ```@docs Unitful.c0 Unitful.G